[PATCH][ARM][3/3] Implement negsicc, notsicc optabs

Kyrill Tkachov kyrylo.tkachov@arm.com
Tue Sep 1 15:04:00 GMT 2015

Hi all,

This third patch implements the new optabs for arm.
Conveniently, we can reuse the recently refactored *if_neg_move pattern
and extend it to cover the conditional NOT case.
Although arm has conditional execution capabilities I have found that
performing the transformation from patch 1/3 early on benefits arm as well.
For example for code:
foonegsi (int a)
   return a ? 25089992 : -25089992;

we currently generate:
         movw    r2, #55240
         movw    r3, #10296
         cmp     r0, #0
         movt    r2, 382
         movt    r3, 65153
         movne   r0, r2
         moveq   r0, r3

whereas with this patch we generate:
         movw    r3, #10296
         cmp     r0, #0
         movt    r3, 65153
         mov     r0, r3
         rsbne   r0, r3, #0
         bx      lr

In SPEC2006 this doesn't trigger very often, so there were minimal code differences,
but overall I claim this patch is an improvement.

Bootstrapped and tested on arm-none-linux-gnueabihf.

Ok for trunk if the midend changes in 1/3 are approved?


2015-09-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/arm/arm.md (<NOT_NEG_op>sicc): New define_expand.
     (*if_neg_move): Rename to...
     (*if_<NOT_NEG_op>_move): ... This.  Use NOT_NEG code iterator.
     * config/arm/iterators.md (NOT_NEG): New code iterator.
     (NOT_NEG_op): New code attribute.

2015-09-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.target/arm/cond_op_imm_1.c: New test.

More information about the Gcc-patches mailing list