This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][AArch64] Use cinc for if_then_else of plus-immediates
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, James Greenhalgh <james dot greenhalgh at arm dot com>
- Date: Sat, 18 Jul 2015 20:13:58 -0700
- Subject: Re: [PATCH][AArch64] Use cinc for if_then_else of plus-immediates
- Authentication-results: sourceware.org; auth=none
- References: <55A7CEC6 dot 9080709 at arm dot com>
On Thu, Jul 16, 2015 at 8:33 AM, Kyrill Tkachov <kyrylo.tkachov@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.tkachov@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.tkachov@arm.com>
>
> * gcc.target/aarch64/cinc_common_1.c: New test.