summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramonakov <amonakov@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-10 12:58:53 +0000
committeramonakov <amonakov@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-10 12:58:53 +0000
commit8928f8d3bdebf2ebf23b7c39bf561e1294015b83 (patch)
tree60e3b9b74ff05851ff6add13c73688272df521a8
parent9cf3aec30334c18f547f9f01869b61894e653bf6 (diff)
downloadgcc-8928f8d3bdebf2ebf23b7c39bf561e1294015b83.tar.gz
* match.pd (-1 / B < A): Use :c to avoid pattern duplication.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237307 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/match.pd14
2 files changed, 6 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 73ba814f135..9696ad1b7a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-10 Alexander Monakov <amonakov@ispras.ru>
+
+ * match.pd (-1 / B < A): Use :c to avoid pattern duplication.
+
2016-06-10 Maxim Ostapenko <m.ostapenko@samsung.com>
PR sanitizer/71480
diff --git a/gcc/match.pd b/gcc/match.pd
index fe711159df9..7d4beeaa4ed 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); })))))