addition of patterns in md file

abhishekRoy <>
Fri, 1 Feb 2008 01:45:22 -0800 (PST)

          From comp.compilers

Related articles
conditional based transfer patterns in md file (abhishekRoy) (2008-02-01)
addition of patterns in md file (abhishekRoy) (2008-02-01)
Re: addition of patterns in md file (Michael Meissner) (2008-02-05)
| List of all articles for this month |

From: abhishekRoy <>
Newsgroups: comp.compilers
Date: Fri, 1 Feb 2008 01:45:22 -0800 (PST)
Organization: Compilers Central
References: 08-02-009
Keywords: GCC, question
Posted-Date: 01 Feb 2008 20:48:38 EST

Hi all,

Our target supports 'addm op1,op2' instruction which perform following
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

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)
(insn 15 14 16 (nil) (set (reg:SI 28)
              (plus:SI (reg:SI 27)
                      (reg:SI 25))) -1 (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.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.