Re: Insn canonicalization not only with constant

2007-02-15 Thread Sami Khawam
OK, I see what you mean. The reason you can get both (ior (ashift ...) (lshiftrt ...)) and (ior (lshiftrt ...) (ashift ...)) is that simplify-rtx.c has no rule to canonicalize such expressions and that LSHIFTRT and ASHIFT have the same precedence. Hmm, in simplify_binary_operation_1(), it s

Re: Insn canonicalization not only with constant

2007-02-15 Thread Rask Ingemann Lambertsen
On Wed, Feb 14, 2007 at 08:30:52PM +, Sami Khawam wrote: > Hi Rask, > > Basically the CPU has the 'SCALE_28_4' instruction which does the following: > output = (operand1 >> 28) | (operand2 << 4) > > From my understanding the OR operation (ior), doesn't get canonicalized > since it's second

Re: Insn canonicalization not only with constant

2007-02-15 Thread Sami Khawam
Hi Andrew, You mean using a DI rotate left by 4 and then saving the output as SI (saving the hi part and ignoring the low one) ? Also, how is canonicalization detected anyway? Are there rules that gcc follows? How can they be changed? Sami Andrew Pinski wrote: output = (operand1 >> 28)

Re: Insn canonicalization not only with constant

2007-02-14 Thread Andrew Pinski
> > Hi Rask, > > Basically the CPU has the 'SCALE_28_4' instruction which does the following: > output = (operand1 >> 28) | (operand2 << 4) Isn't that a rotate? if so you can use either rotate or rotatert instead. Thanks, Andrew Pinski

Re: Insn canonicalization not only with constant

2007-02-14 Thread Sami Khawam
Hi Rask, Basically the CPU has the 'SCALE_28_4' instruction which does the following: output = (operand1 >> 28) | (operand2 << 4) From my understanding the OR operation (ior), doesn't get canonicalized since it's second operand (in this case (lshiftrt:SI (match_operand:SI 2 "register_operand"

Re: Insn canonicalization not only with constant

2007-02-14 Thread Rask Ingemann Lambertsen
On Wed, Feb 14, 2007 at 05:31:36PM +, Sami Khawam wrote: > (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

Insn canonicalization not only with constant

2007-02-14 Thread Sami Khawam
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, w