diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-12 20:58:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-12 20:58:32 +0000 |
commit | d0620d2773a9958420f9ae02a24b5a5ed3a713f2 (patch) | |
tree | a6197374361c2c7c5345b925148eb434b0c8b71a /llvm/lib/Support/CommandLine.cpp | |
parent | ce34aa8fd7e1f953217f992ba44a648613e749a7 (diff) | |
download | bcm5719-llvm-d0620d2773a9958420f9ae02a24b5a5ed3a713f2.tar.gz bcm5719-llvm-d0620d2773a9958420f9ae02a24b5a5ed3a713f2.zip |
Lower X%C into X/C+stuff. This allows the 'division by a constant' logic to
apply to rems as well as divs. This fixes PR945 and speeds up ReedSolomon
from 14.57s to 10.90s (which is now faster than gcc).
It compiles CodeGen/X86/rem.ll into:
_test1:
subl $4, %esp
movl %esi, (%esp)
movl $2155905153, %ecx
movl 8(%esp), %esi
movl %esi, %eax
imull %ecx
addl %esi, %edx
movl %edx, %eax
shrl $31, %eax
sarl $7, %edx
addl %eax, %edx
imull $255, %edx, %eax
subl %eax, %esi
movl %esi, %eax
movl (%esp), %esi
addl $4, %esp
ret
_test2:
movl 4(%esp), %eax
movl %eax, %ecx
sarl $31, %ecx
shrl $24, %ecx
addl %eax, %ecx
andl $4294967040, %ecx
subl %ecx, %eax
ret
_test3:
subl $4, %esp
movl %esi, (%esp)
movl $2155905153, %ecx
movl 8(%esp), %esi
movl %esi, %eax
mull %ecx
shrl $7, %edx
imull $255, %edx, %eax
subl %eax, %esi
movl %esi, %eax
movl (%esp), %esi
addl $4, %esp
ret
instead of div/idiv instructions.
llvm-svn: 30920
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions