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: Fri, 13 Dec 2019 11:14:10 +0100
- Subject: Re: [PATCH] i386: Also check R12-R15 registers when optimizing testq to testb
- References: <CAMe9rOo8HUOUwGGDjP1=Nqb1fgX9E=Pdg=-UdXLG1hCYJVYPNw@mail.gmail.com>
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).
Jan