aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-10-03 04:23:55 -0700
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-10-21 00:59:28 +0300
commit564b803906b73c14461884c40d6edff3431a1ee7 (patch)
tree6331a028a8a9ae40bd6f7f49fd0f2cf6d9be845a
parentx86: Check register operand for AddrPrefixOpReg (diff)
downloadbinutils-gdb-564b803906b73c14461884c40d6edff3431a1ee7.tar.gz
binutils-gdb-564b803906b73c14461884c40d6edff3431a1ee7.tar.bz2
binutils-gdb-564b803906b73c14461884c40d6edff3431a1ee7.zip
x86: Update register operand check for AddrPrefixOpReg
When the address size prefix applies to both the memory and the register operand, we need to extract the address size prefix from the register operand if the memory operand has no real registers, like symbol, DISP or symbol(%rip). NB: GCC always generates symbol(%rip) for RIP-relative addressing for both x32 and x86-64. Move the .code16 tests in movdir.s to movdir-16bit to show the correct output from objdump. gas/ PR gas/26685 * config/tc-i386.c (process_suffix): Also check the register operand for the address size prefix if the memory operand has no real registers. * testsuite/gas/i386/enqcmd-16bit.d: New file. * testsuite/gas/i386/enqcmd-16bit.s: Likewise. * testsuite/gas/i386/movdir-16bit.d: Likewise. * testsuite/gas/i386/movdir-16bit.s: Likewise. * testsuite/gas/i386/enqcmd.s: Add tests with symbol and DISP. * testsuite/gas/i386/x86-64-enqcmd.s: Likewise. * testsuite/gas/i386/x86-64-movdir.s: Likewise. * testsuite/gas/i386/movdir.s: Add tests with symbol and DISP. Remove the .code16 test. * testsuite/gas/i386/i386.exp: Run movdir-16bit and enqcmd-16bit. * testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated. * testsuite/gas/i386/x86-64-enqcmd.d: Likewise. * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise. * testsuite/gas/i386/x86-64-movdir.d: Likewise. * testsuite/gas/i386/enqcmd-intel.d: Likewise. * testsuite/gas/i386/enqcmd.d: Likewise. * testsuite/gas/i386/movdir-intel.d: Likewise. * testsuite/gas/i386/movdir.d: Likewise. * testsuite/gas/i386/x86-64-enqcmd-intel.d: Likewise. * testsuite/gas/i386/x86-64-enqcmd.d: Likewise. * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise. * testsuite/gas/i386/x86-64-movdir.d: Likewise. opcodes/ PR gas/26685 * i386-dis.c (mod_table): Replace Gv with Gdq on movdiri. (cherry picked from commit b3a3496f83a14ad226790725c8e3ed9777fe2899) (cherry picked from commit be5ff8fe6dc4bd39caf9073f1a40816513f46a65)
-rw-r--r--gas/ChangeLog29
-rw-r--r--gas/config/tc-i386.c14
-rw-r--r--gas/testsuite/gas/i386/enqcmd-16bit.d21
-rw-r--r--gas/testsuite/gas/i386/enqcmd-16bit.s4
-rw-r--r--gas/testsuite/gas/i386/enqcmd-intel.d26
-rw-r--r--gas/testsuite/gas/i386/enqcmd.d26
-rw-r--r--gas/testsuite/gas/i386/enqcmd.s8
-rw-r--r--gas/testsuite/gas/i386/i386.exp2
-rw-r--r--gas/testsuite/gas/i386/movdir-16bit.d21
-rw-r--r--gas/testsuite/gas/i386/movdir-16bit.s4
-rw-r--r--gas/testsuite/gas/i386/movdir-intel.d27
-rw-r--r--gas/testsuite/gas/i386/movdir.d27
-rw-r--r--gas/testsuite/gas/i386/movdir.s11
-rw-r--r--gas/testsuite/gas/i386/x86-64-enqcmd-intel.d8
-rw-r--r--gas/testsuite/gas/i386/x86-64-enqcmd.d8
-rw-r--r--gas/testsuite/gas/i386/x86-64-enqcmd.s8
-rw-r--r--gas/testsuite/gas/i386/x86-64-movdir-intel.d4
-rw-r--r--gas/testsuite/gas/i386/x86-64-movdir.d4
-rw-r--r--gas/testsuite/gas/i386/x86-64-movdir.s4
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/i386-dis.c2
21 files changed, 202 insertions, 61 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 20cd40c062..114539bde9 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,6 +1,35 @@
2020-10-07 H.J. Lu <hongjiu.lu@intel.com>
PR gas/26685
+ * config/tc-i386.c (process_suffix): Also check the register
+ operand for the address size prefix if the memory operand has
+ no real registers.
+ * testsuite/gas/i386/enqcmd-16bit.d: New file.
+ * testsuite/gas/i386/enqcmd-16bit.s: Likewise.
+ * testsuite/gas/i386/movdir-16bit.d: Likewise.
+ * testsuite/gas/i386/movdir-16bit.s: Likewise.
+ * testsuite/gas/i386/enqcmd.s: Add tests with symbol and DISP.
+ * testsuite/gas/i386/x86-64-enqcmd.s: Likewise.
+ * testsuite/gas/i386/x86-64-movdir.s: Likewise.
+ * testsuite/gas/i386/movdir.s: Add tests with symbol and DISP.
+ Remove the .code16 test.
+ * testsuite/gas/i386/i386.exp: Run movdir-16bit and enqcmd-16bit.
+ * testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
+ * testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
+ * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
+ * testsuite/gas/i386/x86-64-movdir.d: Likewise.
+ * testsuite/gas/i386/enqcmd-intel.d: Likewise.
+ * testsuite/gas/i386/enqcmd.d: Likewise.
+ * testsuite/gas/i386/movdir-intel.d: Likewise.
+ * testsuite/gas/i386/movdir.d: Likewise.
+ * testsuite/gas/i386/x86-64-enqcmd-intel.d: Likewise.
+ * testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
+ * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
+ * testsuite/gas/i386/x86-64-movdir.d: Likewise.
+
+2020-10-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/26685
* config/tc-i386.c (process_suffix): Check the register operand
for the address size prefix if the memory operand is symbol(%rip).
* testsuite/gas/i386/x86-64-enqcmd.s: Add tests with RIP-relative
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 80a0425cb1..623ac77307 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7116,15 +7116,19 @@ process_suffix (void)
enum { need_word, need_dword, need_qword } need;
/* Check the register operand for the address size prefix if
- the memory operand is symbol(%rip). */
+ the memory operand has no real registers, like symbol, DISP
+ or symbol(%rip). */
if (i.mem_operands == 1
&& i.reg_operands == 1
&& i.operands == 2
- && i.base_reg
- && i.base_reg->reg_num == RegIP
- && i.base_reg->reg_type.bitfield.qword
&& i.types[1].bitfield.class == Reg
- && i.op[1].regs->reg_type.bitfield.dword
+ && (flag_code == CODE_32BIT
+ ? i.op[1].regs->reg_type.bitfield.word
+ : i.op[1].regs->reg_type.bitfield.dword)
+ && ((i.base_reg == NULL && i.index_reg == NULL)
+ || (i.base_reg
+ && i.base_reg->reg_num == RegIP
+ && i.base_reg->reg_type.bitfield.qword))
&& !add_prefix (ADDR_PREFIX_OPCODE))
return 0;
diff --git a/gas/testsuite/gas/i386/enqcmd-16bit.d b/gas/testsuite/gas/i386/enqcmd-16bit.d
new file mode 100644
index 0000000000..04e8706d29
--- /dev/null
+++ b/gas/testsuite/gas/i386/enqcmd-16bit.d
@@ -0,0 +1,21 @@
+#as: -I${srcdir}/$subdir
+#objdump: -dw -Mi8086
+#name: i386 16-bit ENQCMD[S] insns
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: 67 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 67 66 0f 38 f8 01 movdir64b \(%ecx\),%eax
+ +[a-f0-9]+: 66 0f 38 f8 04 movdir64b \(%si\),%ax
+ +[a-f0-9]+: 66 0f 38 f8 0e 00 00 movdir64b 0x0,%cx
+ +[a-f0-9]+: 66 0f 38 f8 0e 34 12 movdir64b 0x1234,%cx
+ +[a-f0-9]+: 67 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 67 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 67 66 0f 38 f8 01 movdir64b \(%ecx\),%eax
+ +[a-f0-9]+: 66 0f 38 f8 04 movdir64b \(%si\),%ax
+ +[a-f0-9]+: 66 0f 38 f8 0e 00 00 movdir64b 0x0,%cx
+ +[a-f0-9]+: 66 0f 38 f8 0e 34 12 movdir64b 0x1234,%cx
+#pass
diff --git a/gas/testsuite/gas/i386/enqcmd-16bit.s b/gas/testsuite/gas/i386/enqcmd-16bit.s
new file mode 100644
index 0000000000..1f21cec363
--- /dev/null
+++ b/gas/testsuite/gas/i386/enqcmd-16bit.s
@@ -0,0 +1,4 @@
+# Check ENQCMD[S] 16-bit instructions
+
+ .code16
+.include "movdir.s"
diff --git a/gas/testsuite/gas/i386/enqcmd-intel.d b/gas/testsuite/gas/i386/enqcmd-intel.d
index b38c3ed6ee..e1d30dacd7 100644
--- a/gas/testsuite/gas/i386/enqcmd-intel.d
+++ b/gas/testsuite/gas/i386/enqcmd-intel.d
@@ -8,13 +8,21 @@
Disassembly of section \.text:
-00000000 <_start>:
-[ ]*[a-f0-9]+:[ ]*f2 0f 38 f8 01[ ]*enqcmd eax,\[ecx\]
-[ ]*[a-f0-9]+:[ ]*67 f2 0f 38 f8 04[ ]*enqcmd ax,\[si\]
-[ ]*[a-f0-9]+:[ ]*f3 0f 38 f8 01[ ]*enqcmds eax,\[ecx\]
-[ ]*[a-f0-9]+:[ ]*67 f3 0f 38 f8 04[ ]*enqcmds ax,\[si\]
-[ ]*[a-f0-9]+:[ ]*f2 0f 38 f8 01[ ]*enqcmd eax,\[ecx\]
-[ ]*[a-f0-9]+:[ ]*67 f2 0f 38 f8 04[ ]*enqcmd ax,\[si\]
-[ ]*[a-f0-9]+:[ ]*f3 0f 38 f8 01[ ]*enqcmds eax,\[ecx\]
-[ ]*[a-f0-9]+:[ ]*67 f3 0f 38 f8 04[ ]*enqcmds ax,\[si\]
+0+ <_start>:
+ +[a-f0-9]+: f2 0f 38 f8 01 enqcmd eax,\[ecx\]
+ +[a-f0-9]+: 67 f2 0f 38 f8 04 enqcmd ax,\[si\]
+ +[a-f0-9]+: f3 0f 38 f8 01 enqcmds eax,\[ecx\]
+ +[a-f0-9]+: 67 f3 0f 38 f8 04 enqcmds ax,\[si\]
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 00 00 enqcmd cx,ds:0x0
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 34 12 enqcmd cx,ds:0x1234
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 00 00 enqcmds cx,ds:0x0
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 34 12 enqcmds cx,ds:0x1234
+ +[a-f0-9]+: f2 0f 38 f8 01 enqcmd eax,\[ecx\]
+ +[a-f0-9]+: 67 f2 0f 38 f8 04 enqcmd ax,\[si\]
+ +[a-f0-9]+: f3 0f 38 f8 01 enqcmds eax,\[ecx\]
+ +[a-f0-9]+: 67 f3 0f 38 f8 04 enqcmds ax,\[si\]
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 00 00 enqcmd cx,ds:0x0
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 34 12 enqcmd cx,ds:0x1234
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 00 00 enqcmds cx,ds:0x0
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 34 12 enqcmds cx,ds:0x1234
#pass
diff --git a/gas/testsuite/gas/i386/enqcmd.d b/gas/testsuite/gas/i386/enqcmd.d
index c601185ba3..99b9c0a729 100644
--- a/gas/testsuite/gas/i386/enqcmd.d
+++ b/gas/testsuite/gas/i386/enqcmd.d
@@ -8,13 +8,21 @@
Disassembly of section \.text:
-00000000 <_start>:
-[ ]*[a-f0-9]+:[ ]*f2 0f 38 f8 01[ ]*enqcmd \(%ecx\),%eax
-[ ]*[a-f0-9]+:[ ]*67 f2 0f 38 f8 04[ ]*enqcmd \(%si\),%ax
-[ ]*[a-f0-9]+:[ ]*f3 0f 38 f8 01[ ]*enqcmds \(%ecx\),%eax
-[ ]*[a-f0-9]+:[ ]*67 f3 0f 38 f8 04[ ]*enqcmds \(%si\),%ax
-[ ]*[a-f0-9]+:[ ]*f2 0f 38 f8 01[ ]*enqcmd \(%ecx\),%eax
-[ ]*[a-f0-9]+:[ ]*67 f2 0f 38 f8 04[ ]*enqcmd \(%si\),%ax
-[ ]*[a-f0-9]+:[ ]*f3 0f 38 f8 01[ ]*enqcmds \(%ecx\),%eax
-[ ]*[a-f0-9]+:[ ]*67 f3 0f 38 f8 04[ ]*enqcmds \(%si\),%ax
+0+ <_start>:
+ +[a-f0-9]+: f2 0f 38 f8 01 enqcmd \(%ecx\),%eax
+ +[a-f0-9]+: 67 f2 0f 38 f8 04 enqcmd \(%si\),%ax
+ +[a-f0-9]+: f3 0f 38 f8 01 enqcmds \(%ecx\),%eax
+ +[a-f0-9]+: 67 f3 0f 38 f8 04 enqcmds \(%si\),%ax
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 00 00 enqcmd 0x0,%cx
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 34 12 enqcmd 0x1234,%cx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 00 00 enqcmds 0x0,%cx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 34 12 enqcmds 0x1234,%cx
+ +[a-f0-9]+: f2 0f 38 f8 01 enqcmd \(%ecx\),%eax
+ +[a-f0-9]+: 67 f2 0f 38 f8 04 enqcmd \(%si\),%ax
+ +[a-f0-9]+: f3 0f 38 f8 01 enqcmds \(%ecx\),%eax
+ +[a-f0-9]+: 67 f3 0f 38 f8 04 enqcmds \(%si\),%ax
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 00 00 enqcmd 0x0,%cx
+ +[a-f0-9]+: 67 f2 0f 38 f8 0e 34 12 enqcmd 0x1234,%cx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 00 00 enqcmds 0x0,%cx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0e 34 12 enqcmds 0x1234,%cx
#pass
diff --git a/gas/testsuite/gas/i386/enqcmd.s b/gas/testsuite/gas/i386/enqcmd.s
index 0a23b25a6f..f7195fa723 100644
--- a/gas/testsuite/gas/i386/enqcmd.s
+++ b/gas/testsuite/gas/i386/enqcmd.s
@@ -7,9 +7,17 @@ _start:
enqcmd (%si),%ax
enqcmds (%ecx),%eax
enqcmds (%si),%ax
+ enqcmd foo, %cx
+ enqcmd 0x1234, %cx
+ enqcmds foo, %cx
+ enqcmds 0x1234, %cx
.intel_syntax noprefix
enqcmd eax,[ecx]
enqcmd ax,[si]
enqcmds eax,[ecx]
enqcmds ax,[si]
+ enqcmd cx,ds:foo
+ enqcmd cx,ds:0x1234
+ enqcmds cx,ds:foo
+ enqcmds cx,ds:0x1234
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 6563aae246..3580d5d791 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -475,9 +475,11 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "cldemote-intel"
run_dump_test "movdir"
run_dump_test "movdir-intel"
+ run_dump_test "movdir-16bit"
run_list_test "movdir64b-reg"
run_dump_test "enqcmd"
run_dump_test "enqcmd-intel"
+ run_dump_test "enqcmd-16bit"
run_list_test "enqcmd-inval"
run_dump_test "serialize"
run_dump_test "tsxldtrk"
diff --git a/gas/testsuite/gas/i386/movdir-16bit.d b/gas/testsuite/gas/i386/movdir-16bit.d
new file mode 100644
index 0000000000..ac5d82507f
--- /dev/null
+++ b/gas/testsuite/gas/i386/movdir-16bit.d
@@ -0,0 +1,21 @@
+#as: -I${srcdir}/$subdir
+#objdump: -dw -Mi8086
+#name: i386 16-bit MOVDIR[I,64B] insns
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: 67 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 67 66 0f 38 f8 01 movdir64b \(%ecx\),%eax
+ +[a-f0-9]+: 66 0f 38 f8 04 movdir64b \(%si\),%ax
+ +[a-f0-9]+: 66 0f 38 f8 0e 00 00 movdir64b 0x0,%cx
+ +[a-f0-9]+: 66 0f 38 f8 0e 34 12 movdir64b 0x1234,%cx
+ +[a-f0-9]+: 67 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 67 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 67 66 0f 38 f8 01 movdir64b \(%ecx\),%eax
+ +[a-f0-9]+: 66 0f 38 f8 04 movdir64b \(%si\),%ax
+ +[a-f0-9]+: 66 0f 38 f8 0e 00 00 movdir64b 0x0,%cx
+ +[a-f0-9]+: 66 0f 38 f8 0e 34 12 movdir64b 0x1234,%cx
+#pass
diff --git a/gas/testsuite/gas/i386/movdir-16bit.s b/gas/testsuite/gas/i386/movdir-16bit.s
new file mode 100644
index 0000000000..27f5fda5a5
--- /dev/null
+++ b/gas/testsuite/gas/i386/movdir-16bit.s
@@ -0,0 +1,4 @@
+# Check MOVDIR[I,64B] 16-bit instructions
+
+ .code16
+.include "movdir.s"
diff --git a/gas/testsuite/gas/i386/movdir-intel.d b/gas/testsuite/gas/i386/movdir-intel.d
index 04f58a7892..56f4fa929a 100644
--- a/gas/testsuite/gas/i386/movdir-intel.d
+++ b/gas/testsuite/gas/i386/movdir-intel.d
@@ -8,19 +8,16 @@
Disassembly of section \.text:
-00000000 <_start>:
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri DWORD PTR \[ecx\],eax
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 01[ ]*movdir64b eax,\[ecx\]
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 04[ ]*movdir64b ax,\[si\]
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri DWORD PTR \[ecx\],eax
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri DWORD PTR \[ecx\],eax
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 01[ ]*movdir64b eax,\[ecx\]
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 04[ ]*movdir64b ax,\[si\]
-[ ]*[a-f0-9]+:[ ]*67 0f 38 f9 01[ ]*movdiri DWORD PTR \[bx\+di\],eax
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 01[ ]*movdir64b ax,\[bx\+di\]
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 04 67[ ]*movdir64b eax,\[edi\+eiz\*2\]
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri DWORD PTR \[ecx\],eax
-[ ]*[a-f0-9]+:[ ]*67 0f 38 f9 01[ ]*movdiri DWORD PTR \[bx\+di\],eax
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 01[ ]*movdir64b ax,\[bx\+di\]
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 04 90[ ]*movdir64b eax,\[eax\+edx\*4\]
+0+ <_start>:
+ +[a-f0-9]+: 0f 38 f9 01 movdiri DWORD PTR \[ecx\],eax
+ +[a-f0-9]+: 66 0f 38 f8 01 movdir64b eax,\[ecx\]
+ +[a-f0-9]+: 67 66 0f 38 f8 04 movdir64b ax,\[si\]
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 00 00 movdir64b cx,ds:0x0
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 34 12 movdir64b cx,ds:0x1234
+ +[a-f0-9]+: 0f 38 f9 01 movdiri DWORD PTR \[ecx\],eax
+ +[a-f0-9]+: 0f 38 f9 01 movdiri DWORD PTR \[ecx\],eax
+ +[a-f0-9]+: 66 0f 38 f8 01 movdir64b eax,\[ecx\]
+ +[a-f0-9]+: 67 66 0f 38 f8 04 movdir64b ax,\[si\]
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 00 00 movdir64b cx,ds:0x0
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 34 12 movdir64b cx,ds:0x1234
#pass
diff --git a/gas/testsuite/gas/i386/movdir.d b/gas/testsuite/gas/i386/movdir.d
index 192dad9920..a8f324bdde 100644
--- a/gas/testsuite/gas/i386/movdir.d
+++ b/gas/testsuite/gas/i386/movdir.d
@@ -8,19 +8,16 @@
Disassembly of section \.text:
-00000000 <_start>:
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri %eax,\(%ecx\)
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 01[ ]*movdir64b \(%ecx\),%eax
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 04[ ]*movdir64b \(%si\),%ax
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri %eax,\(%ecx\)
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri %eax,\(%ecx\)
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 01[ ]*movdir64b \(%ecx\),%eax
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 04[ ]*movdir64b \(%si\),%ax
-[ ]*[a-f0-9]+:[ ]*67 0f 38 f9 01[ ]*movdiri %eax,\(%bx,%di\)
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 01[ ]*movdir64b \(%bx,%di\),%ax
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 04 67[ ]*movdir64b \(%edi,%eiz,2\),%eax
-[ ]*[a-f0-9]+:[ ]*0f 38 f9 01[ ]*movdiri %eax,\(%ecx\)
-[ ]*[a-f0-9]+:[ ]*67 0f 38 f9 01[ ]*movdiri %eax,\(%bx,%di\)
-[ ]*[a-f0-9]+:[ ]*67 66 0f 38 f8 01[ ]*movdir64b \(%bx,%di\),%ax
-[ ]*[a-f0-9]+:[ ]*66 0f 38 f8 04 90[ ]*movdir64b \(%eax,%edx,4\),%eax
+0+ <_start>:
+ +[a-f0-9]+: 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 66 0f 38 f8 01 movdir64b \(%ecx\),%eax
+ +[a-f0-9]+: 67 66 0f 38 f8 04 movdir64b \(%si\),%ax
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 00 00 movdir64b 0x0,%cx
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 34 12 movdir64b 0x1234,%cx
+ +[a-f0-9]+: 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 0f 38 f9 01 movdiri %eax,\(%ecx\)
+ +[a-f0-9]+: 66 0f 38 f8 01 movdir64b \(%ecx\),%eax
+ +[a-f0-9]+: 67 66 0f 38 f8 04 movdir64b \(%si\),%ax
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 00 00 movdir64b 0x0,%cx
+ +[a-f0-9]+: 67 66 0f 38 f8 0e 34 12 movdir64b 0x1234,%cx
#pass
diff --git a/gas/testsuite/gas/i386/movdir.s b/gas/testsuite/gas/i386/movdir.s
index 29c381ca23..00c57db141 100644
--- a/gas/testsuite/gas/i386/movdir.s
+++ b/gas/testsuite/gas/i386/movdir.s
@@ -3,19 +3,16 @@
.allow_index_reg
.text
_start:
- .rept 2
movdiri %eax, (%ecx)
movdir64b (%ecx),%eax
movdir64b (%si),%ax
+ movdir64b foo, %cx
+ movdir64b 0x1234, %cx
.intel_syntax noprefix
movdiri [ecx], eax
movdiri dword ptr [ecx], eax
movdir64b eax,[ecx]
movdir64b ax,[si]
-
- .att_syntax prefix
- .code16
- .endr
-
- nop
+ movdir64b cx,ds:foo
+ movdir64b cx,ds:0x1234
diff --git a/gas/testsuite/gas/i386/x86-64-enqcmd-intel.d b/gas/testsuite/gas/i386/x86-64-enqcmd-intel.d
index 64d325171b..d8dc7facba 100644
--- a/gas/testsuite/gas/i386/x86-64-enqcmd-intel.d
+++ b/gas/testsuite/gas/i386/x86-64-enqcmd-intel.d
@@ -19,6 +19,10 @@ Disassembly of section \.text:
+[a-f0-9]+: f3 0f 38 f8 0d 00 00 00 00 enqcmds rcx,\[rip\+0x0\] #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds ecx,\[eip\+0x0\] #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds ecx,\[eip\+0x0\] #.*
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 00 00 00 00 enqcmd ecx,\[eiz\*1\+0x0\]
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 78 56 34 12 enqcmd ecx,\[eiz\*1\+0x12345678\]
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 00 00 00 00 enqcmds ecx,\[eiz\*1\+0x0\]
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 78 56 34 12 enqcmds ecx,\[eiz\*1\+0x12345678\]
+[a-f0-9]+: f2 0f 38 f8 01 enqcmd rax,\[rcx\]
+[a-f0-9]+: 67 f2 0f 38 f8 01 enqcmd eax,\[ecx\]
+[a-f0-9]+: f3 0f 38 f8 01 enqcmds rax,\[rcx\]
@@ -29,4 +33,8 @@ Disassembly of section \.text:
+[a-f0-9]+: f3 0f 38 f8 0d 00 00 00 00 enqcmds rcx,\[rip\+0x0\] #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds ecx,\[eip\+0x0\] #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds ecx,\[eip\+0x0\] #.*
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 00 00 00 00 enqcmd ecx,\[eiz\*1\+0x0\]
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 78 56 34 12 enqcmd ecx,\[eiz\*1\+0x12345678\]
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 00 00 00 00 enqcmds ecx,\[eiz\*1\+0x0\]
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 78 56 34 12 enqcmds ecx,\[eiz\*1\+0x12345678\]
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-enqcmd.d b/gas/testsuite/gas/i386/x86-64-enqcmd.d
index 5f6676636e..e6f627ff09 100644
--- a/gas/testsuite/gas/i386/x86-64-enqcmd.d
+++ b/gas/testsuite/gas/i386/x86-64-enqcmd.d
@@ -19,6 +19,10 @@ Disassembly of section \.text:
+[a-f0-9]+: f3 0f 38 f8 0d 00 00 00 00 enqcmds 0x0\(%rip\),%rcx #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds 0x0\(%eip\),%ecx #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds 0x0\(%eip\),%ecx #.*
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 00 00 00 00 enqcmd 0x0\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 78 56 34 12 enqcmd 0x12345678\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 00 00 00 00 enqcmds 0x0\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 78 56 34 12 enqcmds 0x12345678\(,%eiz,1\),%ecx
+[a-f0-9]+: f2 0f 38 f8 01 enqcmd \(%rcx\),%rax
+[a-f0-9]+: 67 f2 0f 38 f8 01 enqcmd \(%ecx\),%eax
+[a-f0-9]+: f3 0f 38 f8 01 enqcmds \(%rcx\),%rax
@@ -29,4 +33,8 @@ Disassembly of section \.text:
+[a-f0-9]+: f3 0f 38 f8 0d 00 00 00 00 enqcmds 0x0\(%rip\),%rcx #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds 0x0\(%eip\),%ecx #.*
+[a-f0-9]+: 67 f3 0f 38 f8 0d 00 00 00 00 enqcmds 0x0\(%eip\),%ecx #.*
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 00 00 00 00 enqcmd 0x0\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 f2 0f 38 f8 0c 25 78 56 34 12 enqcmd 0x12345678\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 00 00 00 00 enqcmds 0x0\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 f3 0f 38 f8 0c 25 78 56 34 12 enqcmds 0x12345678\(,%eiz,1\),%ecx
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-enqcmd.s b/gas/testsuite/gas/i386/x86-64-enqcmd.s
index d1f3aca5ce..a03a5ffc5f 100644
--- a/gas/testsuite/gas/i386/x86-64-enqcmd.s
+++ b/gas/testsuite/gas/i386/x86-64-enqcmd.s
@@ -13,6 +13,10 @@ _start:
enqcmds foo(%rip),%rcx
enqcmds foo(%rip),%ecx
enqcmds foo(%eip),%ecx
+ enqcmd foo, %ecx
+ enqcmd 0x12345678, %ecx
+ enqcmds foo, %ecx
+ enqcmds 0x12345678, %ecx
.intel_syntax noprefix
enqcmd rax,[rcx]
@@ -25,3 +29,7 @@ _start:
enqcmds rcx,[rip+foo]
enqcmds ecx,[rip+foo]
enqcmds ecx,[eip+foo]
+ enqcmd ecx,ds:foo
+ enqcmd ecx,ds:0x12345678
+ enqcmds ecx,ds:foo
+ enqcmds ecx,ds:0x12345678
diff --git a/gas/testsuite/gas/i386/x86-64-movdir-intel.d b/gas/testsuite/gas/i386/x86-64-movdir-intel.d
index fe92e80d71..a35bc6ca5d 100644
--- a/gas/testsuite/gas/i386/x86-64-movdir-intel.d
+++ b/gas/testsuite/gas/i386/x86-64-movdir-intel.d
@@ -15,6 +15,8 @@ Disassembly of section \.text:
+[a-f0-9]+: 66 0f 38 f8 0d 00 00 00 00 movdir64b rcx,\[rip\+0x0\] #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b ecx,\[eip\+0x0\] #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b ecx,\[eip\+0x0\] #.*
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 00 00 00 00 movdir64b ecx,\[eiz\*1\+0x0\]
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 78 56 34 12 movdir64b ecx,\[eiz\*1\+0x12345678\]
+[a-f0-9]+: 0f 38 f9 01 movdiri DWORD PTR \[rcx\],eax
+[a-f0-9]+: 48 0f 38 f9 01 movdiri QWORD PTR \[rcx\],rax
+[a-f0-9]+: 0f 38 f9 01 movdiri DWORD PTR \[rcx\],eax
@@ -24,4 +26,6 @@ Disassembly of section \.text:
+[a-f0-9]+: 66 0f 38 f8 0d 00 00 00 00 movdir64b rcx,\[rip\+0x0\] #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b ecx,\[eip\+0x0\] #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b ecx,\[eip\+0x0\] #.*
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 00 00 00 00 movdir64b ecx,\[eiz\*1\+0x0\]
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 78 56 34 12 movdir64b ecx,\[eiz\*1\+0x12345678\]
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-movdir.d b/gas/testsuite/gas/i386/x86-64-movdir.d
index 297c63fd00..d65787177d 100644
--- a/gas/testsuite/gas/i386/x86-64-movdir.d
+++ b/gas/testsuite/gas/i386/x86-64-movdir.d
@@ -15,6 +15,8 @@ Disassembly of section \.text:
+[a-f0-9]+: 66 0f 38 f8 0d 00 00 00 00 movdir64b 0x0\(%rip\),%rcx #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b 0x0\(%eip\),%ecx #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b 0x0\(%eip\),%ecx #.*
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 00 00 00 00 movdir64b 0x0\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 78 56 34 12 movdir64b 0x12345678\(,%eiz,1\),%ecx
+[a-f0-9]+: 0f 38 f9 01 movdiri %eax,\(%rcx\)
+[a-f0-9]+: 48 0f 38 f9 01 movdiri %rax,\(%rcx\)
+[a-f0-9]+: 0f 38 f9 01 movdiri %eax,\(%rcx\)
@@ -24,4 +26,6 @@ Disassembly of section \.text:
+[a-f0-9]+: 66 0f 38 f8 0d 00 00 00 00 movdir64b 0x0\(%rip\),%rcx #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b 0x0\(%eip\),%ecx #.*
+[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00 movdir64b 0x0\(%eip\),%ecx #.*
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 00 00 00 00 movdir64b 0x0\(,%eiz,1\),%ecx
+ +[a-f0-9]+: 67 66 0f 38 f8 0c 25 78 56 34 12 movdir64b 0x12345678\(,%eiz,1\),%ecx
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-movdir.s b/gas/testsuite/gas/i386/x86-64-movdir.s
index 33b6031881..ad69bb1322 100644
--- a/gas/testsuite/gas/i386/x86-64-movdir.s
+++ b/gas/testsuite/gas/i386/x86-64-movdir.s
@@ -9,6 +9,8 @@ _start:
movdir64b foo(%rip),%rcx
movdir64b foo(%rip),%ecx
movdir64b foo(%eip),%ecx
+ movdir64b foo, %ecx
+ movdir64b 0x12345678, %ecx
.intel_syntax noprefix
movdiri [rcx],eax
@@ -20,3 +22,5 @@ _start:
movdir64b rcx,[rip+foo]
movdir64b ecx,[rip+foo]
movdir64b ecx,[eip+foo]
+ movdir64b ecx,ds:foo
+ movdir64b ecx,ds:0x12345678
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 93de78464e..fada4f8c94 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2020-10-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/26685
+ * i386-dis.c (mod_table): Replace Gv with Gdq on movdiri.
+
2020-10-07 Jan Beulich <jbeulich@suse.com>
* i386-dis.c (OP_E_memory): Revert previous change.
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index e0cee46956..ea2ca1bb88 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -10496,7 +10496,7 @@ static const struct dis386 mod_table[][2] = {
},
{
/* MOD_0F38F9_PREFIX_0 */
- { "movdiri", { Ev, Gv }, PREFIX_OPCODE },
+ { "movdiri", { Ev, Gdq }, PREFIX_OPCODE },
},
{
/* MOD_62_32BIT */