Hello all,

I am working on gcc v4.1.1 for a non-gcc target. I want to support
'MAC' instruction
(mac OP1, OP2, OP3  =>  OP3 += OP1 * OP2).

I have PLUS, MULT and following MAC pattern, in my target.md file.
(define_insn ""
        [(set   (match_operand:SI 0 "data_reg" "=f")
                (plus:SI (mult:SI (match_operand:SI 1 "data_reg" "f")
                        (match_operand:SI 2 "data_reg" "f"))
                (match_operand:SI 3 "data_reg" "0")))]
        ""
        "mac\\t%1, %2, %3"
        [(set_attr "type" "arith")
        (set_attr "length" "2")]
)

But for the following example
 int a = 1;
 int b = 2;
 int c = 3;
 c = c + a * b;
the MAC pattern is not getting recognized, instead it is still using
PLUS and MULT patterns.

I noticed the following point in gcc-internals doc: "Instruction
combination pass attempts to combine groups of two or three
instructions that are related by
data flow into single instructions".

Please tell me whether this is feasible in gcc v4.1.1 or not?
Am i missing any other changes or additions?


Regards,
Rahul

Reply via email to