[07/11] x86: drop EVEX table entries that can be made served by VEX ones

Message ID bc3e1a4f-d63a-aa11-e2e0-dfe6d4deaaf1@suse.com
State New
Headers show
Series
  • x86: disassembler size reduction and fixes
Related show

Commit Message

Jan Beulich July 3, 2020, 1:55 p.m.
By doing the EVEX.W decode first, in various cases VEX table entries can
be re-used.

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

	* i386-dis.c (PREFIX_EVEX_0F62, PREFIX_EVEX_0F6A,
	PREFIX_EVEX_0F6B, PREFIX_EVEX_0F6C, PREFIX_EVEX_0F6D,
	PREFIX_EVEX_0FD2, PREFIX_EVEX_0FD3, PREFIX_EVEX_0FD4,
	PREFIX_EVEX_0FF2, PREFIX_EVEX_0FF3, PREFIX_EVEX_0FF4,
	PREFIX_EVEX_0FFA, PREFIX_EVEX_0FFB, PREFIX_EVEX_0FFE,
	PREFIX_EVEX_0F382B): Delete.
	(EVEX_W_0F62_P_2, EVEX_W_0F6A_P_2, EVEX_W_0F6B_P_2,
	EVEX_W_0F6C_P_2, EVEX_W_0F6D_P_2, EVEX_W_0FD2_P_2,
	EVEX_W_0FD3_P_2, EVEX_W_0FD4_P_2, EVEX_W_0FF2_P_2,
	EVEX_W_0FF3_P_2, EVEX_W_0FF4_P_2, EVEX_W_0FFA_P_2,
	EVEX_W_0FFB_P_2, EVEX_W_0FFE_P_2, EVEX_W_0F382B_P_2): Rename
	to ...
	(EVEX_W_0F62, EVEX_W_0F6A, EVEX_W_0F6B, EVEX_W_0F6C,
	EVEX_W_0F6D, EVEX_W_0FD2, EVEX_W_0FD3, EVEX_W_0FD4,
	EVEX_W_0FF2, EVEX_W_0FF3, EVEX_W_0FF4, EVEX_W_0FFA,
	EVEX_W_0FFB, EVEX_W_0FFE, EVEX_W_0F382B): ... these
	respectively.
	* i386-dis-evex.h (evex_table): Reference VEX_W table entries
	for opcodes 0F62, 0F6A, 0F6B, 0F6C, 0F6D, 0FD2, 0FD3, 0FD4,
	0FF2, 0FF3, 0FF4, 0FFA, 0FFB, 0FFE, 0F382B.
	* i386-dis-evex-prefix.h (PREFIX_EVEX_0F62, PREFIX_EVEX_0F6A,
	PREFIX_EVEX_0F6B, PREFIX_EVEX_0F6C, PREFIX_EVEX_0F6D,
	PREFIX_EVEX_0FD2, PREFIX_EVEX_0FD3, PREFIX_EVEX_0FD4,
	PREFIX_EVEX_0FF2, PREFIX_EVEX_0FF3, PREFIX_EVEX_0FF4,
	PREFIX_EVEX_0FFA, PREFIX_EVEX_0FFB, PREFIX_EVEX_0FFE,
	PREFIX_EVEX_0F382B): Remove table entries.
	* i386-dis-evex-w.h: Reference VEX table entries for opcodes
	0F62, 0F6A, 0F6B, 0F6C, 0F6D, 0FD2, 0FD3, 0FD4, 0FF2, 0FF3,
	0FF4, 0FFA, 0FFB, 0FFE, 0F382B.

Patch

--- a/opcodes/i386-dis-evex-prefix.h
+++ b/opcodes/i386-dis-evex-prefix.h
@@ -120,12 +120,6 @@ 
     { "vmaxpX",	{ XM, Vex, EXx, EXxEVexS }, PREFIX_OPCODE },
     { VEX_W_TABLE (EVEX_W_0F5F_P_3) },
   },
-  /* PREFIX_EVEX_0F62 */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0F62_P_2) },
-  },
   /* PREFIX_EVEX_0F64 */
   {
     { Bad_Opcode },
@@ -144,30 +138,6 @@ 
     { Bad_Opcode },
     { VEX_W_TABLE (EVEX_W_0F66_P_2) },
   },
-  /* PREFIX_EVEX_0F6A */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0F6A_P_2) },
-  },
-  /* PREFIX_EVEX_0F6B */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0F6B_P_2) },
-  },
-  /* PREFIX_EVEX_0F6C */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0F6C_P_2) },
-  },
-  /* PREFIX_EVEX_0F6D */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0F6D_P_2) },
-  },
   /* PREFIX_EVEX_0F6E */
   {
     { Bad_Opcode },
@@ -338,24 +308,6 @@ 
     { Bad_Opcode },
     { EVEX_LEN_TABLE (EVEX_LEN_0FC5_P_2) },
   },
-  /* PREFIX_EVEX_0FD2 */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FD2_P_2) },
-  },
-  /* PREFIX_EVEX_0FD3 */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FD3_P_2) },
-  },
-  /* PREFIX_EVEX_0FD4 */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FD4_P_2) },
-  },
   /* PREFIX_EVEX_0FD6 */
   {
     { Bad_Opcode },
@@ -405,42 +357,6 @@ 
     { Bad_Opcode },
     { "vpxor%LW",	{ XM, Vex, EXx }, 0 },
   },
-  /* PREFIX_EVEX_0FF2 */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FF2_P_2) },
-  },
-  /* PREFIX_EVEX_0FF3 */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FF3_P_2) },
-  },
-  /* PREFIX_EVEX_0FF4 */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FF4_P_2) },
-  },
-  /* PREFIX_EVEX_0FFA */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FFA_P_2) },
-  },
-  /* PREFIX_EVEX_0FFB */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FFB_P_2) },
-  },
-  /* PREFIX_EVEX_0FFE */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0FFE_P_2) },
-  },
   /* PREFIX_EVEX_0F380D */
   {
     { Bad_Opcode },
@@ -585,12 +501,6 @@ 
     { VEX_W_TABLE (EVEX_W_0F382A_P_1) },
     { VEX_W_TABLE (EVEX_W_0F382A_P_2) },
   },
-  /* PREFIX_EVEX_0F382B */
-  {
-    { Bad_Opcode },
-    { Bad_Opcode },
-    { VEX_W_TABLE (EVEX_W_0F382B_P_2) },
-  },
   /* PREFIX_EVEX_0F382C */
   {
     { Bad_Opcode },
--- a/opcodes/i386-dis-evex-w.h
+++ b/opcodes/i386-dis-evex-w.h
@@ -136,31 +136,31 @@ 
     { Bad_Opcode },
     { "vmaxsd",	{ XMScalar, VexScalar, EXxmm_mq, EXxEVexS }, 0 },
   },
-  /* EVEX_W_0F62_P_2 */
+  /* EVEX_W_0F62 */
   {
-    { "vpunpckldq",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0F62) },
   },
   /* EVEX_W_0F66_P_2 */
   {
     { "vpcmpgtd",	{ XMask, Vex, EXx }, 0 },
   },
-  /* EVEX_W_0F6A_P_2 */
+  /* EVEX_W_0F6A */
   {
-    { "vpunpckhdq",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0F6A) },
   },
-  /* EVEX_W_0F6B_P_2 */
+  /* EVEX_W_0F6B */
   {
-    { "vpackssdw",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0F6B) },
   },
-  /* EVEX_W_0F6C_P_2 */
+  /* EVEX_W_0F6C */
   {
     { Bad_Opcode },
-    { "vpunpcklqdq",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0F6C) },
   },
-  /* EVEX_W_0F6D_P_2 */
+  /* EVEX_W_0F6D */
   {
     { Bad_Opcode },
-    { "vpunpckhqdq",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0F6D) },
   },
   /* EVEX_W_0F6F_P_1 */
   {
@@ -277,19 +277,19 @@ 
     { Bad_Opcode },
     { "vcmpsd",	{ XMask, VexScalar, EXxmm_mq, EXxEVexS, VCMP }, 0 },
   },
-  /* EVEX_W_0FD2_P_2 */
+  /* EVEX_W_0FD2 */
   {
-    { "vpsrld",	{ XM, Vex, EXxmm }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FD2) },
   },
-  /* EVEX_W_0FD3_P_2 */
+  /* EVEX_W_0FD3 */
   {
     { Bad_Opcode },
-    { "vpsrlq",	{ XM, Vex, EXxmm }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FD3) },
   },
-  /* EVEX_W_0FD4_P_2 */
+  /* EVEX_W_0FD4 */
   {
     { Bad_Opcode },
-    { "vpaddq",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FD4) },
   },
   /* EVEX_W_0FD6_P_2 */
   {
@@ -315,32 +315,32 @@ 
   {
     { "vmovntdq",	{ EXEvexXNoBcst, XM }, 0 },
   },
-  /* EVEX_W_0FF2_P_2 */
+  /* EVEX_W_0FF2 */
   {
-    { "vpslld",	{ XM, Vex, EXxmm }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FF2) },
   },
-  /* EVEX_W_0FF3_P_2 */
+  /* EVEX_W_0FF3 */
   {
     { Bad_Opcode },
-    { "vpsllq",	{ XM, Vex, EXxmm }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FF3) },
   },
-  /* EVEX_W_0FF4_P_2 */
+  /* EVEX_W_0FF4 */
   {
     { Bad_Opcode },
-    { "vpmuludq",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FF4) },
   },
-  /* EVEX_W_0FFA_P_2 */
+  /* EVEX_W_0FFA */
   {
-    { "vpsubd",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FFA) },
   },
-  /* EVEX_W_0FFB_P_2 */
+  /* EVEX_W_0FFB */
   {
     { Bad_Opcode },
-    { "vpsubq",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FFB) },
   },
-  /* EVEX_W_0FFE_P_2 */
+  /* EVEX_W_0FFE */
   {
-    { "vpaddd",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0FFE) },
   },
   /* EVEX_W_0F380D_P_2 */
   {
@@ -481,9 +481,9 @@ 
   {
     { "vmovntdqa",	{ XM, EXEvexXNoBcst }, 0 },
   },
-  /* EVEX_W_0F382B_P_2 */
+  /* EVEX_W_0F382B */
   {
-    { "vpackusdw",	{ XM, Vex, EXx }, 0 },
+    { PREFIX_TABLE (PREFIX_VEX_0F382B) },
   },
   /* EVEX_W_0F3830_P_1 */
   {
--- a/opcodes/i386-dis-evex.h
+++ b/opcodes/i386-dis-evex.h
@@ -112,7 +112,7 @@  static const struct dis386 evex_table[][
     /* 60 */
     { PREFIX_TABLE (PREFIX_VEX_0F60) },
     { PREFIX_TABLE (PREFIX_VEX_0F61) },
-    { PREFIX_TABLE (PREFIX_EVEX_0F62) },
+    { VEX_W_TABLE (EVEX_W_0F62) },
     { PREFIX_TABLE (PREFIX_VEX_0F63) },
     { PREFIX_TABLE (PREFIX_EVEX_0F64) },
     { PREFIX_TABLE (PREFIX_EVEX_0F65) },
@@ -121,10 +121,10 @@  static const struct dis386 evex_table[][
     /* 68 */
     { PREFIX_TABLE (PREFIX_VEX_0F68) },
     { PREFIX_TABLE (PREFIX_VEX_0F69) },
-    { PREFIX_TABLE (PREFIX_EVEX_0F6A) },
-    { PREFIX_TABLE (PREFIX_EVEX_0F6B) },
-    { PREFIX_TABLE (PREFIX_EVEX_0F6C) },
-    { PREFIX_TABLE (PREFIX_EVEX_0F6D) },
+    { VEX_W_TABLE (EVEX_W_0F6A) },
+    { VEX_W_TABLE (EVEX_W_0F6B) },
+    { VEX_W_TABLE (EVEX_W_0F6C) },
+    { VEX_W_TABLE (EVEX_W_0F6D) },
     { PREFIX_TABLE (PREFIX_EVEX_0F6E) },
     { PREFIX_TABLE (PREFIX_EVEX_0F6F) },
     /* 70 */
@@ -238,9 +238,9 @@  static const struct dis386 evex_table[][
     /* D0 */
     { Bad_Opcode },
     { PREFIX_TABLE (PREFIX_VEX_0FD1) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FD2) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FD3) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FD4) },
+    { VEX_W_TABLE (EVEX_W_0FD2) },
+    { VEX_W_TABLE (EVEX_W_0FD3) },
+    { VEX_W_TABLE (EVEX_W_0FD4) },
     { PREFIX_TABLE (PREFIX_VEX_0FD5) },
     { PREFIX_TABLE (PREFIX_EVEX_0FD6) },
     { Bad_Opcode },
@@ -274,20 +274,20 @@  static const struct dis386 evex_table[][
     /* F0 */
     { Bad_Opcode },
     { PREFIX_TABLE (PREFIX_VEX_0FF1) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FF2) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FF3) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FF4) },
+    { VEX_W_TABLE (EVEX_W_0FF2) },
+    { VEX_W_TABLE (EVEX_W_0FF3) },
+    { VEX_W_TABLE (EVEX_W_0FF4) },
     { PREFIX_TABLE (PREFIX_VEX_0FF5) },
     { PREFIX_TABLE (PREFIX_VEX_0FF6) },
     { Bad_Opcode },
     /* F8 */
     { PREFIX_TABLE (PREFIX_VEX_0FF8) },
     { PREFIX_TABLE (PREFIX_VEX_0FF9) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FFA) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FFB) },
+    { VEX_W_TABLE (EVEX_W_0FFA) },
+    { VEX_W_TABLE (EVEX_W_0FFB) },
     { PREFIX_TABLE (PREFIX_VEX_0FFC) },
     { PREFIX_TABLE (PREFIX_VEX_0FFD) },
-    { PREFIX_TABLE (PREFIX_EVEX_0FFE) },
+    { VEX_W_TABLE (EVEX_W_0FFE) },
     { Bad_Opcode },
   },
   /* EVEX_0F38 */
@@ -341,7 +341,7 @@  static const struct dis386 evex_table[][
     { PREFIX_TABLE (PREFIX_EVEX_0F3828) },
     { PREFIX_TABLE (PREFIX_EVEX_0F3829) },
     { PREFIX_TABLE (PREFIX_EVEX_0F382A) },
-    { PREFIX_TABLE (PREFIX_EVEX_0F382B) },
+    { VEX_W_TABLE (EVEX_W_0F382B) },
     { PREFIX_TABLE (PREFIX_EVEX_0F382C) },
     { PREFIX_TABLE (PREFIX_EVEX_0F382D) },
     { Bad_Opcode },
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -1431,14 +1431,9 @@  enum
   PREFIX_EVEX_0F5D,
   PREFIX_EVEX_0F5E,
   PREFIX_EVEX_0F5F,
-  PREFIX_EVEX_0F62,
   PREFIX_EVEX_0F64,
   PREFIX_EVEX_0F65,
   PREFIX_EVEX_0F66,
-  PREFIX_EVEX_0F6A,
-  PREFIX_EVEX_0F6B,
-  PREFIX_EVEX_0F6C,
-  PREFIX_EVEX_0F6D,
   PREFIX_EVEX_0F6E,
   PREFIX_EVEX_0F6F,
   PREFIX_EVEX_0F70,
@@ -1466,9 +1461,6 @@  enum
   PREFIX_EVEX_0FC2,
   PREFIX_EVEX_0FC4,
   PREFIX_EVEX_0FC5,
-  PREFIX_EVEX_0FD2,
-  PREFIX_EVEX_0FD3,
-  PREFIX_EVEX_0FD4,
   PREFIX_EVEX_0FD6,
   PREFIX_EVEX_0FDB,
   PREFIX_EVEX_0FDF,
@@ -1477,12 +1469,6 @@  enum
   PREFIX_EVEX_0FE7,
   PREFIX_EVEX_0FEB,
   PREFIX_EVEX_0FEF,
-  PREFIX_EVEX_0FF2,
-  PREFIX_EVEX_0FF3,
-  PREFIX_EVEX_0FF4,
-  PREFIX_EVEX_0FFA,
-  PREFIX_EVEX_0FFB,
-  PREFIX_EVEX_0FFE,
   PREFIX_EVEX_0F380D,
   PREFIX_EVEX_0F3810,
   PREFIX_EVEX_0F3811,
@@ -1507,7 +1493,6 @@  enum
   PREFIX_EVEX_0F3828,
   PREFIX_EVEX_0F3829,
   PREFIX_EVEX_0F382A,
-  PREFIX_EVEX_0F382B,
   PREFIX_EVEX_0F382C,
   PREFIX_EVEX_0F382D,
   PREFIX_EVEX_0F3830,
@@ -1994,12 +1979,12 @@  enum
   EVEX_W_0F5E_P_3,
   EVEX_W_0F5F_P_1,
   EVEX_W_0F5F_P_3,
-  EVEX_W_0F62_P_2,
+  EVEX_W_0F62,
   EVEX_W_0F66_P_2,
-  EVEX_W_0F6A_P_2,
-  EVEX_W_0F6B_P_2,
-  EVEX_W_0F6C_P_2,
-  EVEX_W_0F6D_P_2,
+  EVEX_W_0F6A,
+  EVEX_W_0F6B,
+  EVEX_W_0F6C,
+  EVEX_W_0F6D,
   EVEX_W_0F6F_P_1,
   EVEX_W_0F6F_P_2,
   EVEX_W_0F6F_P_3,
@@ -2024,20 +2009,20 @@  enum
   EVEX_W_0F7F_P_3,
   EVEX_W_0FC2_P_1,
   EVEX_W_0FC2_P_3,
-  EVEX_W_0FD2_P_2,
-  EVEX_W_0FD3_P_2,
-  EVEX_W_0FD4_P_2,
+  EVEX_W_0FD2,
+  EVEX_W_0FD3,
+  EVEX_W_0FD4,
   EVEX_W_0FD6_P_2,
   EVEX_W_0FE6_P_1,
   EVEX_W_0FE6_P_2,
   EVEX_W_0FE6_P_3,
   EVEX_W_0FE7_P_2,
-  EVEX_W_0FF2_P_2,
-  EVEX_W_0FF3_P_2,
-  EVEX_W_0FF4_P_2,
-  EVEX_W_0FFA_P_2,
-  EVEX_W_0FFB_P_2,
-  EVEX_W_0FFE_P_2,
+  EVEX_W_0FF2,
+  EVEX_W_0FF3,
+  EVEX_W_0FF4,
+  EVEX_W_0FFA,
+  EVEX_W_0FFB,
+  EVEX_W_0FFE,
   EVEX_W_0F380D_P_2,
   EVEX_W_0F3810_P_1,
   EVEX_W_0F3810_P_2,
@@ -2069,7 +2054,7 @@  enum
   EVEX_W_0F3829_P_2,
   EVEX_W_0F382A_P_1,
   EVEX_W_0F382A_P_2,
-  EVEX_W_0F382B_P_2,
+  EVEX_W_0F382B,
   EVEX_W_0F3830_P_1,
   EVEX_W_0F3831_P_1,
   EVEX_W_0F3832_P_1,