[2/2] x86: fold assembly dialect attributes

Message ID bbcd1c7d-05bd-4fb0-b152-9beb15c03075@suse.com
State Unresolved
Headers
Series x86: assembly dialect tidying |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Jan Beulich Dec. 1, 2023, 1:31 p.m. UTC
  Now that ATTSyntax and ATTMnemonic aren't use in combination anymore,
fold them and IntelSyntax into a single, enum-like attribute. Note that
this shrinks i386_opcode_modifier back to 2 32-bit words (albeit that's
not for long, seeing in-flight additions for APX).
  

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7052,14 +7052,15 @@  match_template (char mnem_suffix)
 
       /* Check AT&T mnemonic.   */
       specific_error = progress (unsupported_with_intel_mnemonic);
-      if (!intel_syntax && intel_mnemonic && t->opcode_modifier.attmnemonic)
+      if (!intel_syntax && intel_mnemonic
+	  && t->opcode_modifier.dialect == ATT_MNEMONIC)
 	continue;
 
       /* Check AT&T/Intel syntax.  */
       specific_error = progress (unsupported_syntax);
       if (intel_syntax
-	   ? t->opcode_modifier.attsyntax || t->opcode_modifier.attmnemonic
-	   : t->opcode_modifier.intelsyntax)
+	   ? t->opcode_modifier.dialect >= ATT_SYNTAX
+	   : t->opcode_modifier.dialect == INTEL_SYNTAX)
 	continue;
 
       /* Check Intel64/AMD64 ISA.   */
--- a/gas/config/tc-i386-intel.c
+++ b/gas/config/tc-i386-intel.c
@@ -825,8 +825,7 @@  i386_intel_operand (char *operand_string
 
 	      /* Easy checks to skip templates which won't match anyway.  */
 	      if (this_operand >= t->operands
-		  || t->opcode_modifier.attsyntax
-		  || t->opcode_modifier.attmnemonic)
+		  || t->opcode_modifier.dialect >= ATT_SYNTAX)
 		continue;
 
 	      switch (suffix)
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -482,9 +482,7 @@  static bitfield opcode_modifiers[] =
   BITFIELD (Disp8MemShift),
   BITFIELD (Vsz),
   BITFIELD (Optimize),
-  BITFIELD (ATTMnemonic),
-  BITFIELD (ATTSyntax),
-  BITFIELD (IntelSyntax),
+  BITFIELD (Dialect),
   BITFIELD (ISA64),
 };
 
--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -729,12 +729,12 @@  enum
   /* Support encoding optimization.  */
   Optimize,
 
-  /* AT&T mnemonic.  */
-  ATTMnemonic,
-  /* AT&T syntax.  */
-  ATTSyntax,
-  /* Intel syntax.  */
-  IntelSyntax,
+  /* Language dialect.  NOTE: Order matters!  */
+#define INTEL_SYNTAX 1
+#define ATT_SYNTAX   2
+#define ATT_MNEMONIC 3
+  Dialect,
+
   /* ISA64: Don't change the order without other code adjustments.
 	0: Common to AMD64 and Intel64.
 	1: AMD64.
@@ -788,9 +788,7 @@  typedef struct i386_opcode_modifier
   unsigned int disp8memshift:3;
   unsigned int vsz:3;
   unsigned int optimize:1;
-  unsigned int attmnemonic:1;
-  unsigned int attsyntax:1;
-  unsigned int intelsyntax:1;
+  unsigned int dialect:2;
   unsigned int isa64:2;
 } i386_opcode_modifier;
 
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -86,6 +86,10 @@ 
 #define SwapSources       OperandConstraint=SWAP_SOURCES
 #define Ugh               OperandConstraint=UGH
 
+#define ATTSyntax         Dialect=ATT_SYNTAX
+#define ATTMnemonic       Dialect=ATT_MNEMONIC
+#define IntelSyntax       Dialect=INTEL_SYNTAX
+
 #define IgnoreSize	MnemonicSize=IGNORESIZE
 #define DefaultSize	MnemonicSize=DEFAULTSIZE