https://gcc.gnu.org/g:858c0a7b77424f795684773f80c04a6a5199efbd

commit r17-5544-g858c0a7b77424f795684773f80c04a6a5199efbd
Author: Igor Shevlyakov <[email protected]>
Date:   Thu Oct 22 20:16:44 2026 -0700

    match.pd: Remove the ORDERED & NE to LTGT fold [PR127785]
    
    The rule is not needed: the generic (a CMP b) & (a CMP b) pattern
    already combines these comparisons through combine_comparisons, which
    gives LTGT with -fno-trapping-math, NE when NaNs are not honored, and
    keeps the two comparisons apart under the default flags because LTGT
    would trap where neither ORDERED nor NE does.  So remove it.
    
    Assisted-by: Claude Opus 5.5
    
            PR middle-end/127785
    
    gcc/ChangeLog:
    
            * match.pd ((ordered @0 @1) & (ne @0 @1)): Remove.
    
    Suggested-by: Andrea Pinski <[email protected]>
    Signed-off-by: Igor Shevlyakov <[email protected]>

Diff:
---
 gcc/match.pd | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 20bdd8beda3a..696e69fd980c 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -8288,11 +8288,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (ltgt @0 @0)
  (if (!flag_trapping_math || !tree_expr_maybe_nan_p (@0))
   { constant_boolean_node (false, type); }))
-/* LTGT raises an exception for a quiet NaN, ORDERED and NE do not.  */
-(simplify
- (bit_and:c (ordered @0 @1) (ne @0 @1))
- (if (!flag_trapping_math || !HONOR_NANS (@0))
-  (ltgt @0 @1)))
 
 /* x == ~x -> false */
 /* x != ~x -> true */

Reply via email to