This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Definition of an instruction
- From: Jean Christophe Beyler <jean dot christophe dot beyler at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 4 Mar 2010 18:23:19 -0500
- Subject: Definition of an instruction
Dear all,
I've been trying to define this instruction but am having
difficulties. This instruction does 3 things:
- Updates an internal accumulator (depending on two arguments)
- Returns the value of that update in an output register
- Updates the internal accumulator after that
I first wrote :
(define_insn "myInst"
[
(set (match_operand:DI 0 "register_operand" "=r")
(unspec:DI [(match_operand:DI 1 "register_operand" "r")
(match_operand:DI 2 "register_operand" "r")
(reg:DI 66)] 5))
(clobber (reg:DI 66))
]
""
"myInst\\t%0,%1,%2"
[(set_attr "type" "arith")
(set_attr "mode" "DI")
(set_attr "length" "1")])
Therefore saying that the unspec was dependent on the accumulator and
the two values and that the result was operand 0.
I added a clobber to the accumulator to say: it's been changed.
However, now if I have two myInst, the first gets optimized out...
I therefore need to define this instruction differently, any ideas ?
Thanks a lot,
Jean Christophe Beyler