https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096
--- Comment #9 from Xi Ruoyao <xry111 at mengyan1223 dot wang> --- Created attachment 53214 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53214&action=edit patch removing r13 from SIBCALL_REGS I'm testing this patch now. I suggest to apply this for trunk and gcc-12 branch first (as gcc-12 also miscompiles the test case). Then if the reordering of RA preference can improve performance, you may apply it later (and also adjust the changes in this patch again).