https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106594
--- Comment #19 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- I completely agree with comment 18. See: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601472.html for some more on a similar theme. make_compound_operation_int already has code to convert (and (subreg X) (const_int N)) into (zero_extend X) when nonzero_bits indicates that that's safe. I think the AArch64 regression can be fixed by extending that to: (and (mult (subreg x) (const_int N2)) (const_int N)) -> (mult (sign_extend X) (const_int N2)) for power-of-N2, with the nonzero_bits test adjusted for N2. (mult is the canonical form here, since it's part of an address.) Testing a patch for that. Hopefully that should be less risky than changing the expand/make_compound_operation dance in stage 4.