x86: don't disassemble MOVBE with two suffixes
authorJan Beulich <jbeulich@suse.com>
Tue, 14 Jul 2020 08:26:51 +0000 (10:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 14 Jul 2020 08:26:51 +0000 (10:26 +0200)
MOVBE_Fixup() is entirely redundant with the S macro already used on the
mnemonics, leading to double suffixes in suffix-always mode. Drop the
function.

gas/ChangeLog
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/movbe-suffix.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-movbe-suffix.d [new file with mode: 0644]
opcodes/ChangeLog
opcodes/i386-dis.c

index 5b44cce9ac16c73a280a2b4aa05e2f31c0ff6bd4..83f0d8cdfb99d022c77dfd56f31e63ffdf9f5b62 100644 (file)
@@ -1,3 +1,9 @@
+2020-07-14  Jan Beulich  <jbeulich@suse.com>
+
+       * testsuite/gas/i386/movbe-suffix.d,
+       testsuite/gas/i386/x86-64-movbe-suffix.d: New.
+       * testsuite/gas/i386/i386.exp: Run new tests.
+
 2020-07-14  Jan Beulich  <jbeulich@suse.com>
 
        * testsuite/gas/i386/crc32-suffix.d,
index 42d35779c6d9869f957ac39fcbaff7a54a45ef07..85441770818aac27627b0c8d2359e14d3b482d7d 100644 (file)
@@ -270,6 +270,7 @@ if [expr ([istarget "i*86-*-*"] ||  [istarget "x86_64-*-*"]) && [gas_32_check]]
     run_dump_test "sse-noavx"
     run_dump_test "movbe"
     run_dump_test "movbe-intel"
+    run_dump_test "movbe-suffix"
     run_list_test "inval-movbe" "-al"
     run_dump_test "ept"
     run_dump_test "ept-intel"
@@ -876,6 +877,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
     run_dump_test "x86-64-sse-noavx"
     run_dump_test "x86-64-movbe"
     run_dump_test "x86-64-movbe-intel"
+    run_dump_test "x86-64-movbe-suffix"
     run_list_test "x86-64-inval-movbe" "-al"
     run_dump_test "x86-64-ept"
     run_dump_test "x86-64-ept-intel"
diff --git a/gas/testsuite/gas/i386/movbe-suffix.d b/gas/testsuite/gas/i386/movbe-suffix.d
new file mode 100644 (file)
index 0000000..83de18e
--- /dev/null
@@ -0,0 +1,22 @@
+#objdump: -dwMsuffix
+#name: i386 movbe w/ suffix
+#source: movbe.s
+
+.*:     file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+[      ]*[a-f0-9]+:    66 0f 38 f0 19          movbew \(%ecx\),%bx
+[      ]*[a-f0-9]+:    0f 38 f0 19             movbel \(%ecx\),%ebx
+[      ]*[a-f0-9]+:    66 0f 38 f1 19          movbew %bx,\(%ecx\)
+[      ]*[a-f0-9]+:    0f 38 f1 19             movbel %ebx,\(%ecx\)
+[      ]*[a-f0-9]+:    66 0f 38 f0 19          movbew \(%ecx\),%bx
+[      ]*[a-f0-9]+:    0f 38 f0 19             movbel \(%ecx\),%ebx
+[      ]*[a-f0-9]+:    66 0f 38 f1 19          movbew %bx,\(%ecx\)
+[      ]*[a-f0-9]+:    0f 38 f1 19             movbel %ebx,\(%ecx\)
+[      ]*[a-f0-9]+:    66 0f 38 f0 19          movbew \(%ecx\),%bx
+[      ]*[a-f0-9]+:    0f 38 f0 19             movbel \(%ecx\),%ebx
+[      ]*[a-f0-9]+:    66 0f 38 f1 19          movbew %bx,\(%ecx\)
+[      ]*[a-f0-9]+:    0f 38 f1 19             movbel %ebx,\(%ecx\)
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-movbe-suffix.d b/gas/testsuite/gas/i386/x86-64-movbe-suffix.d
new file mode 100644 (file)
index 0000000..f6a98b1
--- /dev/null
@@ -0,0 +1,28 @@
+#objdump: -dwMsuffix
+#name: x86-64 movbe w/ suffix
+#source: x86-64-movbe.s
+
+.*:     file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+[      ]*[a-f0-9]+:    66 45 0f 38 f0 29       movbew \(%r9\),%r13w
+[      ]*[a-f0-9]+:    45 0f 38 f0 29          movbel \(%r9\),%r13d
+[      ]*[a-f0-9]+:    4d 0f 38 f0 29          movbeq \(%r9\),%r13
+[      ]*[a-f0-9]+:    66 45 0f 38 f1 29       movbew %r13w,\(%r9\)
+[      ]*[a-f0-9]+:    45 0f 38 f1 29          movbel %r13d,\(%r9\)
+[      ]*[a-f0-9]+:    4d 0f 38 f1 29          movbeq %r13,\(%r9\)
+[      ]*[a-f0-9]+:    66 45 0f 38 f0 29       movbew \(%r9\),%r13w
+[      ]*[a-f0-9]+:    45 0f 38 f0 29          movbel \(%r9\),%r13d
+[      ]*[a-f0-9]+:    4d 0f 38 f0 29          movbeq \(%r9\),%r13
+[      ]*[a-f0-9]+:    66 45 0f 38 f1 29       movbew %r13w,\(%r9\)
+[      ]*[a-f0-9]+:    45 0f 38 f1 29          movbel %r13d,\(%r9\)
+[      ]*[a-f0-9]+:    4d 0f 38 f1 29          movbeq %r13,\(%r9\)
+[      ]*[a-f0-9]+:    66 0f 38 f0 19          movbew \(%rcx\),%bx
+[      ]*[a-f0-9]+:    0f 38 f0 19             movbel \(%rcx\),%ebx
+[      ]*[a-f0-9]+:    48 0f 38 f0 19          movbeq \(%rcx\),%rbx
+[      ]*[a-f0-9]+:    66 0f 38 f1 19          movbew %bx,\(%rcx\)
+[      ]*[a-f0-9]+:    0f 38 f1 19             movbel %ebx,\(%rcx\)
+[      ]*[a-f0-9]+:    48 0f 38 f1 19          movbeq %rbx,\(%rcx\)
+#pass
index 42a2cc69ea0af7c74bfb20def868ae9ad5dc666e..0e9e75bd48b964f54b98fbff52a923d8f55d58c5 100644 (file)
@@ -1,3 +1,9 @@
+2020-07-14  Jan Beulich  <jbeulich@suse.com>
+
+       * i386-dis.c (MOVBE_Fixup): Delete.
+       (Mv): Define.
+       (prefix_table): Use Mv for movbe entries.
+
 2020-07-14  Jan Beulich  <jbeulich@suse.com>
 
        * i386-dis.c (CRC32_Fixup): Delete.
index 3199a1740de81e7d87bd4e3737a01f46f1bc46d8..aa36ef5c61ac0ce813cebdb6f725a65607e659eb 100644 (file)
@@ -118,7 +118,6 @@ static void XMM_Fixup (int, int);
 static void FXSAVE_Fixup (int, int);
 static void PCMPESTR_Fixup (int, int);
 
-static void MOVBE_Fixup (int, int);
 static void MOVSXD_Fixup (int, int);
 
 static void OP_Mask (int, int);
@@ -266,6 +265,7 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
 #define Mo { OP_M, o_mode }
 #define Mp { OP_M, f_mode }            /* 32 or 48 bit memory operand for LDS, LES etc */
 #define Mq { OP_M, q_mode }
+#define Mv { OP_M, v_mode }
 #define Mv_bnd { OP_M, v_bndmk_mode }
 #define Mx { OP_M, x_mode }
 #define Mxmm { OP_M, xmm_mode }
@@ -4422,17 +4422,17 @@ static const struct dis386 prefix_table[][4] = {
 
   /* PREFIX_0F38F0 */
   {
-    { "movbeS",        { Gv, { MOVBE_Fixup, v_mode } }, PREFIX_OPCODE },
+    { "movbeS",        { Gv, Mv }, PREFIX_OPCODE },
     { Bad_Opcode },
-    { "movbeS",        { Gv, { MOVBE_Fixup, v_mode } }, PREFIX_OPCODE },
+    { "movbeS",        { Gv, Mv }, PREFIX_OPCODE },
     { "crc32A",        { Gdq, Eb }, PREFIX_OPCODE },
   },
 
   /* PREFIX_0F38F1 */
   {
-    { "movbeS",        { { MOVBE_Fixup, v_mode }, Gv }, PREFIX_OPCODE },
+    { "movbeS",        { Mv, Gv }, PREFIX_OPCODE },
     { Bad_Opcode },
-    { "movbeS",        { { MOVBE_Fixup, v_mode }, Gv }, PREFIX_OPCODE },
+    { "movbeS",        { Mv, Gv }, PREFIX_OPCODE },
     { "crc32Q",        { Gdq, Ev }, PREFIX_OPCODE },
   },
 
@@ -16807,44 +16807,6 @@ PCLMUL_Fixup (int bytemode ATTRIBUTE_UNUSED,
     }
 }
 
-static void
-MOVBE_Fixup (int bytemode, int sizeflag)
-{
-  /* Add proper suffix to "movbe".  */
-  char *p = mnemonicendp;
-
-  switch (bytemode)
-    {
-    case v_mode:
-      if (intel_syntax)
-       goto skip;
-
-      USED_REX (REX_W);
-      if (sizeflag & SUFFIX_ALWAYS)
-       {
-         if (rex & REX_W)
-           *p++ = 'q';
-         else
-           {
-             if (sizeflag & DFLAG)
-               *p++ = 'l';
-             else
-               *p++ = 'w';
-             used_prefixes |= (prefixes & PREFIX_DATA);
-           }
-       }
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      break;
-    }
-  mnemonicendp = p;
-  *p = '\0';
-
- skip:
-  OP_M (bytemode, sizeflag);
-}
-
 static void
 MOVSXD_Fixup (int bytemode, int sizeflag)
 {
This page took 0.031531 seconds and 4 git commands to generate.