>From 3480be32c5827d1d881374af406dd514dc25019f Mon Sep 17 00:00:00 2001
From: Kael Andrew Alonzo Franco <[email protected]>
Date: Sun, 26 Jul 2026 22:13:37 -0400
Subject: [PATCH] match: Combine two for into one for.

This simplifies r5-4683, r5-4899, and r6-2617.

Bootstrapped and regtested on x86_64-pc-linux-gnu.

gcc/ChangeLog:

        * match.pd: Combine two for into one for.

Signed-off-by: Kael Andrew Franco <[email protected]>
---
 gcc/match.pd | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 536d5125a0b..62d08093125 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2514,16 +2514,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (simplify
  (bit_and:c @0 (logical_inverted_value @0))
  { build_zero_cst (type); })
-/* X | !X and X ^ !X -> 1, , if X is truth-valued.  */
-(for op (bit_ior bit_xor)
- (simplify
-  (op:c truth_valued_p@0 (logical_inverted_value @0))
-  { constant_boolean_node (true, type); }))
-/* X ==/!= !X is false/true.  */
-(for op (eq ne)
+/* X | !X and X ^ !X -> 1, , if X is truth-valued.
+   X ==/!= !X is false/true.  */
+(for op (bit_ior bit_xor eq ne)
  (simplify
   (op:c truth_valued_p@0 (logical_inverted_value @0))
-  { constant_boolean_node (op == NE_EXPR ? true : false, type); }))
+  { constant_boolean_node (op == EQ_EXPR ? false : true, type); }))

 /* ~~x -> x */
 (simplify
-- 
2.55.0

Reply via email to