This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to describe a FMAC insn
On Wed, Dec 26, 2007 at 06:59:39AM -0800, Qing Wei wrote:
> I tried by referring the ia64.md, unfortunately it does not work. The
> insn I wrote for FMAC is as follows,
>
> (define_insn "maddsi4"
> [(set (match_operand:SI 0 "register_operand" "=r")
> (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")
> (match_operand:SI 2 "register_operand" "r"))
> (match_operand:SI 3 "register_operand" "r")))]
> ""
> "fma %0, %1, %2, %3")
[...]
> It seems trivial. But after I rebuilt GCC for this new target, I found
> that no optabs entry is initialized for maddsi4 in insn-opinit.c which
> is generated by genopinit.
It would be called maddhisi4, maddsidi4 or so for a sign-extending
instruction. If your instruction is a plain multiply-add instruction (which
is how you've defined it above), then there is no optab for it.
> However, the add_optab and smul_optab do be
> initialized with Code_for_addsi3/mulsi3. As a result, when I test the
> following simple program, cc1 produces separate add and mul instructions
> rather than fma, where the problem is? Thanks.
Look at the dump file produced by -fdump-rtl-combine-details.
--
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year