(define_expand "negsf2"
[(set (match_operand:SF 0 "gpc_reg_operand" "")
(neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
"TARGET_HARD_FLOAT"
"")
(define_insn "*negsf2"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
(neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
"TARGET_HARD_FLOAT && TARGET_FPRS"
"fneg %0,%1"
[(set_attr "type" "fp")])
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?
You are missing another template, which is used on the E500 (see
spe.md). This has a condition of "TARGET_HARD_FLOAT && !TARGET_FPRS".
(define_insn "*negsf2_gpr"
[(set (match_operand:SF 0 "gpc_reg_operand" "=r")
(neg:SF (match_operand:SF 1 "gpc_reg_operand" "r")))]
"TARGET_HARD_FLOAT && !TARGET_FPRS"
"efsneg %0,%1"
[(set_attr "type" "fpsimple")])
We need a define_expand to generate the RTL, and two define_insns to
emit different code depending on the actual subtarget.
Paolo