This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questions about peephole2
>> I'm assuing this will have to go into the movdf expander instead of
>> the adddf3 expander since gen_movdf3 is called via the call to force_reg in
>> expand_binop at optabs.c:665:
>
>No. movdf is being called because the expander predicate requires it.
>You'd change the adddf3 expander predicate to allow such things through
>and then dump to memory yourself.
Ahh, something like:
(define_expand "adddf3"
[(set (match_operand:DF 0 "nonimmediate_operand" "")
(plus:DF (match_operand:DF 1 "general_operand" "")
(match_operand:DF 2 "general_operand" "")))]
"TARGET_68881 || TARGET_FPA || TARGET_CFV4E"
"
{
if (TARGET_CFV4E && CONSTANT_P (operands[2]))
operands[2] = force_const_mem (DFmode, operands[2]);
}")
In the testcode that I sent before, gen_adddf3 doesn't call
force_const_mem since operand2 was forced into a register since
rtx_costs() returns > COSTS_N_INSNS(1):
(gdb) where 1
#0 expand_binop (mode=DFmode, binoptab=0x824f758, op0=0x401af9c0,
op1=0x400238a0, target=0x401af9c0, unsignedp=0, methods=OPTAB_LIB_WIDEN)
at /home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-304/gcc/optabs.c:663
(gdb) call debug_rtx(op1)
(const_double:DF (const_int 0 [0x0]) 0 [0x0] 0 [0x0] 1075806208 [0x401f8000])
(gdb) p binoptab->code
$1 = PLUS
(gdb) p rtx_cost (op1, binoptab->code)
$2 = 5
I don't think should lower the cost of the constant(since its already
enough work as is :-)
--
Peter Barada Peter.Barada@motorola.com
Wizard 781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)