https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123544
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think we want at least
--- gcc/simplify-rtx.cc.jj 2026-01-12 10:06:41.385871794 +0100
+++ gcc/simplify-rtx.cc 2026-01-13 17:50:20.772201337 +0100
@@ -4193,7 +4193,9 @@ simplify_context::simplify_binary_operat
Keeps shift and AND in the same mode, improving recognition.
Only applied when subreg is a lowpart, shift is valid,
and no precision is lost. */
- if (SUBREG_P (op0) && subreg_lowpart_p (op0)
+ if (SUBREG_P (op0)
+ && subreg_lowpart_p (op0)
+ && !paradoxical_subreg_p (op0)
&& GET_CODE (XEXP (op0, 0)) == LSHIFTRT
/* simplify_subreg asserts the object being accessed is not
VOIDmode or BLKmode. We may have a REG_EQUAL note which
because when the subreg is paradoxical, it suffers exactly from the problem
I've described.