diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-26 16:26:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-26 16:26:43 +0000 |
commit | 5d5261c819fa2a203dc8d09c7bb71e041a12cd69 (patch) | |
tree | c5c1b47626ed98d5afe1bf01616fb4a2aceccc9a /lib/Target/README.txt | |
parent | f6ac4d9dadaa62959e04a0281e3bc5f4270fc260 (diff) | |
download | llvm-5d5261c819fa2a203dc8d09c7bb71e041a12cd69.tar.gz llvm-5d5261c819fa2a203dc8d09c7bb71e041a12cd69.tar.bz2 llvm-5d5261c819fa2a203dc8d09c7bb71e041a12cd69.tar.xz |
Teach basicaa that x|c == x+c when the c bits of x are clear. This
allows us to compile the example in readme.txt into:
LBB1_1: ## %bb
movl 4(%rdx,%rax), %ecx
movl %ecx, %esi
imull (%rdx,%rax), %esi
imull %esi, %ecx
movl %esi, 8(%rdx,%rax)
imull %ecx, %esi
movl %ecx, 12(%rdx,%rax)
movl %esi, 16(%rdx,%rax)
imull %ecx, %esi
movl %esi, 20(%rdx,%rax)
addq $16, %rax
cmpq $4000, %rax
jne LBB1_1
instead of:
LBB1_1:
movl (%rdx,%rax), %ecx
imull 4(%rdx,%rax), %ecx
movl %ecx, 8(%rdx,%rax)
imull 4(%rdx,%rax), %ecx
movl %ecx, 12(%rdx,%rax)
imull 8(%rdx,%rax), %ecx
movl %ecx, 16(%rdx,%rax)
imull 12(%rdx,%rax), %ecx
movl %ecx, 20(%rdx,%rax)
addq $16, %rax
cmpq $4000, %rax
jne LBB1_1
GCC (4.2) doesn't seem to be able to eliminate the loads in this
testcase either, it generates:
L2:
movl (%rdx), %eax
imull 4(%rdx), %eax
movl %eax, 8(%rdx)
imull 4(%rdx), %eax
movl %eax, 12(%rdx)
imull 8(%rdx), %eax
movl %eax, 16(%rdx)
imull 12(%rdx), %eax
movl %eax, 20(%rdx)
addl $4, %ecx
addq $16, %rdx
cmpl $1002, %ecx
jne L2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r-- | lib/Target/README.txt | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 3096f95ede..2db580824c 100644 --- a/lib/Target/README.txt +++ b/lib/Target/README.txt @@ -443,23 +443,6 @@ entry: //===---------------------------------------------------------------------===// -"basicaa" should know how to look through "or" instructions that act like add -instructions. For example in this code, the x*4+1 is turned into x*4 | 1, and -basicaa can't analyze the array subscript, leading to duplicated loads in the -generated code: - -void test(int X, int Y, int a[]) { -int i; - for (i=2; i<1000; i+=4) { - a[i+0] = a[i-1+0]*a[i-2+0]; - a[i+1] = a[i-1+1]*a[i-2+1]; - a[i+2] = a[i-1+2]*a[i-2+2]; - a[i+3] = a[i-1+3]*a[i-2+3]; - } -} - -//===---------------------------------------------------------------------===// - We should investigate an instruction sinking pass. Consider this silly example in pic mode: |