]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: introduce PadLock predicate
authorJan Beulich <jbeulich@suse.com>
Fri, 10 Oct 2025 07:26:44 +0000 (09:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 10 Oct 2025 07:26:44 +0000 (09:26 +0200)
By, at least for now, (ab)using the PrefixRepe attribute, the other two
PadLock checks can be simplified.

gas/config/tc-i386.c

index a8bb59a917ef5197529da0fdcc2b058bf4ed6a81..7b508d790b5de8894d603b7b97aef010bff89e92 100644 (file)
@@ -4111,6 +4111,13 @@ want_disp32 (const insn_template *t)
                 || t->opcode_modifier.size == SIZE32));
 }
 
+static INLINE bool is_padlock (const insn_template *t)
+{
+  /* (Ab)use the PrefixRepe attribute of PadLock insns as long as no
+     others use it.  */
+  return t->opcode_modifier.prefixok == PrefixRepe;
+}
+
 static int
 intel_float_operand (const char *mnemonic)
 {
@@ -7414,9 +7421,7 @@ i386_assemble (char *line)
   if ((is_any_vex_encoding (&i.tm) && i.tm.opcode_space != SPACE_MAP4)
       || i.tm.operand_types[i.imm_operands].bitfield.class >= RegMMX
       || i.tm.operand_types[i.imm_operands + 1].bitfield.class >= RegMMX
-      /* (Ab)use the PrefixRepe attribute of PadLock insns as long as no
-        others use it.  */
-      || i.tm.opcode_modifier.prefixok == PrefixRepe)
+      || is_padlock(&i.tm))
     {
       /* Check for data size prefix on VEX/XOP/EVEX encoded, SIMD, and
         PadLock insns.  */
@@ -12185,10 +12190,7 @@ add_branch_prefix_frag_p (const struct last_insn *last_insn)
   if (!align_branch_power
       || !align_branch_prefix_size
       || now_seg == absolute_section
-      || is_cpu (&i.tm, CpuPadLock)
-      || is_cpu (&i.tm, CpuPadLockRNG2)
-      || is_cpu (&i.tm, CpuPadLockPHE2)
-      || is_cpu (&i.tm, CpuPadLockXMODX)
+      || is_padlock (&i.tm)
       || !cpu_arch_flags.bitfield.cpui386)
     return 0;
 
@@ -12567,10 +12569,7 @@ output_insn (const struct last_insn *last_insn)
              add_prefix (0xf2);
              break;
            case PREFIX_0XF3:
-             if ((!is_cpu (&i.tm, CpuPadLock)
-                  && !is_cpu (&i.tm, CpuPadLockRNG2)
-                  && !is_cpu (&i.tm, CpuPadLockPHE2)
-                  && !is_cpu (&i.tm, CpuPadLockXMODX))
+             if (!is_padlock (&i.tm)
                  || (i.prefix[REP_PREFIX] != 0xf3))
                add_prefix (0xf3);
              break;