This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ARM] minmax_arithsi for non-canonical operand order with MINUS operator
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Kyrylo Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>
- Date: Tue, 2 Apr 2013 11:10:24 +0100
- Subject: Re: [PATCH][ARM] minmax_arithsi for non-canonical operand order with MINUS operator
- References: <514b4cf7 dot c9c4440a dot 7a38 dot 789dSMTPIN_ADDED_BROKEN at mx dot google dot com>
- Reply-to: ramrad01 at arm dot com
On Thu, Mar 21, 2013 at 6:09 PM, Kyrylo Tkachov <kyrylo.tkachov@arm.com> wrote:
> Hi all,
>
> This patch adds a splitter variant of the minmax_arithsi pattern for when
> the operator
> is non-commutative (MINUS) and the ordering of the operands is not
> canonical.
>
> That is, it will trigger for:
> #define MAX(a, b) (a > b ? a : b)
> int
> foo (int a, int b, int c)
> {
> return c - MAX (a,b);
> }
>
> and will generate:
> cmp r1, r0
> rsbge r0, r1, r2
> rsblt r0, r0, r2
>
> instead of the current:
> cmp r0, r1
> movlt r0, r1
> rsb r0, r0, r2
>
> No regressions on arm-none-eabi.
>
> Ok for trunk?
>
Split after reload please into cond-exec or use if_then_else instead
if you are splitting before reload - I originally thought it to be
safe when you asked me, but then have gone back and corrected myself.
Read this thread . http://patches.linaro.org/6469/ .
regards
Ramana
> Thanks,
> Kyrill
>
> gcc/
> 2013-03-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> * config/arm/arm.md (minmax_arithsi_non_canon): New pattern.
>
> gcc/testsuite
> 2013-03-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> * gcc.target/arm/minmax_minus.c: New test.