x86: drop need_vex_reg
authorJan Beulich <jbeulich@suse.com>
Tue, 14 Jul 2020 08:32:19 +0000 (10:32 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 14 Jul 2020 08:32:19 +0000 (10:32 +0200)
It was quite odd for the prior operand handling to have to clear this
flag for the actual operand handling to print nothing. Have the actual
operand handling determine whether the operand is actually present.
With this {d,q}_scalar_swap_mode become unused and hence also get dropped.

opcodes/ChangeLog
opcodes/i386-dis-evex-w.h
opcodes/i386-dis.c

index 03c0d65e81e1f1c80054cd40a57ae9421cdec55e..52f7b89139519baf6c0eec45d6438c104baa00a1 100644 (file)
@@ -1,3 +1,24 @@
+2020-07-14  Jan Beulich  <jbeulich@suse.com>
+
+       * i386-dis.c (OP_VexR, VexScalarR): New.
+       (OP_EX_Vex, OP_XMM_Vex, EXdVexScalarS, EXqVexScalarS,
+       XMVexScalar, d_scalar_swap_mode, q_scalar_swap_mode,
+       need_vex_reg): Delete.
+       (prefix_table): Replace VexScalar by VexScalarR and
+       XMVexScalar by XMScalar for vmovss and vmovsd. Replace
+       EXdVexScalarS by EXdS and EXqVexScalarS by EXqS.
+       (vex_len_table): Replace EXqVexScalarS by EXqS.
+       (get_valid_dis386): Don't set need_vex_reg.
+       (print_insn): Don't initialize need_vex_reg.
+       (intel_operand_size, OP_E_memory): Drop d_scalar_swap_mode and
+       q_scalar_swap_mode cases.
+       (OP_EX): Don't check for d_scalar_swap_mode and
+       q_scalar_swap_mode.
+       (OP_VEX): Done check need_vex_reg.
+       * i386-dis-evex-w.h: Replace VexScalar by VexScalarR and
+       XMVexScalar by XMScalar for vmovss and vmovsd. Replace
+       EXdVexScalarS by EXdS and EXqVexScalarS by EXqS.
+
 2020-07-14  Jan Beulich  <jbeulich@suse.com>
 
        * i386-dis.c (Vex128, Vex256, vex128_mode, vex256_mode): Delete.
index 695cf8195d53ec9199e7b37b4667ce1ca92e195b..10c0b836bffc165017310a647ee2084c9a289bad 100644 (file)
@@ -1,20 +1,20 @@
   /* EVEX_W_0F10_P_1 */
   {
-    { "vmovss",        { XMVexScalar, VexScalar, EXxmm_md }, 0 },
+    { "vmovss",        { XMScalar, VexScalarR, EXxmm_md }, 0 },
   },
   /* EVEX_W_0F10_P_3 */
   {
     { Bad_Opcode },
-    { "vmovsd",        { XMVexScalar, VexScalar, EXxmm_mq }, 0 },
+    { "vmovsd",        { XMScalar, VexScalarR, EXxmm_mq }, 0 },
   },
   /* EVEX_W_0F11_P_1 */
   {
-    { "vmovss",        { EXdVexScalarS, VexScalar, XMScalar }, 0 },
+    { "vmovss",        { EXdS, VexScalarR, XMScalar }, 0 },
   },
   /* EVEX_W_0F11_P_3 */
   {
     { Bad_Opcode },
-    { "vmovsd",        { EXqVexScalarS, VexScalar, XMScalar }, 0 },
+    { "vmovsd",        { EXqS, VexScalarR, XMScalar }, 0 },
   },
   /* EVEX_W_0F12_P_0_M_1 */
   {
   /* EVEX_W_0FD6_P_2 */
   {
     { Bad_Opcode },
-    { "vmovq", { EXqVexScalarS, XMScalar }, 0 },
+    { "vmovq", { EXqS, XMScalar }, 0 },
   },
   /* EVEX_W_0FE6_P_1 */
   {
index e28a6a97422dfef0026be45f7237b92410e57082..3b8eb3009745faa75189875d9d2e1625be8052c5 100644 (file)
@@ -88,9 +88,8 @@ static void OP_MS (int, int);
 static void OP_XS (int, int);
 static void OP_M (int, int);
 static void OP_VEX (int, int);
+static void OP_VexR (int, int);
 static void OP_VexW (int, int);
-static void OP_EX_Vex (int, int);
-static void OP_XMM_Vex (int, int);
 static void OP_Rounding (int, int);
 static void OP_REG_VexI4 (int, int);
 static void OP_VexI4 (int, int);
@@ -394,12 +393,10 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
 #define Vex { OP_VEX, vex_mode }
 #define VexW { OP_VexW, vex_mode }
 #define VexScalar { OP_VEX, vex_scalar_mode }
+#define VexScalarR { OP_VexR, vex_scalar_mode }
 #define VexGatherQ { OP_VEX, vex_vsib_q_w_dq_mode }
 #define VexGdq { OP_VEX, dq_mode }
 #define VexTmm { OP_VEX, tmm_mode }
-#define EXdVexScalarS { OP_EX_Vex, d_scalar_swap_mode }
-#define EXqVexScalarS { OP_EX_Vex, q_scalar_swap_mode }
-#define XMVexScalar { OP_XMM_Vex, scalar_mode }
 #define XMVexI4 { OP_REG_VexI4, x_mode }
 #define XMVexScalarI4 { OP_REG_VexI4, scalar_mode }
 #define VexI4 { OP_VexI4, 0 }
@@ -574,10 +571,6 @@ enum
 
   /* scalar, ignore vector length.  */
   scalar_mode,
-  /* like d_swap_mode, ignore vector length.  */
-  d_scalar_swap_mode,
-  /* like q_swap_mode, ignore vector length.  */
-  q_scalar_swap_mode,
   /* like vex_mode, ignore vector length.  */
   vex_scalar_mode,
   /* Operand size depends on the VEX.W bit, ignore vector length.  */
@@ -2975,7 +2968,6 @@ static struct
   }
 vex;
 static unsigned char need_vex;
-static unsigned char need_vex_reg;
 
 struct op
   {
@@ -4633,17 +4625,17 @@ static const struct dis386 prefix_table[][4] = {
   /* PREFIX_VEX_0F10 */
   {
     { "vmovups",       { XM, EXx }, 0 },
-    { "vmovss",                { XMVexScalar, VexScalar, EXxmm_md }, 0 },
+    { "vmovss",                { XMScalar, VexScalarR, EXxmm_md }, 0 },
     { "vmovupd",       { XM, EXx }, 0 },
-    { "vmovsd",                { XMVexScalar, VexScalar, EXxmm_mq }, 0 },
+    { "vmovsd",                { XMScalar, VexScalarR, EXxmm_mq }, 0 },
   },
 
   /* PREFIX_VEX_0F11 */
   {
     { "vmovups",       { EXxS, XM }, 0 },
-    { "vmovss",                { EXdVexScalarS, VexScalar, XMScalar }, 0 },
+    { "vmovss",                { EXdS, VexScalarR, XMScalar }, 0 },
     { "vmovupd",       { EXxS, XM }, 0 },
-    { "vmovsd",                { EXqVexScalarS, VexScalar, XMScalar }, 0 },
+    { "vmovsd",                { EXqS, VexScalarR, XMScalar }, 0 },
   },
 
   /* PREFIX_VEX_0F12 */
@@ -9558,7 +9550,7 @@ static const struct dis386 vex_len_table[][2] = {
 
   /* VEX_LEN_0FD6_P_2 */
   {
-    { "vmovq",         { EXqVexScalarS, XMScalar }, 0 },
+    { "vmovq",         { EXqS, XMScalar }, 0 },
   },
 
   /* VEX_LEN_0FF7_P_2 */
@@ -12146,7 +12138,6 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
          break;
        }
       need_vex = 1;
-      need_vex_reg = 1;
       codep++;
       vindex = *codep++;
       dp = &xop_table[vex_table_index][vindex];
@@ -12213,7 +12204,6 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
          break;
        }
       need_vex = 1;
-      need_vex_reg = 1;
       codep++;
       vindex = *codep++;
       dp = &vex_table[vex_table_index][vindex];
@@ -12252,7 +12242,6 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
          break;
        }
       need_vex = 1;
-      need_vex_reg = 1;
       codep++;
       vindex = *codep++;
       dp = &vex_table[dp->op[1].bytemode][vindex];
@@ -12344,7 +12333,6 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
        }
 
       need_vex = 1;
-      need_vex_reg = 1;
       codep++;
       vindex = *codep++;
       dp = &evex_table[vex_table_index][vindex];
@@ -12669,7 +12657,6 @@ print_insn (bfd_vma pc, disassemble_info *info)
     }
 
   need_vex = 0;
-  need_vex_reg = 0;
   memset (&vex, 0, sizeof (vex));
 
   if (dp->name == NULL && dp->op[0].bytemode == FLOATCODE)
@@ -14068,13 +14055,11 @@ intel_operand_size (int bytemode, int sizeflag)
       used_prefixes |= (prefixes & PREFIX_DATA);
       break;
     case d_mode:
-    case d_scalar_swap_mode:
     case d_swap_mode:
     case dqd_mode:
       oappend ("DWORD PTR ");
       break;
     case q_mode:
-    case q_scalar_swap_mode:
     case q_swap_mode:
       oappend ("QWORD PTR ");
       break;
@@ -14526,7 +14511,6 @@ OP_E_memory (int bytemode, int sizeflag)
        case xmm_md_mode:
        case d_mode:
        case d_swap_mode:
-       case d_scalar_swap_mode:
              shift = 2;
              break;
            }
@@ -14586,7 +14570,6 @@ OP_E_memory (int bytemode, int sizeflag)
        case xmm_mq_mode:
        case q_mode:
        case q_swap_mode:
-       case q_scalar_swap_mode:
          shift = 3;
          break;
        case bw_unit_mode:
@@ -15860,9 +15843,7 @@ OP_EX (int bytemode, int sizeflag)
   if ((sizeflag & SUFFIX_ALWAYS)
       && (bytemode == x_swap_mode
          || bytemode == d_swap_mode
-         || bytemode == d_scalar_swap_mode
-         || bytemode == q_swap_mode
-         || bytemode == q_scalar_swap_mode))
+         || bytemode == q_swap_mode))
     swap_operand ();
 
   if (need_vex
@@ -15877,8 +15858,6 @@ OP_EX (int bytemode, int sizeflag)
       && bytemode != evex_half_bcst_xmmq_mode
       && bytemode != ymm_mode
       && bytemode != tmm_mode
-      && bytemode != d_scalar_swap_mode
-      && bytemode != q_scalar_swap_mode
       && bytemode != vex_scalar_w_dq_mode)
     {
       switch (vex.length)
@@ -16409,9 +16388,6 @@ OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
   if (!need_vex)
     abort ();
 
-  if (!need_vex_reg)
-    return;
-
   reg = vex.register_specifier;
   vex.register_specifier = 0;
   if (address_mode != mode_64bit)
@@ -16518,6 +16494,13 @@ OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
   oappend (names[reg]);
 }
 
+static void
+OP_VexR (int bytemode, int sizeflag)
+{
+  if (modrm.mod == 3)
+    OP_VEX (bytemode, sizeflag);
+}
+
 static void
 OP_VexW (int bytemode, int sizeflag)
 {
@@ -16571,22 +16554,6 @@ OP_VexI4 (int bytemode ATTRIBUTE_UNUSED,
   oappend_maybe_intel (scratchbuf);
 }
 
-static void
-OP_EX_Vex (int bytemode, int sizeflag)
-{
-  if (modrm.mod != 3)
-    need_vex_reg = 0;
-  OP_EX (bytemode, sizeflag);
-}
-
-static void
-OP_XMM_Vex (int bytemode, int sizeflag)
-{
-  if (modrm.mod != 3)
-    need_vex_reg = 0;
-  OP_XMM (bytemode, sizeflag);
-}
-
 static void
 VPCMP_Fixup (int bytemode ATTRIBUTE_UNUSED,
             int sizeflag ATTRIBUTE_UNUSED)
This page took 0.126572 seconds and 4 git commands to generate.