• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revision4e518864c879be2e6af4c64415e8775d9a20deaf (tree)
Time2018-11-26 21:30:54
AuthorJan Beulich <jbeulich@nove...>
CommiterH.J. Lu

Log Message

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)

Change Summary

Incremental Difference

--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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+
110 2018-08-05 John David Anglin <danglin@gcc.gnu.org>
211
312 Backport from master branch
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7418,7 +7418,8 @@ output_disp (fragS *insn_start_frag, offsetT insn_start_off)
74187418 int size = disp_size (n);
74197419 offsetT val = i.op[n].disps->X_add_number;
74207420
7421- val = offset_in_range (val >> i.memshift, size);
7421+ val = offset_in_range (val >> (size == 1 ? i.memshift : 0),
7422+ size);
74227423 p = frag_more (size);
74237424 md_number_to_chars (p, val, size);
74247425 }
--- /dev/null
+++ b/gas/testsuite/gas/i386/evex-no-scale-32.d
@@ -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
--- /dev/null
+++ b/gas/testsuite/gas/i386/evex-no-scale-64.d
@@ -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
--- /dev/null
+++ b/gas/testsuite/gas/i386/evex-no-scale.s
@@ -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
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -216,6 +216,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
216216 run_dump_test "evex-lig512-intel"
217217 run_dump_test "evex-wig1"
218218 run_dump_test "evex-wig1-intel"
219+ run_dump_test "evex-no-scale-32"
219220 run_dump_test "sse2avx"
220221 run_list_test "inval-avx" "-al"
221222 run_list_test "inval-avx512f" "-al"
@@ -692,6 +693,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
692693 run_dump_test "x86-64-evex-lig512-intel"
693694 run_dump_test "x86-64-evex-wig1"
694695 run_dump_test "x86-64-evex-wig1-intel"
696+ run_dump_test "evex-no-scale-64"
695697 run_dump_test "x86-64-sse2avx"
696698 run_list_test "x86-64-inval-avx" "-al"
697699 run_list_test "x86-64-inval-avx512f" "-al"