@@ -4771,15 +4771,27 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type,
#ifdef LOAD_EXTEND_OP
&& !paradoxical_subreg_p (x)
#endif
- && (reg_equiv_address (regno) != 0
- || (reg_equiv_mem (regno) != 0
- && (! strict_memory_address_addr_space_p
- (GET_MODE (x), XEXP (reg_equiv_mem (regno), 0),
- MEM_ADDR_SPACE (reg_equiv_mem (regno)))
- || ! offsettable_memref_p (reg_equiv_mem (regno))
- || num_not_at_initial_offset))))
- x = find_reloads_subreg_address (x, 1, opnum, type, ind_levels,
- insn, address_reloaded);
+ )
+ {
+ if (reg_equiv_address (regno) != 0)
+ x = find_reloads_subreg_address (x, 1, opnum, type, ind_levels,
+ insn, address_reloaded);
+ else if (reg_equiv_mem (regno) != 0)
+ {
+ tem =
+ simplify_gen_subreg (GET_MODE (x), reg_equiv_mem (regno),
+ GET_MODE (SUBREG_REG (x)),
+ SUBREG_BYTE (x));
+ gcc_assert (tem);
+ if (MEM_P (tem)
+ && (!strict_memory_address_addr_space_p
+ (GET_MODE (x), tem, MEM_ADDR_SPACE (tem))
+ || !offsettable_memref_p (tem)
+ || num_not_at_initial_offset))
+ x = find_reloads_subreg_address (x, 1, opnum, type, ind_levels,
+ insn, address_reloaded);
+ }
+ }
}
for (copied = 0, i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)