[PATCH] i386: Also check R12-R15 registers when optimizing testq to testb

Jan Beulich jbeulich@suse.com
Mon Dec 16 10:04:00 GMT 2019


On 13.12.2019 16:57, H.J. Lu wrote:
> On Fri, Dec 13, 2019 at 2:13 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 12.12.2019 21:31,  H.J. Lu  wrote:
>>> Similar to SP, BP, SI and DI registers, R12-R15 registers must use REX
>>> prefix for the low byte register when optimizing
>>
>> Wouldn't it be better (more generic) to fix the logic producing the
>> diagnostic which gets in the way, seeing that generated code is
>> actually correct:
>>
>>           /* Look for 8 bit operand that uses old registers.  */
>>           if (i.types[x].bitfield.class == Reg && i.types[x].bitfield.byte
>>               && !(i.op[x].regs->reg_flags & RegRex64)
>>               && !(i.op[x].regs->reg_flags & RegRex))
>>             {
>>               /* In case it is "hi" register, give up.  */
>>               if (i.op[x].regs->reg_num > 3)
>>                 as_bad (_("can't encode register '%s%s' in an "
>>                           "instruction requiring REX prefix."),
>>                         register_prefix, i.op[x].regs->reg_name);
>>
>>
>> ? This would then also make the code match both of the comments
>> (which it doesn't right now).
> 
> This is an assembler implementation error.   Care to make a patch?

Done, albeit in a slightly different way than first thought.

Jan



More information about the Binutils mailing list