[binutils-gdb] x86: introduce PadLock predicate
Jan Beulich
jbeulich@sourceware.org
Fri Oct 10 07:28:26 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6e3954c79e8065f61228fabfcdaf3800d7223cd5
commit 6e3954c79e8065f61228fabfcdaf3800d7223cd5
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Oct 10 09:26:44 2025 +0200
x86: introduce PadLock predicate
By, at least for now, (ab)using the PrefixRepe attribute, the other two
PadLock checks can be simplified.
Diff:
---
gas/config/tc-i386.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index a8bb59a917e..7b508d790b5 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -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;
More information about the Binutils-cvs
mailing list