http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46721
Summary: Unnecessary stack instructions are generated for SPU
when returning a struct
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
$ cat return.c
#include <spu_intrinsics.h>
struct s { qword qs; };
struct s f(qword i) {
return (struct s){i};
}
$ spu-elf-gcc return.c -std=c99 -c -S -o- -O3
.file "return.c"
.text
.align 3
.global f
.type f, @function
f:
stqd $sp,-48($sp)
ai $sp,$sp,-48
ai $sp,$sp,48
bi $lr
.size f, .-f
.ident "GCC: (Gentoo 4.5.1-r1 p1.3, pie-0.4.5) 4.5.1"
The three instructions referencing $sp are all redundant and should not be
generated. These appear to be generated whenever a function returns a struct.