This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Porting question: define_expand Vs define_split
- From: DJ Delorie <dj at redhat dot com>
- To: sivanbalaji at acmet dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 3 Nov 2004 11:43:46 -0500
- Subject: Re: Porting question: define_expand Vs define_split
- References: <41887D89.4020109@acmet.com>
Choosing between define_expand and define_insn_and_split IMHO depends
on whether gcc can optimize better with the split-up insns or with the
combined insn. In cases with linear math, it's probably better to
define_expand. In cases where you're splitting up a wide op into
pairs of narrow ops (like movdi->movsi), it's probably better to
define_insn_and_split (and defer until after reload) so gcc can see
the wider ops during optimization.
In the case of a missing neg, though, you can use a not/inc pair if
your machine is 2s-compliment and avoid the need for a scratch
register to hold the zero or op1 (it can be done in place). You'd
still use a define_expand:
(define_expand "neghi2"
[(set (match_dup 2)
(not:HI (match_operand:HI 1 "" "")))
(set (match_operand:HI 0 "" "")
(plus:HI (match_dup 2)
(const_int 1)))]
""
"operands[2] = gen_reg_rtx (HImode);"
)
Add "register_operand" if your not/inc ops need registers.