From: Kael Andrew Alonzo Franco Date: Sun, 2 Aug 2026 11:53:39 +0000 (-0400) Subject: match: Combine four fors into one for. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=092e382942aeb24a949caa35512f8a4e613e234e;p=thirdparty%2Fgcc.git match: Combine four fors into one for. This reduce genmatch's outputted C++ code. Bootstrapped and tested on x86_64-pc-linux-gnu. PR tree-optimization/117760 PR tree-optimization/125442 gcc/ChangeLog: * match.pd: Combine four fors into one for. --- diff --git a/gcc/match.pd b/gcc/match.pd index eb9eac600d0..2731456ba10 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -6883,30 +6883,23 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (a != b) | ((a|b) != 0) -> ((a|b) != 0) (a != b) & ((a|b) == 0) -> false - (a == b) | ((a|b) != 0) -> true */ + (a == b) | ((a|b) != 0) -> true + + (a == 0) | ((a | b) == 0) -> (a == 0) + (a != 0) & ((a | b) != 0) -> (a != 0) */ (for bitop (bit_and bit_ior) neeq (ne eq) + eqne (eq ne) (simplify (bitop:c (neeq @0 @1) (neeq (bit_ior @0 @1) integer_zerop)) - (neeq @0 @1))) -(for bitop (bit_and bit_ior) - neeq (eq ne) + (neeq @0 @1)) (simplify - (bitop:c (neeq @0 @1) (neeq (bit_ior@2 @0 @1) integer_zerop@3)) - (neeq @2 @3))) -(for bitop (bit_and bit_ior) - neeql (ne eq) - neeqr (eq ne) + (bitop:c (eqne @0 @1) (eqne (bit_ior@2 @0 @1) integer_zerop@3)) + (neeq @2 @3)) + (simplify + (bitop (neeq @0 @1) (eqne (bit_ior @0 @1) integer_zerop)) + { constant_boolean_node (bitop == BIT_IOR_EXPR, type); }) (simplify - (bitop (neeql @0 @1) (neeqr (bit_ior @0 @1) integer_zerop)) - { constant_boolean_node (bitop == BIT_IOR_EXPR, type); })) - -/* (a == 0) | ((a | b) == 0) -> (a == 0) -- PR125442 - (a != 0) & ((a | b) != 0) -> (a != 0) -- PR125442 */ - -(for bitop (bit_and bit_ior) - neeq (ne eq) -(simplify (bitop:c (neeq@2 @0 integer_zerop) (neeq (bit_ior:c @0 @1) integer_zerop)) @2)) #endif