https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55212
--- Comment #139 from Oleg Endo <olegendo at gcc dot gnu.org> --- Created attachment 58859 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58859&action=edit testcase for attachment 58836 with -mno-lra (In reply to Kazumoto Kojima from comment #135) > Created attachment 58836 [details] > a trial patch for c#133 > > Simlar changes for extend<mode>si2 and mov<mode> which define new > insn_and_split to force hardware r0 reg for the problematic cases so as to > shorten r0 live range. > > * config/sh/sh.md (extend<mode>si2_short_mem_disp_z, > mov<mode>_store_mem_index): New insn_and_split patterns. > (extend<mode>si2, mov<mode>): Use them for LRA. The attached reproducer triggers R0 spill failures after applying attachment 58836 when compiling with -O2 -m4-single -mno-lra. It seems to compile OK with -mlra though (with or without the patch). The code generated with LRA seems worse (more instructions). If we decide to go down the path of adding the R0 clobbers to all those R0-problematic insns, then it is going to become incompatible with the old reload framework it seems. I'm not sure what's the overall plan there -- whether old reload and -mno-lra will be kept around for a while or whether it will be removed completely at once.