This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] i386: Also check R12-R15 registers when optimizing testq to testb
- From: Jan Beulich <jbeulich at suse dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 16 Dec 2019 11:05:15 +0100
- Subject: Re: [PATCH] i386: Also check R12-R15 registers when optimizing testq to testb
- References: <CAMe9rOo8HUOUwGGDjP1=Nqb1fgX9E=Pdg=-UdXLG1hCYJVYPNw@mail.gmail.com> <91a0a116-7091-0575-a195-d8d823cb04e6@suse.com> <CAMe9rOoDQOLOzpxksnHe+roeV=8dj=BSxu6P0SB=COZ7HmCM5w@mail.gmail.com>
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