aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-26 22:14:59 +0000
committerChris Lattner <sabre@nondot.org>2010-08-26 22:14:59 +0000
commit26dbe7ec18740f642febcc738e628d921aafd079 (patch)
tree01e0d07d848ca5b8c7b637910d4abc981669e3ab /test/Transforms
parent1ab3f16f06698596716593a30545799688acccd7 (diff)
downloadexternal_llvm-26dbe7ec18740f642febcc738e628d921aafd079.zip
external_llvm-26dbe7ec18740f642febcc738e628d921aafd079.tar.gz
external_llvm-26dbe7ec18740f642febcc738e628d921aafd079.tar.bz2
optimize "integer extraction out of the middle of a vector" as produced
by SRoA. This is part of rdar://7892780, but needs another xform to expose this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/bitcast.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/bitcast.ll b/test/Transforms/InstCombine/bitcast.ll
index c248b5e..1089839 100644
--- a/test/Transforms/InstCombine/bitcast.ll
+++ b/test/Transforms/InstCombine/bitcast.ll
@@ -35,3 +35,28 @@ define float @test2(<2 x float> %A, <2 x i32> %B) {
; CHECK-NEXT: %add = fadd float %tmp24, %tmp4
; CHECK-NEXT: ret float %add
}
+
+; Optimize bitcasts that are extracting other elements of a vector. This
+; happens because of SRoA.
+; rdar://7892780
+define float @test3(<2 x float> %A, <2 x i64> %B) {
+ %tmp28 = bitcast <2 x float> %A to i64
+ %tmp29 = lshr i64 %tmp28, 32
+ %tmp23 = trunc i64 %tmp29 to i32
+ %tmp24 = bitcast i32 %tmp23 to float
+
+ %tmp = bitcast <2 x i64> %B to i128
+ %tmp1 = lshr i128 %tmp, 64
+ %tmp2 = trunc i128 %tmp1 to i32
+ %tmp4 = bitcast i32 %tmp2 to float
+
+ %add = fadd float %tmp24, %tmp4
+ ret float %add
+
+; CHECK: @test3
+; CHECK-NEXT: %tmp24 = extractelement <2 x float> %A, i32 1
+; CHECK-NEXT: bitcast <2 x i64> %B to <4 x float>
+; CHECK-NEXT: %tmp4 = extractelement <4 x float> {{.*}}, i32 2
+; CHECK-NEXT: %add = fadd float %tmp24, %tmp4
+; CHECK-NEXT: ret float %add
+}