public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to split mulsi3 pattern
@ 2009-11-10 13:48 Mohamed Shafi
  2009-11-10 17:37 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Mohamed Shafi @ 2009-11-10 13:48 UTC (permalink / raw)
  To: GCC

Hello all,

I am doing a port for a 32bit target in GCC 4.4.0. In my target 32bit
multiply instruction is carried out in two instructions.

Dn = Da x Db is executed as

Dn = (Da.L * Db.H + Da.H * Db.L) << 16
Dn = Dn + (Da.L * Db.L)

Currently the pattern that i have for this is as follows:

(define_insn "mulsi3"
 [(set (match_operand:SI 0 "register_operand"           "=&d")
       (mult:SI (match_operand:SI 1 "register_operand"  "%d")
               (match_operand:SI 2 "register_operand" "d")))]

I would like to split this pattern into two (either after of before
reload). Currently i am doing something like this:

(define_insn_and_split "mulsi3"
 [(set (match_operand:SI 0 "register_operand"           "=&d")
       (mult:SI (match_operand:SI 1 "register_operand"  "%d")
                (match_operand:SI 2 "register_operand" "d")))]
 ""
 "#"
 "reload_completed"
 [(set (match_dup 0)
       (ashift:SI
        (plus:SI (mult:HI (unspec:HI [(match_dup 2)] UNSPEC_REG_LOW)
                          (unspec:HI [(match_dup 1)] UNSPEC_REG_HIGH))
                 (mult:HI (unspec:HI [(match_dup 2)] UNSPEC_REG_HIGH)
                          (unspec:HI [(match_dup 1)] UNSPEC_REG_LOW)))
        (const_int 16)))
  (set (match_dup 0)
       (plus:SI (match_dup 0)
                (mult:HI (unspec:HI [(match_dup 2)] UNSPEC_REG_LOW)
                         (unspec:HI [(match_dup 1)] UNSPEC_REG_LOW))))]
  ""
)

But in few testcases this is creating problems. So i would like to
know better patterns to split mulsi3 pattern.
Can someone help me out.

Regards,
Shafi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-12 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-10 13:48 How to split mulsi3 pattern Mohamed Shafi
2009-11-10 17:37 ` Richard Henderson
2009-11-12 13:40   ` Mohamed Shafi
2009-11-12 16:02     ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).