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]

Insn canonicalization not only with constant


Hi,

Although I have been porting and using gcc for quite a while now, I am still a newbie at the internals and would be grateful if you can help me.

I have designed a CPU architecture where most of the instructions only accept data operands as registers and no immediate values are allowed, which is causing me some trouble in gcc. One of the problems is instruction canonicalization.

I have some special single instructions to execute operations, which on other processors would take several instructions, e.g. scaling of 64-bit into 32-bit using pre-set, let's say something that looks like:

(define_insn "scale_28_4"
  [(set (match_operand:SI 0 "register_operand" "=r")
(ior:SI
(ashift:SI (match_operand:SI 1 "register_operand" "r")
            (const_int 28 ))
(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
            (const_int 4))
))]
  ""
  "SCALE_28_4 tout= %0  in1= %1  tin2= %2"
  [(set_attr "type" "logic")
   (set_attr "length" "1")])



Instruction canonicalization doesn't work, since as explained in
http://gcc.gnu.org/onlinedocs/gccint/Insn-Canonicalizations.html
it only works if the second operand is a constant.

Is it possible to change this to make register operands valid for canonicalization as well?

Does the same problem affect 'mem' instructions with offset, and does it makes gcc canonicalizes only the ones with a constant offset?

Any help is greatly appreciated!

Sami


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