This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sign_extended 32bit -addition


Hi all,

Our target supports 'addm op1,op2' instruction which perform following operation.
op2=sign_extend(op1)+op2
where 'op1' is 16bit integer operand and 'op2' is 32bit integer operand.before performing addition 'op1' is sign_extended to 32 bit number and then perform addition with 'op2' and store the result in 'op2'.



I have added new pattern in md file as below.


(define_insn "*addsihi5"
 [(set (match_operand:SI 0 "register_operand" "=D")
       (plus:SI  (match_operand:SI 1 "register_operand" "0")
      (sign_extend:SI (match_operand:HI 2 "register_operand" "e"))))]
 ""
"addm %2,%0"
 [(set_attr "type"  "binary")])

But compiler generating following patterns independently:
(insn 13 12 14 (nil) (set (reg:SI 25)
       (sign_extend:SI (reg:HI 26))) -1 (nil)
   (nil))
(insn 15 14 16 (nil) (set (reg:SI 28)
       (plus:SI (reg:SI 27)
           (reg:SI 25))) -1 (nil)
   (nil))

How can i make compiler to generate required pattern so that it can generate addm instruction instead of sign_extend & addition instructions independently.

Can u please help me in this regard.

--P.V. Siva prasad


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]