This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Prefer reg as first operand in commutative operator
On Wed, Feb 15, 2012 at 10:04:15AM +0000, Paulo J. Matos wrote:
> It doesn't look like you can actually do that because, according to
> the internals manual:
> "For a named pattern, the condition (if present) may not depend on
> the data in the insn being matched, but only the target-machine-type
> flags. The compiler needs to test these conditions during
> initialization in order to learn exactly which named instructions
> are available in a particular run."
> And GCC complains with:
> insn-opinit.c: In function 'init_all_optabs':
> insn-opinit.c:24: error: 'operands' undeclared (first use in this function)
> insn-opinit.c:24: error: (Each undeclared identifier is reported only once
> insn-opinit.c:24: error: for each function it appears in.)
> Did I miss something in the example?
In define_expand (or define_insn of a standard named pattern) you can't use
operands, those conditions are used to select whether the given insn is
available at all. But you can use it in define_insn conditions for other
So you can have
"register_operand (operands, QImode) || register_operand (operands, QImode)"
See config/i386/i386.md for thousands of examples.