aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-06-01 10:31:30 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-06-01 10:31:30 +0000
commita8e9f9a310c7073dbf656cf4d47b72bff4605a2d (patch)
tree8c5a1980e3d57b4f2badc508c6101c7f0a30001f /gcc
parent48de570121fa393e003a11f63a85b862a0c1030e (diff)
downloadgcc-a8e9f9a310c7073dbf656cf4d47b72bff4605a2d.zip
gcc-a8e9f9a310c7073dbf656cf4d47b72bff4605a2d.tar.gz
gcc-a8e9f9a310c7073dbf656cf4d47b72bff4605a2d.tar.bz2
match.pd ((A & B) - (A & ~B) -> B - (A ^ B)): Add missing :c.
2016-06-01 Richard Biener <rguenther@suse.de> * match.pd ((A & B) - (A & ~B) -> B - (A ^ B)): Add missing :c. (relational patterns): Use :c to avoid pattern duplications. From-SVN: r236979
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/match.pd45
2 files changed, 10 insertions, 40 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d9142b9..fc45d3511 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2016-06-01 Richard Biener <rguenther@suse.de>
+ * match.pd ((A & B) - (A & ~B) -> B - (A ^ B)): Add missing :c.
+ (relational patterns): Use :c to avoid pattern duplications.
+
+2016-06-01 Richard Biener <rguenther@suse.de>
+
* genmatch.c (comparison_code_p): New predicate.
(swap_tree_comparison): New function.
(commutate): Add for_vec parameter to append new for entries.
diff --git a/gcc/match.pd b/gcc/match.pd
index 24e716e..dde6988 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -493,7 +493,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* Fold (A & B) - (A & ~B) into B - (A ^ B). */
(simplify
- (minus (bit_and:s @0 @1) (bit_and:cs @0 (bit_not @1)))
+ (minus (bit_and:cs @0 @1) (bit_and:cs @0 (bit_not @1)))
(minus @1 (bit_xor @0 @1)))
/* Simplify (X & ~Y) | (~X & Y) -> X ^ Y. */
@@ -2584,18 +2584,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(for cmp (lt le ge gt)
out (gt gt le le)
(simplify
- (cmp (plus@2 @0 INTEGER_CST@1) @0)
- (if (TYPE_UNSIGNED (TREE_TYPE (@0))
- && TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))
- && wi::ne_p (@1, 0)
- && single_use (@2))
- (out @0 { wide_int_to_tree (TREE_TYPE (@0), wi::max_value
- (TYPE_PRECISION (TREE_TYPE (@0)), UNSIGNED) - @1); }))))
-/* A CMP A + CST -> A CMP' CST' */
-(for cmp (gt ge le lt)
- out (gt gt le le)
- (simplify
- (cmp @0 (plus@2 @0 INTEGER_CST@1))
+ (cmp:c (plus@2 @0 INTEGER_CST@1) @0)
(if (TYPE_UNSIGNED (TREE_TYPE (@0))
&& TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))
&& wi::ne_p (@1, 0)
@@ -2608,35 +2597,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
expects the long form, so we restrict the transformation for now. */
(for cmp (gt le)
(simplify
- (cmp (minus@2 @0 @1) @0)
+ (cmp:c (minus@2 @0 @1) @0)
(if (single_use (@2)
&& ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))
&& TYPE_UNSIGNED (TREE_TYPE (@0))
&& TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0)))
(cmp @1 @0))))
-(for cmp (lt ge)
- (simplify
- (cmp @0 (minus@2 @0 @1))
- (if (single_use (@2)
- && ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))
- && TYPE_UNSIGNED (TREE_TYPE (@0))
- && TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0)))
- (cmp @0 @1))))
/* Testing for overflow is unnecessary if we already know the result. */
-/* A < A - B */
-(for cmp (lt ge)
- out (ne eq)
- (simplify
- (cmp @0 (realpart (IFN_SUB_OVERFLOW@2 @0 @1)))
- (if (TYPE_UNSIGNED (TREE_TYPE (@0))
- && types_match (TREE_TYPE (@0), TREE_TYPE (@1)))
- (out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); }))))
/* A - B > A */
(for cmp (gt le)
out (ne eq)
(simplify
- (cmp (realpart (IFN_SUB_OVERFLOW@2 @0 @1)) @0)
+ (cmp:c (realpart (IFN_SUB_OVERFLOW@2 @0 @1)) @0)
(if (TYPE_UNSIGNED (TREE_TYPE (@0))
&& types_match (TREE_TYPE (@0), TREE_TYPE (@1)))
(out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); }))))
@@ -2644,15 +2617,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(for cmp (lt ge)
out (ne eq)
(simplify
- (cmp (realpart (IFN_ADD_OVERFLOW:c@2 @0 @1)) @0)
- (if (TYPE_UNSIGNED (TREE_TYPE (@0))
- && types_match (TREE_TYPE (@0), TREE_TYPE (@1)))
- (out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); }))))
-/* A > A + B */
-(for cmp (gt le)
- out (ne eq)
- (simplify
- (cmp @0 (realpart (IFN_ADD_OVERFLOW:c@2 @0 @1)))
+ (cmp:c (realpart (IFN_ADD_OVERFLOW:c@2 @0 @1)) @0)
(if (TYPE_UNSIGNED (TREE_TYPE (@0))
&& types_match (TREE_TYPE (@0), TREE_TYPE (@1)))
(out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); }))))