From 8b2de983da29506d882f41ee7b1ce4e2dce22eef Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 16 May 2025 10:27:20 +0200 Subject: [PATCH] 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. --- 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)) -- 2.39.5