[Bug rtl-optimization/90706] [10/11/12/13 Regression] Useless code generated for stack / register operations on AVR
gjl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun May 21 15:25:57 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90706
--- Comment #23 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 55130
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55130&action=edit
Test case for -Os -mmcu=attiny40
As it appears, this bug is not fixed completely. For the -mmcu=avrtiny
architecture, there is still bloat for even the smallest test cases like:
$ avr-gcc bloat.c -mmcu=attiny40 -Os -S
char func3 (char c)
{
return 1 + c;
}
"GCC: (GNU) 14.0.0 20230520 (experimental)" compiles this to:
func3:
push r28 ; 22 [c=4 l=1] pushqi1/0
push r29 ; 23 [c=4 l=1] pushqi1/0
push __tmp_reg__ ; 27 [c=4 l=1] *addhi3_sp
in r28,__SP_L__ ; 38 [c=4 l=2] *movhi/7
in r29,__SP_H__
/* prologue: function */
/* frame size = 1 */
/* stack size = 3 */
mov r20,r24 ; 18 [c=4 l=1] movqi_insn/0
subi r20,lo8(-(1)) ; 19 [c=4 l=1] *addqi3/1
mov r24,r20 ; 21 [c=4 l=1] movqi_insn/0
/* epilogue start */
pop __tmp_reg__ ; 33 [c=4 l=1] *addhi3_sp
pop r29 ; 34 [c=4 l=1] popqi
pop r28 ; 35 [c=4 l=1] popqi
ret ; 36 [c=0 l=1] return_from_epilogue
For reference, avr-gcc v8 generates for this function:
func3:
/* prologue: function */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
subi r24,lo8(-(1)) ; 6 [c=4 l=1] addqi3/1
/* epilogue start */
ret ; 17 [c=0 l=1] return
More information about the Gcc-bugs
mailing list