This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]