https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110717
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- To handle this in generic code, I think expand_expr_real_2 woiuld need to notice this case of << operand of arithmetic >> by same amount and tell that to expand_variable_shift -> expand_shift_1 -> expand_binop somehow. Wasn't there a proposal for SEXT_EXPR at some point?