aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Collison <michael.collison@linaro.org>2015-07-07 23:28:34 -0700
committerMichael Collison <michael.collison@linaro.org>2015-07-07 23:28:34 -0700
commitc1685730c39cac89ba728fa80f33fcfa59b0a35f (patch)
treeebf94f4571f004a4f106380b28c4701277b7ee01
parent5a3d2e18fddd767cb3cc29b2ab846604ade2c55b (diff)
Add support for min/smin on loop end conditionslinaro-local/tcwg-140-v2
-rw-r--r--gcc/match.pd14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 5e8fd32ed22..86917108b98 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1793,3 +1793,17 @@ 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)))))