aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorNadav Rotem <nadav.rotem@intel.com>2011-08-29 19:58:36 +0000
committerNadav Rotem <nadav.rotem@intel.com>2011-08-29 19:58:36 +0000
commit89879ec76b5d81b0cc82e9f402dfe7c4cc63b0d6 (patch)
tree63b76e1c8cfe9857bd47b0b7aa99da40baace8dd /test/Transforms
parent0da10cf44d0f22111dae728bb535ade2283d976b (diff)
downloadexternal_llvm-89879ec76b5d81b0cc82e9f402dfe7c4cc63b0d6.zip
external_llvm-89879ec76b5d81b0cc82e9f402dfe7c4cc63b0d6.tar.gz
external_llvm-89879ec76b5d81b0cc82e9f402dfe7c4cc63b0d6.tar.bz2
Fixes following the CR by Chris and Duncan:
Optimize chained bitcasts of the form A->B->A. Undo r138722 and change isEliminableCastPair to allow this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/cast.ll39
1 files changed, 36 insertions, 3 deletions
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll
index 06cdae2..19d5a0a 100644
--- a/test/Transforms/InstCombine/cast.ll
+++ b/test/Transforms/InstCombine/cast.ll
@@ -632,15 +632,48 @@ entry:
define <4 x float> @test64(<4 x float> %c) nounwind {
%t0 = bitcast <4 x float> %c to <4 x i32>
- %t1 = bitcast <4 x i32> %t0 to <2 x double>
- %t2 = bitcast <2 x double> %t1 to <4 x float>
- ret <4 x float> %t2
+ %t1 = bitcast <4 x i32> %t0 to <4 x float>
+ ret <4 x float> %t1
; CHECK: @test64
; CHECK-NEXT: ret <4 x float> %c
}
+define <4 x float> @test65(<4 x float> %c) nounwind {
+ %t0 = bitcast <4 x float> %c to <2 x double>
+ %t1 = bitcast <2 x double> %t0 to <4 x float>
+ ret <4 x float> %t1
+; CHECK: @test65
+; CHECK-NEXT: ret <4 x float> %c
+}
+
+define <2 x float> @test66(<2 x float> %c) nounwind {
+ %t0 = bitcast <2 x float> %c to double
+ %t1 = bitcast double %t0 to <2 x float>
+ ret <2 x float> %t1
+; CHECK: @test66
+; CHECK-NEXT: ret <2 x float> %c
+}
+
define float @test2c() {
ret float extractelement (<2 x float> bitcast (double bitcast (<2 x float> <float -1.000000e+00, float -1.000000e+00> to double) to <2 x float>), i32 0)
; CHECK: @test2c
; CHECK-NOT: extractelement
}
+
+define i64 @test_mmx(<2 x i32> %c) nounwind {
+ %A = bitcast <2 x i32> %c to x86_mmx
+ %B = bitcast x86_mmx %A to <2 x i32>
+ %C = bitcast <2 x i32> %B to i64
+ ret i64 %C
+; CHECK: @test_mmx
+; CHECK-NOT: x86_mmx
+}
+
+define i64 @test_mmx_const(<2 x i32> %c) nounwind {
+ %A = bitcast <2 x i32> zeroinitializer to x86_mmx
+ %B = bitcast x86_mmx %A to <2 x i32>
+ %C = bitcast <2 x i32> %B to i64
+ ret i64 %C
+; CHECK: @test_mmx_const
+; CHECK-NOT: x86_mmx
+}