http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48609
Summary: Inefficient complex float store
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Target: x86_64
[hjl@gnu-6 pr1000]$ cat s2.i
typedef _Complex float SCtype;
extern SCtype bar;
void
foo (SCtype x)
{
bar = x;
}
[hjl@gnu-6 pr1000]$ /usr/gcc-4.7/bin/gcc -S -O2 s2.i
[hjl@gnu-6 pr1000]$ cat s2.s
.file "s2.i"
.text
.p2align 4,,15
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movq %xmm0, -8(%rsp)
movl -8(%rsp), %eax
movl %eax, bar(%rip)
movl -4(%rsp), %eax
movl %eax, bar+4(%rip)
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
We should simply do
movq %xmm0, bar(%rip)