[PATCH][ARM] minmax_arithsi for non-canonical operand order with MINUS operator

Kyrylo Tkachov kyrylo.tkachov@arm.com
Thu Mar 21 18:09:00 GMT 2013


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?

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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: minmax_arithsi.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130321/229049f1/attachment.txt>


More information about the Gcc-patches mailing list