diff options
author | Chris Lattner <sabre@nondot.org> | 2010-08-26 21:55:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-08-26 21:55:42 +0000 |
commit | e5a1426174986951a20ec6ffd119b77a24a65706 (patch) | |
tree | 99c5869da3d33eace7a8e473ac7333819a0aa805 /tools/llvm-diff/DifferenceEngine.h | |
parent | a6140a14444da1aa104f6ab7c40c5c920552f474 (diff) |
optimize bitcast(trunc(bitcast(x))) where the result is a float and 'x'
is a vector to be a vector element extraction. This allows clang to
compile:
struct S { float A, B, C, D; };
float foo(struct S A) { return A.A + A.B+A.C+A.D; }
into:
_foo: ## @foo
## BB#0: ## %entry
movd %xmm0, %rax
shrq $32, %rax
movd %eax, %xmm2
addss %xmm0, %xmm2
movapd %xmm1, %xmm3
addss %xmm2, %xmm3
movd %xmm1, %rax
shrq $32, %rax
movd %eax, %xmm0
addss %xmm3, %xmm0
ret
instead of:
_foo: ## @foo
## BB#0: ## %entry
movd %xmm0, %rax
movd %eax, %xmm0
shrq $32, %rax
movd %eax, %xmm2
addss %xmm0, %xmm2
movd %xmm1, %rax
movd %eax, %xmm1
addss %xmm2, %xmm1
shrq $32, %rax
movd %eax, %xmm0
addss %xmm1, %xmm0
ret
... eliminating half of the horribleness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112227 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-diff/DifferenceEngine.h')
0 files changed, 0 insertions, 0 deletions