diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-09-20 03:38:48 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-09-20 03:38:48 +0000 |
| commit | 875ea0cdbdcfb8caca1ba6b42e3efd571cd004af (patch) | |
| tree | 3e442bab1ab51925c777dd92790a486bf8d1d1b5 /llvm/lib/Target/PowerPC/PPCISelLowering.cpp | |
| parent | cd3f6ff0e5f8880f414b771f925b9c8249735de3 (diff) | |
| download | bcm5719-llvm-875ea0cdbdcfb8caca1ba6b42e3efd571cd004af.tar.gz bcm5719-llvm-875ea0cdbdcfb8caca1ba6b42e3efd571cd004af.zip | |
Expand 64-bit shifts more optimally if we know that the high bit of the
shift amount is one or zero. For example, for:
long long foo1(long long X, int C) {
return X << (C|32);
}
long long foo2(long long X, int C) {
return X << (C&~32);
}
we get:
_foo1:
movb $31, %cl
movl 4(%esp), %edx
andb 12(%esp), %cl
shll %cl, %edx
xorl %eax, %eax
ret
_foo2:
movb $223, %cl
movl 4(%esp), %eax
movl 8(%esp), %edx
andb 12(%esp), %cl
shldl %cl, %eax, %edx
shll %cl, %eax
ret
instead of:
_foo1:
subl $4, %esp
movl %ebx, (%esp)
movb $32, %bl
movl 8(%esp), %eax
movl 12(%esp), %edx
movb %bl, %cl
orb 16(%esp), %cl
shldl %cl, %eax, %edx
shll %cl, %eax
xorl %ecx, %ecx
testb %bl, %bl
cmovne %eax, %edx
cmovne %ecx, %eax
movl (%esp), %ebx
addl $4, %esp
ret
_foo2:
subl $4, %esp
movl %ebx, (%esp)
movb $223, %cl
movl 8(%esp), %eax
movl 12(%esp), %edx
andb 16(%esp), %cl
shldl %cl, %eax, %edx
shll %cl, %eax
xorl %ecx, %ecx
xorb %bl, %bl
testb %bl, %bl
cmovne %eax, %edx
cmovne %ecx, %eax
movl (%esp), %ebx
addl $4, %esp
ret
llvm-svn: 30506
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCISelLowering.cpp')
0 files changed, 0 insertions, 0 deletions

