Re: [PATCH] Prefer reg as first operand in commutative operator

2012-02-15 Thread Paulo J. Matos
On 14/02/12 14:10, Jakub Jelinek wrote: On Tue, Feb 14, 2012 at 02:05:30PM +, Paulo J. Matos wrote: I think the register allocator will generate good code using % if you make your predicate nonimmediate_operand in operand 1: (define_insn iorqi3 [(set (match_operand:QI 0 register_operand

Re: [PATCH] Prefer reg as first operand in commutative operator

2012-02-15 Thread Jakub Jelinek
On Wed, Feb 15, 2012 at 10:04:15AM +, Paulo J. Matos wrote: It doesn't look like you can actually do that because, according to the internals manual: For a named pattern, the condition (if present) may not depend on the data in the insn being matched, but only the target-machine-type

Re: [PATCH] Prefer reg as first operand in commutative operator

2012-02-14 Thread Jakub Jelinek
On Tue, Feb 14, 2012 at 07:27:21AM +, Paulo J. Matos wrote: case RTX_OBJ: /* Complex expressions should be the first, so decrease priority of objects. Prefer pointer objects over non pointer objects. */ - if ((REG_P (op) REG_POINTER (op)) - || (MEM_P

Re: [PATCH] Prefer reg as first operand in commutative operator

2012-02-14 Thread Paulo J. Matos
On 14/02/12 09:52, Jakub Jelinek wrote: On Tue, Feb 14, 2012 at 07:27:21AM +, Paulo J. Matos wrote: case RTX_OBJ: /* Complex expressions should be the first, so decrease priority of objects. Prefer pointer objects over non pointer objects. */ - if ((REG_P

Re: [PATCH] Prefer reg as first operand in commutative operator

2012-02-14 Thread Paulo J. Matos
On 14/02/12 13:46, Paolo Bonzini wrote: On 02/14/2012 10:52 AM, Jakub Jelinek wrote: /* Complex expressions should be the first, so decrease priority of objects. Prefer pointer objects over non pointer objects. */ - if ((REG_P (op) REG_POINTER (op)) - || (MEM_P (op) MEM_POINTER (op))) -

Re: [PATCH] Prefer reg as first operand in commutative operator

2012-02-14 Thread Jakub Jelinek
On Tue, Feb 14, 2012 at 02:05:30PM +, Paulo J. Matos wrote: I think the register allocator will generate good code using % if you make your predicate nonimmediate_operand in operand 1: (define_insn iorqi3 [(set (match_operand:QI 0 register_operand =c) (ior:QI (match_operand:QI 1

Re: [PATCH] Prefer reg as first operand in commutative operator

2012-02-14 Thread Paulo J. Matos
On 14/02/12 14:10, Jakub Jelinek wrote: It doesn't allow that, because the condition on the insn then fails, as neither operand 1 nor operand 2 is register_operand. Jakub Oh!!! I incorrectly read the instruction as I had initially tried it and I knew it was failing, however, I

[PATCH] Prefer reg as first operand in commutative operator

2012-02-13 Thread Paulo J. Matos
Hi, This patch was submitted as part of PR 52235. It increases the preference of a register for first operand of a commutative operator. 2012-02-13 Paulo Matos paulo.ma...@csr.com * gcc/rtlanal.c: Increase preference of a register for the first operand in a commutative