http://llvm.org/bugs/show_bug.cgi?id=10070
Summary: Needless sse spill/reload
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Register Allocator
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
The following code:
#include <math.h>
class gfxRect {
double x;
double y;
double width;
double height;
void RoundOut();
};
void gfxRect::RoundOut() {
double x0 = floor(x);
double y0 = floor(y);
double x1 = ceil(x+width);
double y1 = ceil(y+height);
x = x0;
y = y0;
width = x1 - x0;
height = y1 - y0;
}
compiles to the following with a needless spill/reload at the end:
movq %rdi, %rbx
movsd (%rbx), %xmm0
callq _floor
movsd %xmm0, -32(%rbp) ## 8-byte Spill
movsd 8(%rbx), %xmm0
callq _floor
movsd %xmm0, -24(%rbp) ## 8-byte Spill
movsd (%rbx), %xmm0
addsd 16(%rbx), %xmm0
callq _ceil
movsd %xmm0, -16(%rbp) ## 8-byte Spill
movsd 8(%rbx), %xmm0
addsd 24(%rbx), %xmm0
callq _ceil
movsd -32(%rbp), %xmm3 ## 8-byte Reload
movsd %xmm3, (%rbx)
movsd -24(%rbp), %xmm2 ## 8-byte Reload
movsd %xmm2, 8(%rbx)
movsd -16(%rbp), %xmm1 ## 8-byte Reload
subsd %xmm3, %xmm1
movsd %xmm1, -16(%rbp) ## 8-byte Spill
movsd -16(%rbp), %xmm1 ## 8-byte Reload
here ----^
movsd %xmm1, 16(%rbx)
subsd %xmm2, %xmm0
movsd %xmm0, 24(%rbx)
addq $24, %rsp
popq %rbx
popq %rbp
ret
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs