diff options
author | Michael Collison <michael.collison@linaro.org> | 2015-10-15 22:21:22 +0000 |
---|---|---|
committer | Michael Collison <collison@gcc.gnu.org> | 2015-10-15 22:21:22 +0000 |
commit | 4f7a56926513835ec1f05e8e59e49db938ebfd2a (patch) | |
tree | a882b73ddf5b1e398610a0b3ee8acb3b667cfb75 /gcc/match.pd | |
parent | 9418279db60955fac838eb1a9f2cdedb9f7f66ba (diff) | |
download | gcc-4f7a56926513835ec1f05e8e59e49db938ebfd2a.zip gcc-4f7a56926513835ec1f05e8e59e49db938ebfd2a.tar.gz gcc-4f7a56926513835ec1f05e8e59e49db938ebfd2a.tar.bz2 |
2015-09-30 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))
* testsuite/gcc.dg/tree-ssa/minmax-loopend.c: New test.
Co-Authored-By: Andrew Pinski <andrew.pinski@caviumnetworks.com>
From-SVN: r228854
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index e0ecbe2..f3813d8 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2431,3 +2431,13 @@ along with GCC; see the file COPYING3. If not see (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); } (convert (bit_and (op (convert:utype @0) (convert:utype @1)) (convert:utype @4)))))))) + +/* Transform (@0 < @1 and @0 < @2) to use min, + (@0 > @1 and @0 > @2) to use max */ +(for op (lt le gt ge) + ext (min min max max) + (simplify + (bit_and (op:s @0 @1) (op:s @0 @2)) + (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))) + (op @0 (ext @1 @2))))) + |