On Tue, Aug 15, 2006 at 10:52:01AM -0700, Michael Eager wrote:
> (define_expand "negsf2"
>   [(set (match_operand:SF 0 "gpc_reg_operand" "")
>       (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
>   "TARGET_HARD_FLOAT"
>   "")

> I've read the docs (sect 13.15) which describe define_expand,
> but I have a feeling that I'm missing something that would make
> it clear how these two templates interact.  Clearly, the define_insn
> template says that when the insn pattern is found, generate the
> "fneg" instruction.  What is the define_expand template doing?

The important thing about the define_expand pattern, in this case, is
that it has a name.  A call to gen_negsf2 will generate the RTL
specified by that expander.  This also gets automatically handled by
optabs.c when generating negation, and there may be macros like
HAVE_negsf2.

Then, the *negsf2 define_insn is used to actually emit the operation
(and for things like combine, which test if an instruction is valid).

-- 
Daniel Jacobowitz
CodeSourcery

Reply via email to