This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Prefer reg as first operand in commutative operator


On Tue, Feb 14, 2012 at 02:05:30PM +0000, Paulo J. Matos wrote:
> >I think the register allocator will generate good code using % if you
> >make your predicate nonimmediate_operand in operand 1:
> >
> >(define_insn "iorqi3"
> >[(set (match_operand:QI 0 "register_operand" "=c")
> >(ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
> >(match_operand:QI 2 "general_operand" "cwmi")))
> >(clobber (reg:CC RCC))]
> >"register_operand(operands[1], QImode) ||
> >register_operand(operands[2], QImode)"
> >"or\\t%0,%f2")

> Yes, I think in general that seems to be the right procedure. In my
> case, unfortunately it does not work.
> The reason is that it allows:
> (set (reg:QI ...)
>      (ior:QI (mem:QI (reg:QI ...))
>              (mem:QI (reg:QI ...))))
> 
> This wouldn't in general be a problem except that my backend only
> has one register that can be used for a memory dereference, which
> means that BASE_REG_CLASS is a class with a single register.

It doesn't allow that, because the condition on the insn then fails,
as neither operand 1 nor operand 2 is register_operand.

	Jakub


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