https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119287
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- tree_nop_conversion_p certainly doesn't imply the two types are compatible types. So, I think we should go with --- gcc/match.pd.jj 2025-03-13 14:05:09.689017389 +0100 +++ gcc/match.pd 2025-03-14 12:13:02.563169756 +0100 @@ -5284,7 +5284,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) || tree_int_cst_sgn (@2) >= 0) && wi::to_wide (@3) == wi::set_bit_in_zero (shift, prec)) (with { auto mask = wide_int::from (wi::to_wide (@2), prec, UNSIGNED); } - (bit_and @0 { wide_int_to_tree (type, mask << shift); })))))) + (bit_and (convert @0) { wide_int_to_tree (type, mask << shift); })))))) /* ~(~X >> Y) -> X >> Y (for arithmetic shift). */ (simplify