The problem with the PR is that lower-subreg.c happily splits multi-byte moves from address spaces without knowing anything about the additional costs this is causing. The TARGET_MODE_DEPENDENT_ADDRESS_P hook cannot be used for 16-bit addresses because that hook is not sensitive to address spaces, but is is used for the 24-bit address space to avoid subreg lowering for PSImode. For the 16-bit address spaces the mov expander now assigns the address register by hand as post-increment. Luckily, post-increment is the only addressing mode that makes sense with the non-generic address spaces and there is no choice for the address register resp. addressing mode, anyway... This patch does not fix the PR issue, of course, it just avoids subreg lowering by using/pretending mode-dependent addresses. Ok for trunk? Johann PR rtl-optimization/52543 * config/avr/avr.c (avr_mode_dependent_address_p): New function. (TARGET_MODE_DEPENDENT_ADDRESS_P): New define. * config/avr/avr.md (unspec): Add UNSPEC_LPM. (load__libgcc): Use UNSPEC_LPM instead of MEM. (mov): For multi-byte move from non-generic 16-bit address spaces: Expand to use Z++ as address for inline code and use UNSPEC_LPM (Z) for code from libgcc. (load_libgcc): Remove expander. (split-lpmx): Remove split.