On 21/06/13 09:49, Kyrylo Tkachov wrote:
Hi all,

With r200197 the test pr46975.c now fails because the code:
  /* { dg-options "-mthumb -Os" } */
  int foo (int s)
  {
        return s == 1;
  }

now generates:
    0:  f1a0 0001       sub.w   r0, r0, #1
    4:  fab0 f080       clz     r0, r0
    8:  0940            lsrs    r0, r0, #5
    a:  4770            bx      lr

instead of:
    0:  1e43            subs    r3, r0, #1
    2:  4258            negs    r0, r3
    4:  4158            adcs    r0, r3
    6:  4770            bx      lr

This hurts code size.
Therefore I've disabled the new peephole2 for optimize_insn_for_size_p so that
the original peephole before r200197 is used when optimising for size.

I've also added a test to confirm that the new peephole2 for the non-CC
setting variants is being used when optimising for speed, since the large code
should be more efficient because the scheduler won't have to deal with
condition-code setting.

Ok for trunk?

Thanks,
Kyrill

gcc/
2013-06-21  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

        * config/arm/arm.md (peepholes for eq (reg1) (reg2/imm)):
        Use the flag setting variants when optimising for size.

        
gcc/testsuite/
2013-06-21  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

        * gcc.target/arm/pr46975-2.c: New test.


Not ok.

This re-introduces the bug that Meador was trying to fix.

You need to ensure that the condition code register is dead before applying this peephole.

Reply via email to