[04/11] x86: honor VEX.W for VCVT{PH2PS,PS2PH}

Message ID d5066437-a7b7-26fd-357e-96b367d9dc53@suse.com
State New
Headers show
Series
  • x86: disassembler size reduction and fixes
Related show

Commit Message

Jan Beulich July 3, 2020, 1:53 p.m.
Unlike for the EVEX-encoded versions, the VEX ones failed to decode
VEX.W. Once the necessary adjustments are done, it becomes obvious that
the EVEX and VEX table entries for VCVTPS2PH are identical and can hence
be folded.

opcodes/
2020-07-XX  Jan Beulich  <jbeulich@suse.com>

	* i386-dis.c (PREFIX_EVEX_0F3A1D, EVEX_W_0F3A1D_P_2): Delete.
	(VEX_W_0F3813_P_2, VEX_W_0F3A1D_P_2): New enumerators.
	(prefix_table): Reference VEX_W_0F3813_P_2 and VEX_W_0F3A1D_P_2
	respectively.
	(vex_w_table): New VEX_W_0F3813_P_2 and VEX_W_0F3A1D_P_2 table
	entries.
	* i386-dis-evex.h (evex_table): Reference VEX table entry for
	opcode 0F3A1D.
	* i386-dis-evex-prefix.h (PREFIX_EVEX_0F3A1D): Delete table
	entry.
	* i386-dis-evex-w.h (EVEX_W_0F3A1D_P_2): Likewise.

Patch

--- a/opcodes/i386-dis-evex-prefix.h
+++ b/opcodes/i386-dis-evex-prefix.h
@@ -1235,12 +1235,6 @@ 
     { Bad_Opcode },
     { VEX_W_TABLE (EVEX_W_0F3A1B_P_2) },
   },
-  /* PREFIX_EVEX_0F3A1D */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0F3A1D_P_2) },
-  },
   /* PREFIX_EVEX_0F3A1E */
   {
     { Bad_Opcode },
--- a/opcodes/i386-dis-evex-w.h
+++ b/opcodes/i386-dis-evex-w.h
@@ -738,10 +738,6 @@ 
     { EVEX_LEN_TABLE (EVEX_LEN_0F3A1B_P_2_W_0) },
     { EVEX_LEN_TABLE (EVEX_LEN_0F3A1B_P_2_W_1) },
   },
-  /* EVEX_W_0F3A1D_P_2 */
-  {
-    { "vcvtps2ph",	{ EXxmmq, XM, EXxEVexS, Ib }, 0 },
-  },
   /* EVEX_W_0F3A21_P_2 */
   {
     { "vinsertps",	{ XMM, Vex, EXxmm_md, Ib }, 0 },
--- a/opcodes/i386-dis-evex.h
+++ b/opcodes/i386-dis-evex.h
@@ -616,7 +616,7 @@  static const struct dis386 evex_table[][
     { PREFIX_TABLE (PREFIX_EVEX_0F3A1A) },
     { PREFIX_TABLE (PREFIX_EVEX_0F3A1B) },
     { Bad_Opcode },
-    { PREFIX_TABLE (PREFIX_EVEX_0F3A1D) },
+    { PREFIX_TABLE (PREFIX_VEX_0F3A1D) },
     { PREFIX_TABLE (PREFIX_EVEX_0F3A1E) },
     { PREFIX_TABLE (PREFIX_EVEX_0F3A1F) },
     /* 20 */
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -1615,7 +1615,6 @@  enum
   PREFIX_EVEX_0F3A19,
   PREFIX_EVEX_0F3A1A,
   PREFIX_EVEX_0F3A1B,
-  PREFIX_EVEX_0F3A1D,
   PREFIX_EVEX_0F3A1E,
   PREFIX_EVEX_0F3A1F,
   PREFIX_EVEX_0F3A20,
@@ -1910,6 +1909,7 @@  enum
   VEX_W_0F380D_P_2,
   VEX_W_0F380E_P_2,
   VEX_W_0F380F_P_2,
+  VEX_W_0F3813_P_2,
   VEX_W_0F3816_P_2,
   VEX_W_0F3818_P_2,
   VEX_W_0F3819_P_2,
@@ -1934,6 +1934,7 @@  enum
   VEX_W_0F3A06_P_2,
   VEX_W_0F3A18_P_2,
   VEX_W_0F3A19_P_2,
+  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,
@@ -2110,7 +2111,6 @@  enum
   EVEX_W_0F3A19_P_2,
   EVEX_W_0F3A1A_P_2,
   EVEX_W_0F3A1B_P_2,
-  EVEX_W_0F3A1D_P_2,
   EVEX_W_0F3A21_P_2,
   EVEX_W_0F3A23_P_2,
   EVEX_W_0F3A38_P_2,
@@ -5504,7 +5504,7 @@  static const struct dis386 prefix_table[
   {
     { Bad_Opcode },
     { Bad_Opcode },
-    { "vcvtph2ps", { XM, EXxmmq }, 0 },
+    { VEX_W_TABLE (VEX_W_0F3813_P_2) },
   },
 
   /* PREFIX_VEX_0F3816 */
@@ -6326,7 +6326,7 @@  static const struct dis386 prefix_table[
   {
     { Bad_Opcode },
     { Bad_Opcode },
-    { "vcvtps2ph", { EXxmmq, XM, Ib }, 0 },
+    { VEX_W_TABLE (VEX_W_0F3A1D_P_2) },
   },
 
   /* PREFIX_VEX_0F3A20 */
@@ -9903,6 +9903,10 @@  static const struct dis386 vex_w_table[]
     { "vtestpd",	{ XM, EXx }, 0 },
   },
   {
+    /* VEX_W_0F3813_P_2 */
+    { "vcvtph2ps", { XM, EXxmmq }, 0 },
+  },
+  {
     /* VEX_W_0F3816_P_2  */
     { "vpermps",	{ XM, Vex, EXx }, 0 },
   },
@@ -10001,6 +10005,10 @@  static const struct dis386 vex_w_table[]
     { "vextractf128",	{ EXxmm, XM, Ib }, 0 },
   },
   {
+    /* VEX_W_0F3A1D_P_2 */
+    { "vcvtps2ph", { EXxmmq, XM, EXxEVexS, Ib }, 0 },
+  },
+  {
     /* VEX_W_0F3A30_P_2_LEN_0 */
     { MOD_TABLE (MOD_VEX_W_0_0F3A30_P_2_LEN_0) },
     { MOD_TABLE (MOD_VEX_W_1_0F3A30_P_2_LEN_0) },