summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2015-11-19 21:32:25 +0000
committerSanjay Patel <spatel@rotateright.com>2015-11-19 21:32:25 +0000
commitf1c2370c48cd00ae0f35cc2dcd10c762414792d1 (patch)
treee7b7bff521adc2df8798a7061be7d32ef4610c6c /llvm/test/Transforms
parent3190d17b12bba944d86b3c59c5b86878241f9691 (diff)
downloadbcm5719-llvm-f1c2370c48cd00ae0f35cc2dcd10c762414792d1.tar.gz
bcm5719-llvm-f1c2370c48cd00ae0f35cc2dcd10c762414792d1.zip
[InstCombine] add tests to show missing bitcast optimizations
llvm-svn: 253602
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/bitcast.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/bitcast.ll b/llvm/test/Transforms/InstCombine/bitcast.ll
index 579839e4245..2a8194e5303 100644
--- a/llvm/test/Transforms/InstCombine/bitcast.ll
+++ b/llvm/test/Transforms/InstCombine/bitcast.ll
@@ -64,6 +64,35 @@ define float @test3(<2 x float> %A, <2 x i64> %B) {
; CHECK-NEXT: ret float %add
}
+; TODO: Both bitcasts are unnecessary; change the extractelement.
+
+define float @bitcast_extelt1(<2 x float> %A) {
+ %bc1 = bitcast <2 x float> %A to <2 x i32>
+ %ext = extractelement <2 x i32> %bc1, i32 0
+ %bc2 = bitcast i32 %ext to float
+ ret float %bc2
+
+; CHECK-LABEL: @bitcast_extelt1(
+; CHECK-NEXT: %bc1 = bitcast <2 x float> %A to <2 x i32>
+; CHECK-NEXT: %ext = extractelement <2 x i32> %bc1, i32 0
+; CHECK-NEXT: %bc2 = bitcast i32 %ext to float
+; CHECK-NEXT: ret float %bc2
+}
+
+; TODO: Second bitcast can be folded into the first.
+
+define i64 @bitcast_extelt2(<4 x float> %A) {
+ %bc1 = bitcast <4 x float> %A to <2 x double>
+ %ext = extractelement <2 x double> %bc1, i32 1
+ %bc2 = bitcast double %ext to i64
+ ret i64 %bc2
+
+; CHECK-LABEL: @bitcast_extelt2(
+; CHECK-NEXT: %bc1 = bitcast <4 x float> %A to <2 x double>
+; CHECK-NEXT: %ext = extractelement <2 x double> %bc1, i32 1
+; CHECK-NEXT: %bc2 = bitcast double %ext to i64
+; CHECK-NEXT: ret i64 %bc2
+}
define <2 x i32> @test4(i32 %A, i32 %B){
%tmp38 = zext i32 %A to i64
OpenPOWER on IntegriCloud