GNU Binutils with patches for OS216
Revision | 4e518864c879be2e6af4c64415e8775d9a20deaf (tree) |
---|---|
Time | 2018-11-26 21:30:54 |
Author | Jan Beulich <jbeulich@nove...> |
Commiter | H.J. Lu |
x86: don't mistakenly scale non-8-bit displacements
In commit b5014f7af2 I've removed (instead of replaced) a conditional,
resulting in addressing forms not allowing 8-bit displacements to now
get their displacements scaled under certain circumstances. Re-add the
missing conditional.
2018-07-30 Jan Beulich <jbeulich@suse.com>
PR gas/23465
* config/tc-i386.c (output_disp): Restrict scaling.
* testsuite/gas/i386/evex-no-scale.s,
testsuite/gas/i386/evex-no-scale-32.d
testsuite/gas/i386/evex-no-scale-64.d: New.
* testsuite/gas/i386/i386.exp: Run new tests.
(cherry picked from commit 629cfaf1b0fbb32a985607c774bd8e7870b9fa94)
@@ -1,3 +1,12 @@ | ||
1 | +2018-11-26 Jan Beulich <jbeulich@suse.com> | |
2 | + | |
3 | + PR gas/23465 | |
4 | + * config/tc-i386.c (output_disp): Restrict scaling. | |
5 | + * testsuite/gas/i386/evex-no-scale.s, | |
6 | + testsuite/gas/i386/evex-no-scale-32.d | |
7 | + testsuite/gas/i386/evex-no-scale-64.d: New. | |
8 | + * testsuite/gas/i386/i386.exp: Run new tests. | |
9 | + | |
1 | 10 | 2018-08-05 John David Anglin <danglin@gcc.gnu.org> |
2 | 11 | |
3 | 12 | Backport from master branch |
@@ -7418,7 +7418,8 @@ output_disp (fragS *insn_start_frag, offsetT insn_start_off) | ||
7418 | 7418 | int size = disp_size (n); |
7419 | 7419 | offsetT val = i.op[n].disps->X_add_number; |
7420 | 7420 | |
7421 | - val = offset_in_range (val >> i.memshift, size); | |
7421 | + val = offset_in_range (val >> (size == 1 ? i.memshift : 0), | |
7422 | + size); | |
7422 | 7423 | p = frag_more (size); |
7423 | 7424 | md_number_to_chars (p, val, size); |
7424 | 7425 | } |
@@ -0,0 +1,13 @@ | ||
1 | +#source: evex-no-scale.s | |
2 | +#objdump: -dw | |
3 | +#name: ix86 EVEX no disp scaling | |
4 | + | |
5 | +.*: +file format .* | |
6 | + | |
7 | +Disassembly of section .text: | |
8 | + | |
9 | +0+ <disp>: | |
10 | + +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0 | |
11 | + +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0 | |
12 | + +[a-f0-9]+: 62 f1 7c 48 28 05 40 00 00 00 vmovaps 0x40,%zmm0 | |
13 | + +[a-f0-9]+: 67 62 f1 7c 48 28 06 40 00 vmovaps 0x40,%zmm0 |
@@ -0,0 +1,15 @@ | ||
1 | +#source: evex-no-scale.s | |
2 | +#objdump: -dw | |
3 | +#name: x86-64 EVEX no disp scaling | |
4 | + | |
5 | +.*: +file format .* | |
6 | + | |
7 | +Disassembly of section .text: | |
8 | + | |
9 | +0+ <disp>: | |
10 | + +[a-f0-9]+: 62 f1 7c 48 28 05 00 fc ff ff vmovaps -0x400\(%rip\),%zmm0 # .* | |
11 | + +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%rax,1\),%zmm0 | |
12 | + +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0 | |
13 | + +[a-f0-9]+: 67 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0 | |
14 | + +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 addr32 vmovaps 0x40,%zmm0 | |
15 | + +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0 |
@@ -0,0 +1,19 @@ | ||
1 | + .allow_index_reg | |
2 | + .section .probe, "", @progbits | |
3 | +.Lprobe_64bit: | |
4 | + inc %eax | |
5 | +.equiv is_64bit, (. - .Lprobe_64bit) / 2 | |
6 | + | |
7 | + .text | |
8 | +disp: | |
9 | +.if is_64bit | |
10 | + vmovaps -1024(%rip), %zmm0 | |
11 | + vmovaps 64(,%rax), %zmm0 | |
12 | + vmovaps 64(,%riz), %zmm0 | |
13 | +.endif | |
14 | + vmovaps 64(,%eax), %zmm0 | |
15 | + vmovaps 64(,%eiz), %zmm0 | |
16 | + vmovaps 64, %zmm0 | |
17 | +.if !is_64bit | |
18 | + addr16 vmovaps 64, %zmm0 | |
19 | +.endif |
@@ -216,6 +216,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] | ||
216 | 216 | run_dump_test "evex-lig512-intel" |
217 | 217 | run_dump_test "evex-wig1" |
218 | 218 | run_dump_test "evex-wig1-intel" |
219 | + run_dump_test "evex-no-scale-32" | |
219 | 220 | run_dump_test "sse2avx" |
220 | 221 | run_list_test "inval-avx" "-al" |
221 | 222 | run_list_test "inval-avx512f" "-al" |
@@ -692,6 +693,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t | ||
692 | 693 | run_dump_test "x86-64-evex-lig512-intel" |
693 | 694 | run_dump_test "x86-64-evex-wig1" |
694 | 695 | run_dump_test "x86-64-evex-wig1-intel" |
696 | + run_dump_test "evex-no-scale-64" | |
695 | 697 | run_dump_test "x86-64-sse2avx" |
696 | 698 | run_list_test "x86-64-inval-avx" "-al" |
697 | 699 | run_list_test "x86-64-inval-avx512f" "-al" |