[binutils-gdb] x86: fold Accum checking in operand_size_match()
Jan Beulich
jbeulich@sourceware.org
Fri May 16 08:31:00 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8b2de983da29506d882f41ee7b1ce4e2dce22eef
commit 8b2de983da29506d882f41ee7b1ce4e2dce22eef
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri May 16 10:27:20 2025 +0200
x86: fold Accum checking in operand_size_match()
There's little point invoking match_{operand,simd}_size() twice per
loop; in fact the SIMD case with D set simply doesn't exist. Amend the
checks by one looking at the given operand, just like we already have
been doing for memory ones.
Diff:
---
gas/config/tc-i386.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 15f274f6e5b..7c9b94a61c4 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2609,27 +2609,24 @@ operand_size_match (const insn_template *t)
&& t->opcode_modifier.operandconstraint == ANY_SIZE)
continue;
- if (t->operand_types[j].bitfield.class == Reg
+ if (i.types[j].bitfield.class == Reg
+ && (t->operand_types[j].bitfield.class == Reg
+ || t->operand_types[j].bitfield.instance == Accum)
&& !match_operand_size (t, j, j))
{
match = 0;
break;
}
- if (t->operand_types[j].bitfield.class == RegSIMD
+ if (i.types[j].bitfield.class == RegSIMD
+ && (t->operand_types[j].bitfield.class == RegSIMD
+ || t->operand_types[j].bitfield.instance == Accum)
&& !match_simd_size (t, j, j))
{
match = 0;
break;
}
- if (t->operand_types[j].bitfield.instance == Accum
- && (!match_operand_size (t, j, j) || !match_simd_size (t, j, j)))
- {
- match = 0;
- break;
- }
-
if ((i.flags[j] & Operand_Mem)
&& operand_type_check (t->operand_types[j], anymem)
&& !match_mem_size (t, j, j))
@@ -2656,19 +2653,19 @@ operand_size_match (const insn_template *t)
|| is_cpu (t, CpuAPX_F))
given = j < 2 ? 1 - j : j;
- if (t->operand_types[j].bitfield.class == Reg
+ if (i.types[given].bitfield.class == Reg
+ && (t->operand_types[j].bitfield.class == Reg
+ || t->operand_types[j].bitfield.instance == Accum)
&& !match_operand_size (t, j, given))
return match;
- if (t->operand_types[j].bitfield.class == RegSIMD
+ /* No need to check for Accum here: There are no such templates with D
+ set. */
+ if (i.types[given].bitfield.class == RegSIMD
+ && t->operand_types[j].bitfield.class == RegSIMD
&& !match_simd_size (t, j, given))
return match;
- if (t->operand_types[j].bitfield.instance == Accum
- && (!match_operand_size (t, j, given)
- || !match_simd_size (t, j, given)))
- return match;
-
if ((i.flags[given] & Operand_Mem)
&& operand_type_check (t->operand_types[j], anymem)
&& !match_mem_size (t, j, given))
More information about the Binutils-cvs
mailing list