aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/README.txt
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-02-21 00:22:02 +0000
committerCameron Zwarich <zwarich@apple.com>2011-02-21 00:22:02 +0000
commit8d7285d0e5eb5937a6682e884b883516377e903d (patch)
treeccf0591dff9fa8874d00e480674cd7e77c84bbdf /lib/Target/X86/README.txt
parent0b85d07d4611e7d704bf6550fbc624aff36a53b4 (diff)
The signed version of our "magic number" computation for the integer approximation
of a constant had a minor typo introduced when copying it from the book, which caused it to favor negative approximations over positive approximations in many cases. Positive approximations require fewer operations beyond the multiplication. In the case of division by 3, we still generate code that is a single instruction larger than GCC's code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126097 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README.txt')
-rw-r--r--lib/Target/X86/README.txt10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt
index c10e1709f6..ed3bff150b 100644
--- a/lib/Target/X86/README.txt
+++ b/lib/Target/X86/README.txt
@@ -1888,12 +1888,10 @@ Compiles to: $clang t.c -S -o - -O3 -mkernel -fomit-frame-pointer
_t: ## @t
movslq %edi, %rax
- imulq $-1431655765, %rax, %rcx ## imm = 0xFFFFFFFFAAAAAAAB
- shrq $32, %rcx
- addl %ecx, %eax
- movl %eax, %ecx
- shrl $31, %ecx
- shrl %eax
+ imulq $1431655766, %rax, %rax ## imm = 0x55555556
+ movq %rax, %rcx
+ shrq $63, %rcx
+ shrq $32, %rax
addl %ecx, %eax
movsbl %al, %eax
ret