[binutils-gdb] x86/APX: drop %SW disassembler macro again

Jan Beulich jbeulich@sourceware.org
Fri Aug 30 09:24:44 GMT 2024


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

commit 5d67152772f2b6d9130cd1d3f4bfc11e45a4a9c7
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Aug 30 11:23:51 2024 +0200

    x86/APX: drop %SW disassembler macro again
    
    Not the least due to its extremely rare use I didn't really like that
    macro's introduction. Adjust swap_operand() accordingly instead.

Diff:
---
 opcodes/i386-dis-evex.h |  8 ++++----
 opcodes/i386-dis.c      | 28 +++++++++++++++-------------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/opcodes/i386-dis-evex.h b/opcodes/i386-dis-evex.h
index 434133e7621..559f0fbebde 100644
--- a/opcodes/i386-dis-evex.h
+++ b/opcodes/i386-dis-evex.h
@@ -938,10 +938,10 @@ static const struct dis386 evex_table[][256] = {
     { Bad_Opcode },
     { Bad_Opcode },
     /* 38 */
-    { "%NEccmp%SCB%DF",		{ Eb, Gb }, 0 },
-    { "%NEccmp%SCS%DF",		{ Ev, Gv }, PREFIX_NP_OR_DATA },
-    { "%NEccmp%SCB%SW%DF",	{ Gb, Eb }, 0 },
-    { "%NEccmp%SCS%SW%DF",	{ Gv, Ev }, PREFIX_NP_OR_DATA },
+    { "%NEccmp%SCB%DF",	{ Eb, Gb }, 0 },
+    { "%NEccmp%SCS%DF",	{ Ev, Gv }, PREFIX_NP_OR_DATA },
+    { "%NEccmp%SCB%DF",	{ Gb, EbS }, 0 },
+    { "%NEccmp%SCS%DF",	{ Gv, EvS }, PREFIX_NP_OR_DATA },
     { Bad_Opcode },
     { Bad_Opcode },
     { Bad_Opcode },
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 59ec771369a..05b72a42207 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -1809,8 +1809,6 @@ struct dis386 {
 	   in MAP4.
    "ZU" => print 'zu' if EVEX.ZU=1.
    "SC" => print suffix SCC for SCC insns
-   "SW" => print '.s' to indicate operands were swapped when suffix_always is
-	   true.
    "YK" keep unused, to avoid ambiguity with the combined use of Y and K.
    "YX" keep unused, to avoid ambiguity with the combined use of Y and X.
    "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand, cond
@@ -10251,9 +10249,21 @@ static const char *const scc_suffix[16] = {
 static void
 swap_operand (instr_info *ins)
 {
-  ins->mnemonicendp[0] = '.';
-  ins->mnemonicendp[1] = 's';
-  ins->mnemonicendp[2] = '\0';
+  char *p = ins->mnemonicendp;
+
+  if (p[-1] == '}')
+    {
+      while (*--p != '{')
+	{
+	  if (p <= ins->obuf + 2)
+	    abort ();
+	}
+      if (p[-1] == ' ')
+	--p;
+    }
+  memmove (p + 2, p, ins->mnemonicendp - p + 1);
+  p[0] = '.';
+  p[1] = 's';
   ins->mnemonicendp += 2;
 }
 
@@ -10929,14 +10939,6 @@ putop (instr_info *ins, const char *in_template, int sizeflag)
 		*ins->obufp++ = ins->vex.w ? 'd': 's';
 	      else if (last[0] == 'B')
 		*ins->obufp++ = ins->vex.w ? 'w': 'b';
-	      else if (last[0] == 'S')
-		{
-		  if (ins->modrm.mod == 3 && (sizeflag & SUFFIX_ALWAYS))
-		    {
-		      *ins->obufp++ = '.';
-		      *ins->obufp++ = 's';
-		    }
-		}
 	      else
 		abort ();
 	    }


More information about the Binutils-cvs mailing list