On Thu, Jul 16, 2015 at 8:33 AM, Kyrill Tkachov <kyrylo.tkac...@arm.com> wrote: > Hi all, > > This patch improves codegen for expressions of the form: > (x ? y + c1 : y + c2) when |c1 - c2| == 1 > > It matches the if_then_else of the two plus-immediates, > performs one of them, then generates a conditional increment > operation. > > Thus, for the code in the testcase we generate a single add, compare > and cinc instruction rather than two adds, a compare and a csel. > > Bootstrapped and tested on aarch64. > > Ok for trunk?
Why isn't this done in the generic code already. That is ifcvt? It seems better to have it optimize it there rather than having a target specific patch for something which is not really target specific except maybe the cost. Thanks, Andrew > > Thanks, > Kyrill > > 2015-07-16 Kyrylo Tkachov <kyrylo.tkac...@arm.com> > > * config/aarch64/aarch64.md (*csel_plus<mode>6): > New define_insn_and_split. > (*csinc2<mode>_insn): Rename to... > (csinc2<mode>_insn): ... This. > > 2015-07-16 Kyrylo Tkachov <kyrylo.tkac...@arm.com> > > * gcc.target/aarch64/cinc_common_1.c: New test.