This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: define_expand
- From: Daniel Jacobowitz <drow at false dot org>
- To: Michael Eager <eager at eagercon dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Tue, 15 Aug 2006 13:54:28 -0400
- Subject: Re: define_expand
- References: <44E209C1.30501@eagercon.com>
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