diff options
author | Chris Lattner <sabre@nondot.org> | 2004-04-06 04:55:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-04-06 04:55:43 +0000 |
commit | 6c3bf13fceeca60947d7ff2325b3f5fb1bcd5884 (patch) | |
tree | 5f22874b3290d015f61871cb2d32782ee6d71507 /llvm/tools/gccld/GenerateCode.cpp | |
parent | 1f6024cbbeaf58280fb641c14e942d99c4df21a8 (diff) | |
download | bcm5719-llvm-6c3bf13fceeca60947d7ff2325b3f5fb1bcd5884.tar.gz bcm5719-llvm-6c3bf13fceeca60947d7ff2325b3f5fb1bcd5884.zip |
Handle various other important cases of multiplying a long constant immediate. For
example, multiplying X*(1 + (1LL << 32)) now produces:
test:
mov %ECX, DWORD PTR [%ESP + 4]
mov %EDX, DWORD PTR [%ESP + 8]
mov %EAX, %ECX
add %EDX, %ECX
ret
[[[Note to Alkis: why isn't linear scan generating this code?? This might be a
problem with your intervals being too conservative:
test:
mov %EAX, DWORD PTR [%ESP + 4]
mov %EDX, DWORD PTR [%ESP + 8]
add %EDX, %EAX
ret
end note]]]
Whereas GCC produces this:
T:
sub %esp, 12
mov %edx, DWORD PTR [%esp+16]
mov DWORD PTR [%esp+8], %edi
mov %ecx, DWORD PTR [%esp+20]
xor %edi, %edi
mov DWORD PTR [%esp], %ebx
mov %ebx, %edi
mov %eax, %edx
mov DWORD PTR [%esp+4], %esi
add %ebx, %edx
mov %edi, DWORD PTR [%esp+8]
lea %edx, [%ecx+%ebx]
mov %esi, DWORD PTR [%esp+4]
mov %ebx, DWORD PTR [%esp]
add %esp, 12
ret
I'm not sure example what GCC is smoking here, but it looks like it has just
confused itself with a bunch of stack slots or something. The intel compiler
is better, but still not good:
T:
movl 4(%esp), %edx #2.11
movl 8(%esp), %eax #2.11
lea (%eax,%edx), %ecx #3.12
movl $1, %eax #3.12
mull %edx #3.12
addl %ecx, %edx #3.12
ret #3.12
llvm-svn: 12693
Diffstat (limited to 'llvm/tools/gccld/GenerateCode.cpp')
0 files changed, 0 insertions, 0 deletions