Since r242907 there is a split for HI moved that might also split SP. This might lead to wrong code. Using -fdisable-rtl-split2 might do as a work-around.
Created attachment 43338 [details] Proposed patch against v7
Author: denisc Date: Wed Feb 7 09:59:52 2018 New Revision: 257440 URL: https://gcc.gnu.org/viewcvs?rev=257440&root=gcc&view=rev Log: PR target/84209 * config/avr/avr.h (GENERAL_REGNO_P, GENERAL_REG_P): New macros. * config/avr/avr.md: Only post-reload split REG-REG moves if either register is REGERAL_REG_P. Modified: trunk/gcc/ChangeLog trunk/gcc/config/avr/avr.h trunk/gcc/config/avr/avr.md
Author: denisc Date: Wed Mar 7 09:13:12 2018 New Revision: 258315 URL: https://gcc.gnu.org/viewcvs?rev=258315&root=gcc&view=rev Log: Backport from mainline 2018-02-07 Georg-Johann Lay <avr@gjlay.de> PR target/84209 * config/avr/avr.h (GENERAL_REGNO_P, GENERAL_REG_P): New macros. * config/avr/avr.md: Only post-reload split REG-REG moves if either register is GENERAL_REG_P. Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/config/avr/avr.h branches/gcc-7-branch/gcc/config/avr/avr.md
Fixed in v7.4+