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

Jan Beulich jbeulich@suse.com
Fri Dec 13 10:13:00 GMT 2019


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



More information about the Binutils mailing list