https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117420

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Anyway, I think
--- gcc/match.pd.jj     2024-11-18 12:21:10.449236948 +0100
+++ gcc/match.pd        2024-11-21 14:54:55.103437245 +0100
@@ -4952,7 +4952,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 #if GIMPLE
 /* (X >> C1) << (C1 + C2) -> X << C2 if the low C1 bits of X are zero.  */
 (simplify
- (lshift (convert? (rshift (with_possible_nonzero_bits2 @0) INTEGER_CST@1))
+ (lshift (convert? (rshift with_possible_nonzero_bits@0 INTEGER_CST@1))
          INTEGER_CST@2)
  (if (INTEGRAL_TYPE_P (type)
       && wi::ltu_p (wi::to_wide (@1), element_precision (type))
@@ -4963,7 +4963,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)

 /* (X >> C1) * (C2 << C1) -> X * C2 if the low C1 bits of X are zero.  */
 (simplify
- (mult (convert? (rshift (with_possible_nonzero_bits2 @0) INTEGER_CST@1))
+ (mult (convert? (rshift with_possible_nonzero_bits2@0 INTEGER_CST@1))
        poly_int_tree_p@2)
  (with { poly_widest_int factor; }
   (if (INTEGRAL_TYPE_P (type)
@@ -5538,7 +5538,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 #if GIMPLE
 /* X / (1 << C) -> X /[ex] (1 << C) if the low C bits of X are clear.  */
 (simplify
- (trunc_div (with_possible_nonzero_bits2 @0) integer_pow2p@1)
+ (trunc_div with_possible_nonzero_bits@0 integer_pow2p@1)
  (if (INTEGRAL_TYPE_P (type)
       && !TYPE_UNSIGNED (type)
       && wi::multiple_of_p (get_nonzero_bits (@0), wi::to_wide (@1), SIGNED))
should be the first step, fixing wrong-code issues rather than trying to
optimize further what we had for years.

Reply via email to