diff options
author | Michael Collison <michael.collison@linaro.org> | 2015-06-25 21:45:58 -0700 |
---|---|---|
committer | Michael Collison <michael.collison@linaro.org> | 2015-06-25 21:45:58 -0700 |
commit | b5f4f1508c5f7273b6d7859d6bb5320cddf7a3b1 (patch) | |
tree | 25277ed5ebe0a0560dca69c27816b5f3d11ffa8d | |
parent | 6c9180df69ea04b73c15dbc706da75eba8845880 (diff) |
Transform end of loop conditions to min/maxlinaro-local/tcwg-140
Change-Id: Ia056ff5f139301c18c5fc732a789a70f7613d267
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/match.pd | 13 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 49d8b6e2227..1da9946d121 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,10 @@ -2015-06-24 Michael Collison <michael.collison@linaro.org +2015-06-24 Michael Collison <michael.collison@linaro.org> + Andrew Pinski <andrew.pinski@caviumnetworks.com> + + * match.pd ((x < y) && (x < z) -> x < min (y,z), + (x > y) and (x > z) -> x > max (y,z)) + +2015-06-24 Michael Collison <michael.collison@linaro.org> 2012-05-01 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> diff --git a/gcc/match.pd b/gcc/match.pd index 9c88e3eee39..f6c4833aed5 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1244,3 +1244,16 @@ along with GCC; see the file COPYING3. If not see (convert (bit_and (op (convert:utype @0) (convert:utype @1)) (convert:utype @4))))))) +/* Transform (@0 < @1 and @0 < @2) to use min */ +(for op (lt le) +(simplify +(bit_and:c (op @0 @1) (op @0 @2)) +(if (INTEGRAL_TYPE_P (TREE_TYPE (@0))) +(op @0 (min @1 @2))))) + +/* Transform (@0 > @1 and @0 > @2) to use max */ +(for op (gt ge) +(simplify +(bit_and:c (op @0 @1) (op @0 @2)) +(if (INTEGRAL_TYPE_P (TREE_TYPE (@0))) +(op @0 (max @1 @2))))) |