summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-08-14 22:30:07 +0000
committerSanjay Patel <spatel@rotateright.com>2016-08-14 22:30:07 +0000
commit8554f70c072beda625c956ad0868f74c01de8636 (patch)
tree61faab8b65201f7c15e33b2559496e9b7a96039b
parentbeebe05af1499166da1382e2d21505bcd6739fb5 (diff)
downloadbcm5719-llvm-8554f70c072beda625c956ad0868f74c01de8636.tar.gz
bcm5719-llvm-8554f70c072beda625c956ad0868f74c01de8636.zip
[InstCombine] add test for potentially missing vector icmp fold
llvm-svn: 278636
-rw-r--r--llvm/test/Transforms/InstCombine/cast.ll21
1 files changed, 18 insertions, 3 deletions
diff --git a/llvm/test/Transforms/InstCombine/cast.ll b/llvm/test/Transforms/InstCombine/cast.ll
index 7b3c314ce76..8a89bb2dd26 100644
--- a/llvm/test/Transforms/InstCombine/cast.ll
+++ b/llvm/test/Transforms/InstCombine/cast.ll
@@ -350,12 +350,27 @@ define i1 @test31(i64 %A) {
; CHECK-NEXT: [[D:%.*]] = icmp eq i64 [[C]], 10
; CHECK-NEXT: ret i1 [[D]]
;
- %B = trunc i64 %A to i32 ; <i32> [#uses=1]
- %C = and i32 %B, 42 ; <i32> [#uses=1]
- %D = icmp eq i32 %C, 10 ; <i1> [#uses=1]
+ %B = trunc i64 %A to i32
+ %C = and i32 %B, 42
+ %D = icmp eq i32 %C, 10
ret i1 %D
}
+; FIXME: Vectors should fold too...or not?
+; Does this depend on the whether the source/dest types of the trunc are legal in the data layout?
+define <2 x i1> @test31vec(<2 x i64> %A) {
+; CHECK-LABEL: @test31vec(
+; CHECK-NEXT: [[B:%.*]] = trunc <2 x i64> %A to <2 x i32>
+; CHECK-NEXT: [[C:%.*]] = and <2 x i32> [[B]], <i32 42, i32 42>
+; CHECK-NEXT: [[D:%.*]] = icmp eq <2 x i32> [[C]], <i32 10, i32 10>
+; CHECK-NEXT: ret <2 x i1> [[D]]
+;
+ %B = trunc <2 x i64> %A to <2 x i32>
+ %C = and <2 x i32> %B, <i32 42, i32 42>
+ %D = icmp eq <2 x i32> %C, <i32 10, i32 10>
+ ret <2 x i1> %D
+}
+
define i32 @test33(i32 %c1) {
; CHECK-LABEL: @test33(
; CHECK-NEXT: ret i32 %c1
OpenPOWER on IntegriCloud