This is the mail archive of the gcc@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]

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


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