]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
match: disable some match patterns for non GIMPLE
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sat, 13 Dec 2025 04:17:00 +0000 (20:17 -0800)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sat, 13 Dec 2025 10:32:43 +0000 (02:32 -0800)
This disables some match (not the simplify one) patterns
for non-GIMPLE. All of the saturation related match patterns,
the clz/popcount related match patterns that are used from forwardprop.
Also cond_expr_convert_p and bitwise_induction_p match patterns.

These are only used from outside of match and simplify and only the
gimple form so there is no reason to generate the GENERIC form of
this.

THis should speed up bootstrap slightly by not generating or compiling
them. This should (when compiled without LTO) also improve the overall
size of the built binaries too.

For GCC 17, I am thinking about moving the gimple only simplify and match
patterns to their own file as match.pd is getting too big to search for
patterns.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* match.pd: Disable a few match patterns for !GIMPLE.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/match.pd

index bf410a75f5f858d236f5ab933f34ef7500997e6d..a52cef3e6266bee50584ac55826ce46ad5e39b7f 100644 (file)
@@ -3273,6 +3273,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        || POINTER_TYPE_P (itype))
       && wi::eq_p (wi::to_wide (int_cst), wi::max_value (itype))))))
 
+#if GIMPLE
 /* Saturation add for unsigned integer.  */
 (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type))
  (match (usadd_overflow_mask @0 @1)
@@ -3814,6 +3815,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
      }
      (if (c2_is_max_p)))))
 )
+#endif
 
 /* The boundary condition for case 10: IMM = 1:
    SAT_U_SUB = X >= IMM ? (X - IMM) : 0.
@@ -11765,6 +11767,7 @@ and,
          (vec_perm @2 @5 { op0; })))))))))))
 
 
+#if GIMPLE
 /* Match count trailing zeroes for simplify_count_zeroes in forwprop.
    The canonical form is array[((x & -x) * C) >> SHIFT] where C is a magic
    constant which when multiplied by a power of 2 contains a unique value
@@ -11912,6 +11915,8 @@ and,
  (bit_not
   (nop_convert1? (bit_xor@0 (convert2? (lshift integer_onep@1 @2)) @3))))
 
+#endif
+
 /* n - (((n > C1) ? n : C1) & -C2) ->  n & C1 for unsigned case.
    n - (((n > C1) ? n : C1) & -C2) ->  (n <= C1) ? n : (n & C1) for signed case.  */
 (simplify