diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index a49eefb34d43696d678b9e2c7a6b8e6af648aa84..a20a61c5dddbc80b23a9489d925a2c31b2163458 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -7744,8 +7744,9 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op, return NULL_RTX; if (outermode == innermostmode - && known_eq (byte, 0U) - && known_eq (SUBREG_BYTE (op), 0)) + && known_eq (byte, subreg_lowpart_offset (outermode, innermode)) + && known_eq (SUBREG_BYTE (op), + subreg_lowpart_offset (innermode, innermostmode))) return SUBREG_REG (op); /* Work out the memory offset of the final OUTERMODE value relative