https://gcc.gnu.org/g:5feba8293972ebc07251a0251b21f8644000334a

commit r17-4489-g5feba8293972ebc07251a0251b21f8644000334a
Author: Andrea Pinski <[email protected]>
Date:   Sat Sep 19 14:43:53 2026 -0700

    match: Use tcc_comparison directly in one more place
    
    Instead of a for loop for, we can just use tcc_comparison
    directly.  This changes the output of genmatch slightly
    but no functional changes are here.  This simplifies
    the pattern to easier to understand really.
    
    Bootstrapped and tested on x86_64-linux-gnu.
    
    gcc/ChangeLog:
    
            * match.pd (`CMP * a`): Use tcc_comparison directly.
            (`(type)CMP * a`): Likewise.
    
    Signed-off-by: Andrea Pinski <[email protected]>

Diff:
---
 gcc/match.pd | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 0dc0abe454f6..0e96727083f7 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -3035,19 +3035,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
 /* (m1 CMP m2) * d -> (m1 CMP m2) ? d : 0  */
 (if (fold_before_rtl_expansion_p ())
- (for cmp (tcc_comparison)
-  (simplify
-   (mult:c (convert (cmp@0 @1 @2)) @3)
-   (if (INTEGRAL_TYPE_P (type)
-       && INTEGRAL_TYPE_P (TREE_TYPE (@0)))
-     (cond @0 @3 { build_zero_cst (type); })))
+ (simplify
+  (mult:c (convert (tcc_comparison@0 @1 @2)) @3)
+  (if (INTEGRAL_TYPE_P (type)
+       && INTEGRAL_TYPE_P (TREE_TYPE (@0)))
+   (cond @0 @3 { build_zero_cst (type); })))
 /* (-(m1 CMP m2)) & d -> (m1 CMP m2) ? d : 0  */
-  (simplify
-   (bit_and:c (negate (convert (cmp@0 @1 @2))) @3)
-   (if (INTEGRAL_TYPE_P (type)
-       && INTEGRAL_TYPE_P (TREE_TYPE (@0)))
-     (cond @0 @3 { build_zero_cst (type); })))
- )
+ (simplify
+  (bit_and:c (negate (convert (tcc_comparison@0 @1 @2))) @3)
+  (if (INTEGRAL_TYPE_P (type)
+       && INTEGRAL_TYPE_P (TREE_TYPE (@0)))
+   (cond @0 @3 { build_zero_cst (type); })))
 )
 
 /* Canonicalize `(type) (a CMP b)` to `(a CMP b) ? (type) true : (type) false`

Reply via email to