https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110093
--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- Meanwhile (2023-08-22) the generated code from above got worse once again and even pops a frame: long add (long aa, long bb, long cc) { if (cc < 0) return aa - cc; return aa + bb; } > avr-gcc -Os -S -dp add: push r4 ; 83 [c=4 l=1] pushqi1/0 push r5 ; 84 [c=4 l=1] pushqi1/0 push r6 ; 85 [c=4 l=1] pushqi1/0 push r7 ; 86 [c=4 l=1] pushqi1/0 push r8 ; 87 [c=4 l=1] pushqi1/0 push r9 ; 88 [c=4 l=1] pushqi1/0 push r10 ; 89 [c=4 l=1] pushqi1/0 push r11 ; 90 [c=4 l=1] pushqi1/0 push r14 ; 91 [c=4 l=1] pushqi1/0 push r15 ; 92 [c=4 l=1] pushqi1/0 push r16 ; 93 [c=4 l=1] pushqi1/0 push r17 ; 94 [c=4 l=1] pushqi1/0 push r28 ; 95 [c=4 l=1] pushqi1/0 push r29 ; 96 [c=4 l=1] pushqi1/0 ; SP -= 4 ; 100 [c=4 l=2] *addhi3_sp rcall . rcall . in r28,__SP_L__ ; 126 [c=4 l=2] *movhi/7 in r29,__SP_H__ /* prologue: function */ /* frame size = 4 */ /* stack size = 18 */ .L__stack_usage = 18 mov r8,r22 ; 69 [c=4 l=1] movqi_insn/0 mov r9,r23 ; 70 [c=4 l=1] movqi_insn/0 mov r10,r24 ; 71 [c=4 l=1] movqi_insn/0 mov r11,r25 ; 72 [c=4 l=1] movqi_insn/0 std Y+1,r18 ; 73 [c=4 l=1] movqi_insn/2 std Y+2,r19 ; 74 [c=4 l=1] movqi_insn/2 std Y+3,r20 ; 75 [c=4 l=1] movqi_insn/2 std Y+4,r21 ; 76 [c=4 l=1] movqi_insn/2 mov r4,r14 ; 77 [c=4 l=1] movqi_insn/0 mov r5,r15 ; 78 [c=4 l=1] movqi_insn/0 mov r6,r16 ; 79 [c=4 l=1] movqi_insn/0 mov r7,r17 ; 80 [c=4 l=1] movqi_insn/0 sbrs r7,7 ; 123 [c=4 l=2] *sbrx_branchhi rjmp .L2 mov r25,r11 ; 67 [c=4 l=4] *movsi/0 mov r24,r10 mov r23,r9 mov r22,r8 sub r22,r4 ; 68 [c=16 l=4] *subsi3/0 sbc r23,r5 sbc r24,r6 sbc r25,r7 .L1: /* epilogue start */ ; SP += 4 ; 106 [c=4 l=4] *addhi3_sp pop __tmp_reg__ pop __tmp_reg__ pop __tmp_reg__ pop __tmp_reg__ pop r29 ; 107 [c=4 l=1] popqi pop r28 ; 108 [c=4 l=1] popqi pop r17 ; 109 [c=4 l=1] popqi pop r16 ; 110 [c=4 l=1] popqi pop r15 ; 111 [c=4 l=1] popqi pop r14 ; 112 [c=4 l=1] popqi pop r11 ; 113 [c=4 l=1] popqi pop r10 ; 114 [c=4 l=1] popqi pop r9 ; 115 [c=4 l=1] popqi pop r8 ; 116 [c=4 l=1] popqi pop r7 ; 117 [c=4 l=1] popqi pop r6 ; 118 [c=4 l=1] popqi pop r5 ; 119 [c=4 l=1] popqi pop r4 ; 120 [c=4 l=1] popqi ret ; 121 [c=0 l=1] return_from_epilogue .L2: ldd r22,Y+1 ; 65 [c=16 l=4] *movsi/2 ldd r23,Y+2 ldd r24,Y+3 ldd r25,Y+4 add r22,r8 ; 66 [c=16 l=4] *addsi3/0 adc r23,r9 adc r24,r10 adc r25,r11 rjmp .L1 ; 124 [c=4 l=1] jump .ident "GCC: (GNU) 14.0.0 20230822 (experimental)"