summaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-07 07:30:47 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-07 07:30:47 +0000
commit5819d47b46dc64aeb8eb5759f4560a99b8ed8afe (patch)
tree4acd58ee5cf0f663525e480405a65346172abaf2 /gcc/match.pd
parentfb587c648398fd8a348e1fd965df3f3208ec7f9f (diff)
downloadgcc-5819d47b46dc64aeb8eb5759f4560a99b8ed8afe.tar.gz
2016-06-07 Richard Biener <rguenther@suse.de>
PR middle-end/71423 * match.pd ((X | ~Y) -> Y <= X): Properly invert the comparison for signed ops. * gcc.dg/torture/pr71423.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237166 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 4d66243d78e..fe711159df9 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -900,12 +900,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(ne (bit_and:c (bit_not @0) @1) integer_zerop)
(if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
&& TYPE_PRECISION (TREE_TYPE (@1)) == 1)
- (lt @0 @1)))
+ (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
+ (lt @0 @1)
+ (gt @0 @1))))
(simplify
(ne (bit_ior:c (bit_not @0) @1) integer_zerop)
(if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
&& TYPE_PRECISION (TREE_TYPE (@1)) == 1)
- (le @0 @1)))
+ (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
+ (le @0 @1)
+ (ge @0 @1))))
/* ~~x -> x */
(simplify