[PATCH 1/2] Add check for 8-bit old registers in EVEX format
Jan Beulich
jbeulich@suse.com
Fri May 17 07:14:09 GMT 2024
On 17.05.2024 03:45, Cui, Lili wrote:
>> On 15.05.2024 08:31, Cui, Lili wrote:
>>> --- a/gas/config/tc-i386.c
>>> +++ b/gas/config/tc-i386.c
>>> @@ -7029,6 +7029,18 @@ md_assemble (char *line)
>>> as_bad (_("{rex2} prefix invalid with `%s'"), insn_name (&i.tm));
>>> return;
>>> }
>>> + /* Check for 8 bit operand that uses old registers. */
>>> + for (unsigned int op = 0; op < i.operands; op++)
>>> + {
>>> + if (i.types[op].bitfield.class == Reg
>>> + && i.types[op].bitfield.byte
>>> + && !(i.op[op].regs->reg_flags & RegRex64)
>>> + && i.op[op].regs->reg_num > 3)
>>> +
>>> + as_bad (_("can't encode register '%s' in an "
>>> + " EVEX/VEX prefix instruction"),
>>> + i.op[op].regs->reg_name);
>>> + }
>>
>> I'd like us to avoid duplicating the conditional used here, matching what
>> establish_rex() does. establish_rex() is called unconditionally, so there are two
>> questions (both of which could have been addressed if there wasn't, once
>> again, an entirely empty patch description here): Why does the checking there
>> not cover this case? Is it not possible to amend that logic, rather than
>> introducing another instance in an entirely distinct place?
>>
>
> Agreed, when I added this patch, I first tried adding it with rex/rex2. But since that judgment of establish_rex() is tied to "i.rex", as you also suggested, I created a patch to detach the old register check from that branch and then extended it to check the EVEX prefixed instructions .
Yet that tying to "i.rex" could be amended, I think.
Jan
More information about the Binutils
mailing list