aboutsummaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorAlexander Monakov <amonakov@ispras.ru>2016-06-10 15:58:53 +0300
committerAlexander Monakov <amonakov@gcc.gnu.org>2016-06-10 15:58:53 +0300
commit603aeb87505e6777e159c0bfaee72a3708c8f6a1 (patch)
tree60e3b9b74ff05851ff6add13c73688272df521a8 /gcc/match.pd
parent7cfa10f33c57e7de87517360e42700bbfc97ef58 (diff)
downloadgcc-603aeb87505e6777e159c0bfaee72a3708c8f6a1.zip
gcc-603aeb87505e6777e159c0bfaee72a3708c8f6a1.tar.gz
gcc-603aeb87505e6777e159c0bfaee72a3708c8f6a1.tar.bz2
* match.pd (-1 / B < A): Use :c to avoid pattern duplication.
From-SVN: r237307
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd14
1 files changed, 2 insertions, 12 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index fe71115..7d4beea 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2626,22 +2626,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& types_match (TREE_TYPE (@0), TREE_TYPE (@1)))
(out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); }))))
-/* For unsigned operands, A > -1 / B checks whether A * B would overflow.
+/* For unsigned operands, -1 / B < A checks whether A * B would overflow.
Simplify it to __builtin_mul_overflow (A, B, <unused>). */
-/* -1 / B < A */
(for cmp (lt ge)
out (ne eq)
(simplify
- (cmp (trunc_div:s integer_all_onesp @1) @0)
- (if (TYPE_UNSIGNED (TREE_TYPE (@0)) && !VECTOR_TYPE_P (TREE_TYPE (@0)))
- (with { tree t = TREE_TYPE (@0), cpx = build_complex_type (t); }
- (out (imagpart (IFN_MUL_OVERFLOW:cpx @0 @1)) { build_zero_cst (t); })))))
-
-/* A > -1 / B */
-(for cmp (gt le)
- out (ne eq)
- (simplify
- (cmp @0 (trunc_div:s integer_all_onesp @1))
+ (cmp:c (trunc_div:s integer_all_onesp @1) @0)
(if (TYPE_UNSIGNED (TREE_TYPE (@0)) && !VECTOR_TYPE_P (TREE_TYPE (@0)))
(with { tree t = TREE_TYPE (@0), cpx = build_complex_type (t); }
(out (imagpart (IFN_MUL_OVERFLOW:cpx @0 @1)) { build_zero_cst (t); })))))