diff options
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 9259dd4..cfe9697 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4787,10 +4787,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (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))) + && TYPE_UNSIGNED (TREE_TYPE (@0))) (cmp @1 @0)))) +/* Optimize A - B + -1 >= A into B >= A for unsigned comparisons. */ +(for cmp (ge lt) + (simplify + (cmp:c (plus (minus @0 @1) integer_minus_onep) @0) + (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) + && TYPE_UNSIGNED (TREE_TYPE (@0))) + (cmp @1 @0)))) + /* Testing for overflow is unnecessary if we already know the result. */ /* A - B > A */ (for cmp (gt le) |