This reduces genmatch's C++ output and encloses the 4th loop
in INTEGRAL_TYPE_P (type) since the 3rd loop has an extra ).

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

        PR tree-optimization/59429

gcc/ChangeLog:

        * match.pd: Combine four loops into one loop for spaceship.

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

diff --git a/gcc/match.pd b/gcc/match.pd
index 51f825ec327..ea636251bee 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -246,18 +246,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    all possible spaceship combinations.  */
 #if GIMPLE
 (if (INTEGRAL_TYPE_P (type))
-  (for op (lt ne)
+ (for ltne (lt ne)
+      gtne (gt ne)
   (match (spaceship @0 @1)
-    (cond^ (le @0 @1) (negate (convert? (op @0 @1))) integer_onep)))
-  (for op (lt ne)
+   (cond^ (le @0 @1) (negate (convert? (ltne @0 @1))) integer_onep))
   (match (spaceship @0 @1)
-    (cond^ (le @1 @0) (convert? (op @1 @0)) integer_minus_onep)))
-  (for op (gt ne)
+    (cond^ (le @1 @0) (convert? (ltne @1 @0)) integer_minus_onep))
   (match (spaceship @0 @1)
-    (cond^ (ge @0 @1) (convert? (op @0 @1)) integer_minus_onep))))
-  (for op (gt ne)
+    (cond^ (ge @0 @1) (convert? (gtne @0 @1)) integer_minus_onep))
   (match (spaceship @0 @1)
-    (cond^ (ge @1 @0) (negate (convert? (op @1 @0))) integer_onep)))
+    (cond^ (ge @1 @0) (negate (convert? (gtne @1 @0))) integer_onep))))
 #endif
 
 /* Simplifications of operations with one constant operand and
-- 
2.55.0

Reply via email to