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