diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-08-23 09:24:10 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2024-08-23 09:24:10 +0200 |
commit | 5637daa2064c44831f90e64df37bcd047160366e (patch) | |
tree | ae47103ee57064b06fde1d9477d3e856caff4909 | |
parent | b67ed4587727b940e9faafa8cdb1db1c32e34846 (diff) | |
download | binutils-5637daa2064c44831f90e64df37bcd047160366e.zip binutils-5637daa2064c44831f90e64df37bcd047160366e.tar.gz binutils-5637daa2064c44831f90e64df37bcd047160366e.tar.bz2 |
x86: simplify SAE checking
To determine whether SAE (with or without StaticRounding) is permitted
there's no need to iterate over all operands. Even less so starting at
the front (thus needlessly inspecting immediate operands as well).
Leverage the pattern across all relevant templates and check only the
last two operands, and also only for non-512 ones (besides the non-LIG
case that was already checked for).
-rw-r--r-- | gas/config/tc-i386.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 4e3af89..ad68ba9 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -8024,18 +8024,16 @@ check_VecOperands (const insn_template *t) return 1; } - /* Non-EVEX.LIG forms need to have a ZMM register as at least one - operand. */ - if (t->opcode_modifier.evex != EVEXLIG) - { - for (op = 0; op < t->operands; ++op) - if (i.types[op].bitfield.zmmword) - break; - if (op >= t->operands) - { - i.error = operand_size_mismatch; - return 1; - } + /* Non-EVEX.{LIG,512} forms need to have a ZMM register as at least one + operand. There's no need to check all operands, though: Either of the + last two operands will be of the right size in all relevant templates. */ + if (t->opcode_modifier.evex != EVEXLIG + && t->opcode_modifier.evex != EVEX512 + && !i.types[t->operands - 1].bitfield.zmmword + && !i.types[t->operands - 2].bitfield.zmmword) + { + i.error = operand_size_mismatch; + return 1; } } |