Dear all,

I wanted to add an instruction via a builtin to allow users to take
advantage of some special instructions that are on my architecture.

However, the latency of the instruction is not 1 so I'll also need to
handle it in the rtx_costs function.

I had first tried to explain with the current RTL what the instruction
did, but it used internally a special register and it was difficult to
define exactly what it does. Second, it seemed difficult to handle the
latency this way. Since I would not get a separate code for my rtl.

My current solution:

- Define a new rtl in rtl.def
- Add the new rtl in the MD file and the generated assembly instruction

However, the solution seems to work, except in O0, where I get this error:

testmaca.c:25: error: unrecognizable insn:
(insn 11 10 12 3 testmaca.c:16 (set (reg:DI 66 myreg)
        (newrtl:DI (mem/c/i:DI (plus:DI (reg/f:DI 68 virtual-stack-vars)
                    (const_int 16 [0x10])) [0 x+0 S8 A64])
            (mem/c/i:DI (plus:DI (reg/f:DI 68 virtual-stack-vars)
                    (const_int 8 [0x8])) [0 y+0 S8 A64]))) -1 (nil))

Any ideas how I can fix this ?

Here is my rtl definition :

(define_insn "newrtl"
  [(set (reg:DI 24)
        (newrtl:DI (match_operand:DI 0 "register_operand" "r")
                 (match_operand:DI 1 "register_operand" "r")))]
  ""
  "newrtl\\t%0,%1"
  [(set_attr "type"     "arith")
   (set_attr "mode"     "DI")
   (set_attr "length"   "1")])


If there is a better way to do this, I'll be happy to hear it :-)

Thanks in advance,
Jc

Reply via email to