[2/8] x86: don't open-code PREFIX_NONE

Message ID c25c6717-0ad0-d564-8640-fcb159f3654d@suse.com
State New
Headers show
Series
  • x86: work towards further opcode table compaction
Related show

Commit Message

H.J. Lu via Binutils March 22, 2021, 4:42 p.m.
Use the constant rather than literal zero. While at it fold two
conditionals (using the same base opcode and prefix) in load_insn_p().

gas/
2021-03-XX  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (load_insn_p): Use PREFIX_NONE. Fold two
	if()-s.
	(match_template, output_insn): Use PREFIX_NONE.

Comments

H.J. Lu via Binutils March 22, 2021, 5:58 p.m. | #1
On Mon, Mar 22, 2021 at 9:42 AM Jan Beulich <jbeulich@suse.com> wrote:
>

> Use the constant rather than literal zero. While at it fold two

> conditionals (using the same base opcode and prefix) in load_insn_p().

>

> gas/

> 2021-03-XX  Jan Beulich  <jbeulich@suse.com>

>

>         * config/tc-i386.c (load_insn_p): Use PREFIX_NONE. Fold two

>         if()-s.

>         (match_template, output_insn): Use PREFIX_NONE.


OK.  Thanks.

-- 
H.J.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4446,10 +4446,11 @@  load_insn_p (void)
 	  && i.tm.extension_opcode != 6)
 	return 1;
 
-      /* cmpxchg8b, cmpxchg16b, xrstors.  */
+      /* cmpxchg8b, cmpxchg16b, xrstors, vmptrld.  */
       if (i.tm.base_opcode == 0xfc7
-	  && i.tm.opcode_modifier.opcodeprefix == 0
-	  && (i.tm.extension_opcode == 1 || i.tm.extension_opcode == 3))
+	  && i.tm.opcode_modifier.opcodeprefix == PREFIX_NONE
+	  && (i.tm.extension_opcode == 1 || i.tm.extension_opcode == 3
+	      || i.tm.extension_opcode == 6))
 	return 1;
 
       /* fxrstor, ldmxcsr, xrstor.  */
@@ -4466,12 +4467,6 @@  load_insn_p (void)
 	      || i.tm.extension_opcode == 6))
 	return 1;
 
-      /* vmptrld */
-      if (i.tm.base_opcode == 0xfc7
-	  && i.tm.opcode_modifier.opcodeprefix == 0
-	  && i.tm.extension_opcode == 6)
-	return 1;
-
       /* Check for x87 instructions.  */
       if (i.tm.base_opcode >= 0xd8 && i.tm.base_opcode <= 0xdf)
 	{
@@ -6337,7 +6332,7 @@  match_template (char mnem_suffix)
       if (((i.suffix == QWORD_MNEM_SUFFIX
 	    && flag_code != CODE_64BIT
 	    && !(t->base_opcode == 0xfc7
-		 && i.tm.opcode_modifier.opcodeprefix == 0
+		 && i.tm.opcode_modifier.opcodeprefix == PREFIX_NONE
 		 && t->extension_opcode == 1) /* cmpxchg8b */)
 	   || (i.suffix == LONG_MNEM_SUFFIX
 	       && !cpu_arch_flags.bitfield.cpui386))
@@ -9259,7 +9254,7 @@  output_insn (void)
 	  || i.tm.cpu_flags.bitfield.cpucmov
 	  || i.tm.cpu_flags.bitfield.cpusyscall
 	  || (i.tm.base_opcode == 0xfc7
-	      && i.tm.opcode_modifier.opcodeprefix == 0
+	      && i.tm.opcode_modifier.opcodeprefix == PREFIX_NONE
 	      && i.tm.extension_opcode == 1) /* cmpxchg8b */)
 	x86_isa_1_used |= GNU_PROPERTY_X86_ISA_1_BASELINE;
       if (i.tm.cpu_flags.bitfield.cpusse3