public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] x86: {,V}MOVNT* don't need to go through mod_table[]
@ 2023-07-11  6:20 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2023-07-11  6:20 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7be4d0e3f011474421b31ce610cb38f6ca61db17

commit 7be4d0e3f011474421b31ce610cb38f6ca61db17
Author: Jan Beulich <jbeulich@suse.com>
Date:   Tue Jul 11 08:17:22 2023 +0200

    x86: {,V}MOVNT* don't need to go through mod_table[]
    
    Most of them use Mx already for the memory operand, which rejects the
    register form of the insn. Use that operand type also for the two EVEX
    forms which so far have used EXEvexXNoBcst (and thus failed to reject
    the register forms), compensating by flagging broadcast as bad for all
    Mx. This way several other insns which don't permit embedded broadcast
    either are also covered at the same time.

Diff:
---
 opcodes/i386-dis-evex-w.h |  4 +--
 opcodes/i386-dis-evex.h   |  2 +-
 opcodes/i386-dis.c        | 76 ++++++++++-------------------------------------
 3 files changed, 18 insertions(+), 64 deletions(-)

diff --git a/opcodes/i386-dis-evex-w.h b/opcodes/i386-dis-evex-w.h
index 5a0352eba43..d6904f027e4 100644
--- a/opcodes/i386-dis-evex-w.h
+++ b/opcodes/i386-dis-evex-w.h
@@ -156,7 +156,7 @@
   },
   /* EVEX_W_0FE7 */
   {
-    { "%XEvmovntdq",	{ EXEvexXNoBcst, XM }, PREFIX_DATA },
+    { "%XEvmovntdq",	{ Mx, XM }, PREFIX_DATA },
   },
   /* EVEX_W_0FF2 */
   {
@@ -293,7 +293,7 @@
   },
   /* EVEX_W_0F382A_P_2 */
   {
-    { "%XEvmovntdqaY",	{ XM, EXEvexXNoBcst }, 0 },
+    { "%XEvmovntdqaY",	{ XM, Mx }, 0 },
   },
   /* EVEX_W_0F382B */
   {
diff --git a/opcodes/i386-dis-evex.h b/opcodes/i386-dis-evex.h
index 93bb3222e12..77848f364d8 100644
--- a/opcodes/i386-dis-evex.h
+++ b/opcodes/i386-dis-evex.h
@@ -50,7 +50,7 @@ static const struct dis386 evex_table[][256] = {
     { "%XEvmovapX",	{ XM, EXx }, PREFIX_OPCODE },
     { "%XEvmovapX",	{ EXxS, XM }, PREFIX_OPCODE },
     { PREFIX_TABLE (PREFIX_VEX_0F2A) },
-    { MOD_TABLE (MOD_VEX_0F2B) },
+    { "%XEvmovntpX",	{ Mx, XM }, PREFIX_OPCODE },
     { PREFIX_TABLE (PREFIX_VEX_0F2C) },
     { PREFIX_TABLE (PREFIX_VEX_0F2D) },
     { PREFIX_TABLE (PREFIX_0F2E) },
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index acc8152ea53..ba0fded0c42 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -889,10 +889,6 @@ enum
   MOD_0F1B_PREFIX_1,
   MOD_0F1C_PREFIX_0,
   MOD_0F1E_PREFIX_1,
-  MOD_0F2B_PREFIX_0,
-  MOD_0F2B_PREFIX_1,
-  MOD_0F2B_PREFIX_2,
-  MOD_0F2B_PREFIX_3,
   MOD_0F50,
   MOD_0F71,
   MOD_0F72,
@@ -908,15 +904,12 @@ enum
   MOD_0FB2,
   MOD_0FB4,
   MOD_0FB5,
-  MOD_0FC3,
   MOD_0FC7_REG_3,
   MOD_0FC7_REG_4,
   MOD_0FC7_REG_5,
   MOD_0FC7_REG_6,
   MOD_0FC7_REG_7,
   MOD_0FD7,
-  MOD_0FE7_PREFIX_2,
-  MOD_0F382A,
   MOD_0F38DC_PREFIX_1,
   MOD_0F38DD_PREFIX_1,
   MOD_0F38DE_PREFIX_1,
@@ -931,7 +924,6 @@ enum
   MOD_0F38FB_PREFIX_1,
   MOD_0F3A0F_PREFIX_1,
 
-  MOD_VEX_0F2B,
   MOD_VEX_0F41_L_1,
   MOD_VEX_0F42_L_1,
   MOD_VEX_0F44_L_0,
@@ -951,9 +943,7 @@ enum
   MOD_VEX_0FAE_REG_2,
   MOD_VEX_0FAE_REG_3,
   MOD_VEX_0FD7,
-  MOD_VEX_0FE7,
   MOD_VEX_0F381A,
-  MOD_VEX_0F382A,
   MOD_VEX_0F382C,
   MOD_VEX_0F382D,
   MOD_VEX_0F382E,
@@ -2328,7 +2318,7 @@ static const struct dis386 dis386_twobyte[] = {
   { "xaddB",		{ Ebh1, Gb }, 0 },
   { "xaddS",		{ Evh1, Gv }, 0 },
   { PREFIX_TABLE (PREFIX_0FC2) },
-  { MOD_TABLE (MOD_0FC3) },
+  { "movntiS",		{ Mdq, Gdq }, PREFIX_OPCODE },
   { "pinsrw",		{ MX, Edw, Ib }, PREFIX_OPCODE },
   { "pextrw",		{ Gd, MS, Ib }, PREFIX_OPCODE },
   { "shufpX",		{ XM, EXx, Ib }, PREFIX_OPCODE },
@@ -3204,10 +3194,10 @@ static const struct dis386 prefix_table[][4] = {
 
   /* PREFIX_0F2B */
   {
-    { MOD_TABLE (MOD_0F2B_PREFIX_0) },
-    { MOD_TABLE (MOD_0F2B_PREFIX_1) },
-    { MOD_TABLE (MOD_0F2B_PREFIX_2) },
-    { MOD_TABLE (MOD_0F2B_PREFIX_3) },
+    { "movntps", { Mx, XM }, 0 },
+    { "movntss", { Md, XM }, 0 },
+    { "movntpd", { Mx, XM }, 0 },
+    { "movntsd", { Mq, XM }, 0 },
   },
 
   /* PREFIX_0F2C */
@@ -3544,9 +3534,9 @@ static const struct dis386 prefix_table[][4] = {
 
   /* PREFIX_0FE7 */
   {
-    { "movntq",	{ Mq, MX }, PREFIX_OPCODE },
+    { "movntq",		{ Mq, MX }, 0 },
     { Bad_Opcode },
-    { MOD_TABLE (MOD_0FE7_PREFIX_2) },
+    { "movntdq",	{ Mx, XM }, 0 },
   },
 
   /* PREFIX_0FF0 */
@@ -4522,7 +4512,7 @@ static const struct dis386 three_byte_table[][256] = {
     /* 28 */
     { "pmuldq", { XM, EXx }, PREFIX_DATA },
     { "pcmpeqq", { XM, EXx }, PREFIX_DATA },
-    { MOD_TABLE (MOD_0F382A) },
+    { "movntdqa", { XM, Mx }, PREFIX_DATA },
     { "packusdw", { XM, EXx }, PREFIX_DATA },
     { Bad_Opcode },
     { Bad_Opcode },
@@ -5984,7 +5974,7 @@ static const struct dis386 vex_table[][256] = {
     { "vmovapX",	{ XM, EXx }, PREFIX_OPCODE },
     { "vmovapX",	{ EXxS, XM }, PREFIX_OPCODE },
     { PREFIX_TABLE (PREFIX_VEX_0F2A) },
-    { MOD_TABLE (MOD_VEX_0F2B) },
+    { "vmovntpX",	{ Mx, XM }, PREFIX_OPCODE },
     { PREFIX_TABLE (PREFIX_VEX_0F2C) },
     { PREFIX_TABLE (PREFIX_VEX_0F2D) },
     { PREFIX_TABLE (PREFIX_0F2E) },
@@ -6195,7 +6185,7 @@ static const struct dis386 vex_table[][256] = {
     { "vpmulhuw",	{ XM, Vex, EXx }, PREFIX_DATA },
     { "vpmulhw",	{ XM, Vex, EXx }, PREFIX_DATA },
     { PREFIX_TABLE (PREFIX_0FE6) },
-    { MOD_TABLE (MOD_VEX_0FE7) },
+    { "vmovntdq",	{ Mx, XM }, PREFIX_DATA },
     /* e8 */
     { "vpsubsb",	{ XM, Vex, EXx }, PREFIX_DATA },
     { "vpsubsw",	{ XM, Vex, EXx }, PREFIX_DATA },
@@ -6274,7 +6264,7 @@ static const struct dis386 vex_table[][256] = {
     /* 28 */
     { "vpmuldq",	{ XM, Vex, EXx }, PREFIX_DATA },
     { "vpcmpeqq",	{ XM, Vex, EXx }, PREFIX_DATA },
-    { MOD_TABLE (MOD_VEX_0F382A) },
+    { "vmovntdqa",	{ XM, Mx }, PREFIX_DATA },
     { "vpackusdw",	{ XM, Vex, EXx }, PREFIX_DATA },
     { MOD_TABLE (MOD_VEX_0F382C) },
     { MOD_TABLE (MOD_VEX_0F382D) },
@@ -8110,22 +8100,6 @@ static const struct dis386 mod_table[][2] = {
     { "nopQ",		{ Ev }, PREFIX_IGNORED },
     { REG_TABLE (REG_0F1E_P_1_MOD_3) },
   },
-  {
-    /* MOD_0F2B_PREFIX_0 */
-    {"movntps",		{ Mx, XM }, PREFIX_OPCODE },
-  },
-  {
-    /* MOD_0F2B_PREFIX_1 */
-    {"movntss",		{ Md, XM }, PREFIX_OPCODE },
-  },
-  {
-    /* MOD_0F2B_PREFIX_2 */
-    {"movntpd",		{ Mx, XM }, PREFIX_OPCODE },
-  },
-  {
-    /* MOD_0F2B_PREFIX_3 */
-    {"movntsd",		{ Mq, XM }, PREFIX_OPCODE },
-  },
   {
     /* MOD_0F50 */
     { Bad_Opcode },
@@ -8198,10 +8172,6 @@ static const struct dis386 mod_table[][2] = {
     /* MOD_0FB5 */
     { "lgsS",		{ Gv, Mp }, 0 },
   },
-  {
-    /* MOD_0FC3 */
-    { "movntiS", { Edq, Gdq }, PREFIX_OPCODE },
-  },
   {
     /* MOD_0FC7_REG_3 */
     { "xrstors",	{ FXSAVE }, 0 },
@@ -8229,14 +8199,6 @@ static const struct dis386 mod_table[][2] = {
     { Bad_Opcode },
     { "pmovmskb",	{ Gdq, MS }, 0 },
   },
-  {
-    /* MOD_0FE7_PREFIX_2 */
-    { "movntdq",	{ Mx, XM }, 0 },
-  },
-  {
-    /* MOD_0F382A */
-    { "movntdqa",	{ XM, Mx }, PREFIX_DATA },
-  },
   {
     /* MOD_0F38DC_PREFIX_1 */
     { "aesenc128kl",    { XM, M }, 0 },
@@ -8293,10 +8255,6 @@ static const struct dis386 mod_table[][2] = {
     { Bad_Opcode },
     { REG_TABLE (REG_0F3A0F_PREFIX_1_MOD_3) },
   },
-  {
-    /* MOD_VEX_0F2B */
-    { "%XEvmovntpX",	{ Mx, XM }, PREFIX_OPCODE },
-  },
   {
     /* MOD_VEX_0F41_L_1 */
     { Bad_Opcode },
@@ -8389,18 +8347,10 @@ static const struct dis386 mod_table[][2] = {
     { Bad_Opcode },
     { "vpmovmskb",	{ Gdq, XS }, PREFIX_DATA },
   },
-  {
-    /* MOD_VEX_0FE7 */
-    { "vmovntdq",	{ Mx, XM }, PREFIX_DATA },
-  },
   {
     /* MOD_VEX_0F381A */
     { VEX_LEN_TABLE (VEX_LEN_0F381A_M_0) },
   },
-  {
-    /* MOD_VEX_0F382A */
-    { "vmovntdqa",	{ XM, Mx }, PREFIX_DATA },
-  },
   {
     /* MOD_VEX_0F382C */
     { VEX_W_TABLE (VEX_W_0F382C_M_0) },
@@ -12952,6 +12902,10 @@ OP_M (instr_info *ins, int bytemode, int sizeflag)
   if (ins->modrm.mod == 3)
     /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
     return BadOp (ins);
+
+  if (bytemode == x_mode)
+    ins->vex.no_broadcast = true;
+
   return OP_E_memory (ins, bytemode, sizeflag);
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-11  6:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11  6:20 [binutils-gdb] x86: {,V}MOVNT* don't need to go through mod_table[] Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).