@@ -6415,6 +6415,36 @@ find_replacement (rtx *loc)
return reloadreg;
}
+ else if (Pmode != ptr_mode
+ && !r->subreg_loc
+ && reloadreg
+ && (r->mode == Pmode || GET_MODE (reloadreg) == Pmode)
+ && REG_P (reloadreg)
+ && GET_CODE (*loc) == SUBREG
+ && REG_P (SUBREG_REG (*loc))
+ && REG_POINTER (SUBREG_REG (*loc))
+ && GET_MODE (*loc) == ptr_mode
+ && r->where == &SUBREG_REG (*loc))
+ {
+ int offset;
+
+ if (r->mode != VOIDmode && GET_MODE (reloadreg) != r->mode)
+ reloadreg = gen_rtx_REG (r->mode, REGNO (reloadreg));
+
+ if ((WORDS_BIG_ENDIAN || BYTES_BIG_ENDIAN)
+ && GET_MODE_SIZE (Pmode) > GET_MODE_SIZE (ptr_mode))
+ {
+ offset = GET_MODE_SIZE (Pmode) - GET_MODE_SIZE (ptr_mode);
+ if (! BYTES_BIG_ENDIAN)
+ offset = (offset / UNITS_PER_WORD) * UNITS_PER_WORD;
+ else if (! WORDS_BIG_ENDIAN)
+ offset %= UNITS_PER_WORD;
+ }
+ else
+ offset = 0;
+
+ return gen_rtx_SUBREG (ptr_mode, reloadreg, offset);
+ }
else if (reloadreg && r->subreg_loc == loc)
{
/* RELOADREG must be either a REG or a SUBREG.