x86: drop need_vex_reg
[deliverable/binutils-gdb.git] / opcodes / i386-dis.c
index 5a0282b2698d492f123b4db6c4674828cca0a163..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);
@@ -358,9 +357,8 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
 #define EMS { OP_EM, v_swap_mode }
 #define EMd { OP_EM, d_mode }
 #define EMx { OP_EM, x_mode }
-#define EXbScalar { OP_EX, b_scalar_mode }
+#define EXbwUnit { OP_EX, bw_unit_mode }
 #define EXw { OP_EX, w_mode }
-#define EXwScalar { OP_EX, w_scalar_mode }
 #define EXd { OP_EX, d_mode }
 #define EXdS { OP_EX, d_swap_mode }
 #define EXq { OP_EX, q_mode }
@@ -395,14 +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 Vex128 { OP_VEX, vex128_mode }
-#define Vex256 { OP_VEX, vex256_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 }
@@ -488,6 +482,8 @@ enum
   x_mode,
   /* Similar to x_mode, but with different EVEX mem shifts.  */
   evex_x_gscat_mode,
+  /* Similar to x_mode, but with yet different EVEX mem shifts.  */
+  bw_unit_mode,
   /* Similar to x_mode, but with disabled broadcast.  */
   evex_x_nobcst_mode,
   /* Similar to x_mode, but with operands swapped and disabled broadcast
@@ -561,10 +557,6 @@ enum
   dqd_mode,
   /* normal vex mode */
   vex_mode,
-  /* 128bit vex mode */
-  vex128_mode,
-  /* 256bit vex mode */
-  vex256_mode,
 
   /* Operand size depends on the VEX.W bit, with VSIB dword indices.  */
   vex_vsib_d_w_dq_mode,
@@ -579,14 +571,6 @@ enum
 
   /* scalar, ignore vector length.  */
   scalar_mode,
-  /* like b_mode, ignore vector length.  */
-  b_scalar_mode,
-  /* like w_mode, ignore vector length.  */
-  w_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.  */
@@ -1976,7 +1960,7 @@ enum
   VEX_W_0F3816_P_2,
   VEX_W_0F3818_P_2,
   VEX_W_0F3819_P_2,
-  VEX_W_0F381A_P_2_M_0,
+  VEX_W_0F381A_P_2_M_0_L_0,
   VEX_W_0F382C_P_2_M_0,
   VEX_W_0F382D_P_2_M_0,
   VEX_W_0F382E_P_2_M_0,
@@ -1991,7 +1975,7 @@ enum
   VEX_W_0F384B_X86_64_P_3,
   VEX_W_0F3858_P_2,
   VEX_W_0F3859_P_2,
-  VEX_W_0F385A_P_2_M_0,
+  VEX_W_0F385A_P_2_M_0_L_0,
   VEX_W_0F385C_X86_64_P_1,
   VEX_W_0F385E_X86_64_P_0,
   VEX_W_0F385E_X86_64_P_1,
@@ -2005,17 +1989,17 @@ enum
   VEX_W_0F3A02_P_2,
   VEX_W_0F3A04_P_2,
   VEX_W_0F3A05_P_2,
-  VEX_W_0F3A06_P_2,
-  VEX_W_0F3A18_P_2,
-  VEX_W_0F3A19_P_2,
+  VEX_W_0F3A06_P_2_L_0,
+  VEX_W_0F3A18_P_2_L_0,
+  VEX_W_0F3A19_P_2_L_0,
   VEX_W_0F3A1D_P_2,
   VEX_W_0F3A30_P_2_LEN_0,
   VEX_W_0F3A31_P_2_LEN_0,
   VEX_W_0F3A32_P_2_LEN_0,
   VEX_W_0F3A33_P_2_LEN_0,
-  VEX_W_0F3A38_P_2,
-  VEX_W_0F3A39_P_2,
-  VEX_W_0F3A46_P_2,
+  VEX_W_0F3A38_P_2_L_0,
+  VEX_W_0F3A39_P_2_L_0,
+  VEX_W_0F3A46_P_2_L_0,
   VEX_W_0F3A4A_P_2,
   VEX_W_0F3A4B_P_2,
   VEX_W_0F3A4C_P_2,
@@ -2183,8 +2167,6 @@ enum
   EVEX_W_0F3859_P_2,
   EVEX_W_0F385A_P_2,
   EVEX_W_0F385B_P_2,
-  EVEX_W_0F3862_P_2,
-  EVEX_W_0F3863_P_2,
   EVEX_W_0F3870_P_2,
   EVEX_W_0F3872_P_1,
   EVEX_W_0F3872_P_2,
@@ -2292,7 +2274,7 @@ struct dis386 {
    "LB" => print "abs" in 64bit mode and behave as 'B' otherwise
    "LS" => print "abs" in 64bit mode and behave as 'S' otherwise
    "LV" => print "abs" for 64bit operand and behave as 'S' otherwise
-   "LW" => print 'd', 'q' depending on the VEX.W bit
+   "DQ" => print 'd' or 'q' depending on the VEX.W bit
    "BW" => print 'b' or 'w' depending on the EVEX.W bit
    "LP" => print 'w' or 'l' ('d' in Intel mode) if instruction has
           an operand size prefix, or suffix_always is true.  print
@@ -2986,7 +2968,6 @@ static struct
   }
 vex;
 static unsigned char need_vex;
-static unsigned char need_vex_reg;
 
 struct op
   {
@@ -4644,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 */
@@ -5896,7 +5877,7 @@ static const struct dis386 prefix_table[][4] = {
   {
     { Bad_Opcode },
     { Bad_Opcode },
-    { "vpsrlv%LW", { XM, Vex, EXx }, 0 },
+    { "vpsrlv%DQ", { XM, Vex, EXx }, 0 },
   },
 
   /* PREFIX_VEX_0F3846 */
@@ -5910,7 +5891,7 @@ static const struct dis386 prefix_table[][4] = {
   {
     { Bad_Opcode },
     { Bad_Opcode },
-    { "vpsllv%LW", { XM, Vex, EXx }, 0 },
+    { "vpsllv%DQ", { XM, Vex, EXx }, 0 },
   },
 
   /* PREFIX_VEX_0F3849_X86_64 */
@@ -5997,14 +5978,14 @@ static const struct dis386 prefix_table[][4] = {
   {
     { Bad_Opcode },
     { Bad_Opcode },
-    { "vpgatherd%LW", { XM, MVexVSIBDWpX, Vex }, 0 },
+    { "vpgatherd%DQ", { XM, MVexVSIBDWpX, Vex }, 0 },
   },
 
   /* PREFIX_VEX_0F3891 */
   {
     { Bad_Opcode },
     { Bad_Opcode },
-    { "vpgatherq%LW", { XMGatherQ, MVexVSIBQWpX, VexGatherQ }, 0 },
+    { "vpgatherq%DQ", { XMGatherQ, MVexVSIBQWpX, VexGatherQ }, 0 },
   },
 
   /* PREFIX_VEX_0F3892 */
@@ -9349,12 +9330,12 @@ static const struct dis386 vex_table[][256] = {
 static const struct dis386 vex_len_table[][2] = {
   /* VEX_LEN_0F12_P_0_M_0 / VEX_LEN_0F12_P_2_M_0 */
   {
-    { "vmovlpX",       { XM, Vex128, EXq }, 0 },
+    { "vmovlpX",       { XM, Vex, EXq }, 0 },
   },
 
   /* VEX_LEN_0F12_P_0_M_1 */
   {
-    { "vmovhlps",      { XM, Vex128, EXq }, 0 },
+    { "vmovhlps",      { XM, Vex, EXq }, 0 },
   },
 
   /* VEX_LEN_0F13_M_0 */
@@ -9364,12 +9345,12 @@ static const struct dis386 vex_len_table[][2] = {
 
   /* VEX_LEN_0F16_P_0_M_0 / VEX_LEN_0F16_P_2_M_0 */
   {
-    { "vmovhpX",       { XM, Vex128, EXq }, 0 },
+    { "vmovhpX",       { XM, Vex, EXq }, 0 },
   },
 
   /* VEX_LEN_0F16_P_0_M_1 */
   {
-    { "vmovlhps",      { XM, Vex128, EXq }, 0 },
+    { "vmovlhps",      { XM, Vex, EXq }, 0 },
   },
 
   /* VEX_LEN_0F17_M_0 */
@@ -9559,7 +9540,7 @@ static const struct dis386 vex_len_table[][2] = {
 
   /* VEX_LEN_0FC4_P_2 */
   {
-    { "vpinsrw",       { XM, Vex128, Edqw, Ib }, 0 },
+    { "vpinsrw",       { XM, Vex, Edqw, Ib }, 0 },
   },
 
   /* VEX_LEN_0FC5_P_2 */
@@ -9569,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 */
@@ -9592,7 +9573,7 @@ static const struct dis386 vex_len_table[][2] = {
   /* VEX_LEN_0F381A_P_2_M_0 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F381A_P_2_M_0) },
+    { VEX_W_TABLE (VEX_W_0F381A_P_2_M_0_L_0) },
   },
 
   /* VEX_LEN_0F3836_P_2 */
@@ -9643,7 +9624,7 @@ static const struct dis386 vex_len_table[][2] = {
   /* VEX_LEN_0F385A_P_2_M_0 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F385A_P_2_M_0) },
+    { VEX_W_TABLE (VEX_W_0F385A_P_2_M_0_L_0) },
   },
 
   /* VEX_LEN_0F385C_X86_64_P_1_W_0_M_0 */
@@ -9751,7 +9732,7 @@ static const struct dis386 vex_len_table[][2] = {
   /* VEX_LEN_0F3A06_P_2 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F3A06_P_2) },
+    { VEX_W_TABLE (VEX_W_0F3A06_P_2_L_0) },
   },
 
   /* VEX_LEN_0F3A14_P_2 */
@@ -9777,28 +9758,28 @@ static const struct dis386 vex_len_table[][2] = {
   /* VEX_LEN_0F3A18_P_2 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F3A18_P_2) },
+    { VEX_W_TABLE (VEX_W_0F3A18_P_2_L_0) },
   },
 
   /* VEX_LEN_0F3A19_P_2 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F3A19_P_2) },
+    { VEX_W_TABLE (VEX_W_0F3A19_P_2_L_0) },
   },
 
   /* VEX_LEN_0F3A20_P_2 */
   {
-    { "vpinsrb",       { XM, Vex128, Edqb, Ib }, 0 },
+    { "vpinsrb",       { XM, Vex, Edqb, Ib }, 0 },
   },
 
   /* VEX_LEN_0F3A21_P_2 */
   {
-    { "vinsertps",     { XM, Vex128, EXd, Ib }, 0 },
+    { "vinsertps",     { XM, Vex, EXd, Ib }, 0 },
   },
 
   /* VEX_LEN_0F3A22_P_2 */
   {
-    { "vpinsrK",       { XM, Vex128, Edq, Ib }, 0 },
+    { "vpinsrK",       { XM, Vex, Edq, Ib }, 0 },
   },
 
   /* VEX_LEN_0F3A30_P_2 */
@@ -9824,24 +9805,24 @@ static const struct dis386 vex_len_table[][2] = {
   /* VEX_LEN_0F3A38_P_2 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F3A38_P_2) },
+    { VEX_W_TABLE (VEX_W_0F3A38_P_2_L_0) },
   },
 
   /* VEX_LEN_0F3A39_P_2 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F3A39_P_2) },
+    { VEX_W_TABLE (VEX_W_0F3A39_P_2_L_0) },
   },
 
   /* VEX_LEN_0F3A41_P_2 */
   {
-    { "vdppd",         { XM, Vex128, EXx, Ib }, 0 },
+    { "vdppd",         { XM, Vex, EXx, Ib }, 0 },
   },
 
   /* VEX_LEN_0F3A46_P_2 */
   {
     { Bad_Opcode },
-    { VEX_W_TABLE (VEX_W_0F3A46_P_2) },
+    { VEX_W_TABLE (VEX_W_0F3A46_P_2_L_0) },
   },
 
   /* VEX_LEN_0F3A60_P_2 */
@@ -10336,7 +10317,7 @@ static const struct dis386 vex_w_table[][2] = {
     { "vbroadcastsd",  { XM, EXxmm_mq }, 0 },
   },
   {
-    /* VEX_W_0F381A_P_2_M_0 */
+    /* VEX_W_0F381A_P_2_M_0_L_0 */
     { "vbroadcastf128",        { XM, Mxmm }, 0 },
   },
   {
@@ -10396,7 +10377,7 @@ static const struct dis386 vex_w_table[][2] = {
     { "vpbroadcastq",  { XM, EXxmm_mq }, 0 },
   },
   {
-    /* VEX_W_0F385A_P_2_M_0 */
+    /* VEX_W_0F385A_P_2_M_0_L_0 */
     { "vbroadcasti128", { XM, Mxmm }, 0 },
   },
   {
@@ -10454,15 +10435,15 @@ static const struct dis386 vex_w_table[][2] = {
     { "vpermilpd",     { XM, EXx, Ib }, 0 },
   },
   {
-    /* VEX_W_0F3A06_P_2 */
-    { "vperm2f128",    { XM, Vex256, EXx, Ib }, 0 },
+    /* VEX_W_0F3A06_P_2_L_0 */
+    { "vperm2f128",    { XM, Vex, EXx, Ib }, 0 },
   },
   {
-    /* VEX_W_0F3A18_P_2 */
-    { "vinsertf128",   { XM, Vex256, EXxmm, Ib }, 0 },
+    /* VEX_W_0F3A18_P_2_L_0 */
+    { "vinsertf128",   { XM, Vex, EXxmm, Ib }, 0 },
   },
   {
-    /* VEX_W_0F3A19_P_2 */
+    /* VEX_W_0F3A19_P_2_L_0 */
     { "vextractf128",  { EXxmm, XM, Ib }, 0 },
   },
   {
@@ -10490,16 +10471,16 @@ static const struct dis386 vex_w_table[][2] = {
     { MOD_TABLE (MOD_VEX_W_1_0F3A33_P_2_LEN_0) },
   },
   {
-    /* VEX_W_0F3A38_P_2 */
-    { "vinserti128",   { XM, Vex256, EXxmm, Ib }, 0 },
+    /* VEX_W_0F3A38_P_2_L_0 */
+    { "vinserti128",   { XM, Vex, EXxmm, Ib }, 0 },
   },
   {
-    /* VEX_W_0F3A39_P_2 */
+    /* VEX_W_0F3A39_P_2_L_0 */
     { "vextracti128",  { EXxmm, XM, Ib }, 0 },
   },
   {
-    /* VEX_W_0F3A46_P_2 */
-    { "vperm2i128",    { XM, Vex256, EXx, Ib }, 0 },
+    /* VEX_W_0F3A46_P_2_L_0 */
+    { "vperm2i128",    { XM, Vex, EXx, Ib }, 0 },
   },
   {
     /* VEX_W_0F3A4A_P_2 */
@@ -10589,35 +10570,35 @@ static const struct dis386 vex_w_table[][2] = {
   },
   /* VEX_W_0FXOP_08_CC_L_0 */
   {
-     { "vpcomb",       { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomb",       { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_08_CD_L_0 */
   {
-     { "vpcomw",       { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomw",       { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_08_CE_L_0 */
   {
-     { "vpcomd",       { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomd",       { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_08_CF_L_0 */
   {
-     { "vpcomq",       { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomq",       { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_08_EC_L_0 */
   {
-     { "vpcomub",      { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomub",      { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_08_ED_L_0 */
   {
-     { "vpcomuw",      { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomuw",      { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_08_EE_L_0 */
   {
-     { "vpcomud",      { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomud",      { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_08_EF_L_0 */
   {
-     { "vpcomuq",      { XM, Vex128, EXx, VPCOM }, 0 },
+     { "vpcomuq",      { XM, Vex, EXx, VPCOM }, 0 },
   },
   /* VEX_W_0FXOP_09_80 */
   {
@@ -11482,11 +11463,11 @@ static const struct dis386 mod_table[][2] = {
   },
   {
     /* MOD_VEX_0F388C_PREFIX_2 */
-    { "vpmaskmov%LW",  { XM, Vex, Mx }, 0 },
+    { "vpmaskmov%DQ",  { XM, Vex, Mx }, 0 },
   },
   {
     /* MOD_VEX_0F388E_PREFIX_2 */
-    { "vpmaskmov%LW",  { Mx, Vex, XM }, 0 },
+    { "vpmaskmov%DQ",  { Mx, Vex, XM }, 0 },
   },
   {
     /* MOD_VEX_W_0_0F3A30_P_2_LEN_0 */
@@ -12157,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];
@@ -12224,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];
@@ -12263,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];
@@ -12355,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];
@@ -12680,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)
@@ -13641,6 +13617,8 @@ putop (const char *in_template, int sizeflag)
                    }
                }
            }
+         else if (l == 1 && last[0] == 'D')
+           *obufp++ = vex.w ? 'q' : 'd';
          else if (l == 1 && last[0] == 'L')
            {
              if (cond ? modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS)
@@ -13801,8 +13779,6 @@ putop (const char *in_template, int sizeflag)
                abort ();
              if (last[0] == 'X')
                *obufp++ = vex.w ? 'd': 's';
-             else if (last[0] == 'L')
-               *obufp++ = vex.w ? 'q': 'd';
              else if (last[0] == 'B')
                *obufp++ = vex.w ? 'w': 'b';
              else
@@ -14079,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;
@@ -14109,8 +14083,7 @@ intel_operand_size (int bytemode, int sizeflag)
     case x_swap_mode:
     case evex_x_gscat_mode:
     case evex_x_nobcst_mode:
-    case b_scalar_mode:
-    case w_scalar_mode:
+    case bw_unit_mode:
       if (need_vex)
        {
          switch (vex.length)
@@ -14523,15 +14496,21 @@ OP_E_memory (int bytemode, int sizeflag)
        {
        case dqw_mode:
        case dw_mode:
+       case xmm_mw_mode:
          shift = 1;
          break;
        case dqb_mode:
        case db_mode:
+       case xmm_mb_mode:
          shift = 0;
          break;
        case dq_mode:
          if (address_mode != mode_64bit)
            {
+       case dqd_mode:
+       case xmm_md_mode:
+       case d_mode:
+       case d_swap_mode:
              shift = 2;
              break;
            }
@@ -14572,6 +14551,15 @@ OP_E_memory (int bytemode, int sizeflag)
            default:
              abort ();
            }
+         /* Make necessary corrections to shift for modes that need it.  */
+         if (bytemode == xmmq_mode
+             || bytemode == evex_half_bcst_xmmq_mode
+             || (bytemode == ymmq_mode && vex.length == 128))
+           shift -= 1;
+         else if (bytemode == xmmqd_mode)
+           shift -= 2;
+         else if (bytemode == xmmdw_mode)
+           shift -= 3;
          break;
        case ymm_mode:
          shift = 5;
@@ -14582,43 +14570,14 @@ 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 dqd_mode:
-       case xmm_md_mode:
-       case d_mode:
-       case d_swap_mode:
-       case d_scalar_swap_mode:
-         shift = 2;
-         break;
-       case w_scalar_mode:
-       case xmm_mw_mode:
-         shift = 1;
-         break;
-       case b_scalar_mode:
-       case xmm_mb_mode:
-         shift = 0;
+       case bw_unit_mode:
+         shift = vex.w ? 1 : 0;
          break;
        default:
          abort ();
        }
-      /* Make necessary corrections to shift for modes that need it.
-        For these modes we currently have shift 4, 5 or 6 depending on
-        vex.length (it corresponds to xmmword, ymmword or zmmword
-        operand).  We might want to make it 3, 4 or 5 (e.g. for
-        xmmq_mode).  In case of broadcast enabled the corrections
-        aren't needed, as element size is always 32 or 64 bits.  */
-      if (!vex.b
-         && (bytemode == xmmq_mode
-             || bytemode == evex_half_bcst_xmmq_mode))
-       shift -= 1;
-      else if (bytemode == xmmqd_mode)
-       shift -= 2;
-      else if (bytemode == xmmdw_mode)
-       shift -= 3;
-      else if (bytemode == ymmq_mode && vex.length == 128)
-       shift -= 1;
     }
   else
     shift = 0;
@@ -15884,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
@@ -15901,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)
@@ -16433,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)
@@ -16483,7 +16435,6 @@ OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
       switch (bytemode)
        {
        case vex_mode:
-       case vex128_mode:
        case vex_vsib_q_w_dq_mode:
        case vex_vsib_q_w_d_mode:
          names = names_xmm;
@@ -16512,7 +16463,6 @@ OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
       switch (bytemode)
        {
        case vex_mode:
-       case vex256_mode:
          names = names_ymm;
          break;
        case vex_vsib_q_w_dq_mode:
@@ -16544,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)
 {
@@ -16597,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.033588 seconds and 4 git commands to generate.