[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    Re: How to describe a FMAC insn
From:       Rask Ingemann Lambertsen <rask () sygehus ! dk>
Date:       2007-12-26 17:37:55
Message-ID: 20071226173755.GP17368 () sygehus ! dk
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic