[InstCombine] add test for missing vector icmp fold
authorSanjay Patel <spatel@rotateright.com>
Sun, 14 Aug 2016 22:29:27 +0000 (22:29 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 14 Aug 2016 22:29:27 +0000 (22:29 +0000)
llvm-svn: 278635

llvm/test/Transforms/InstCombine/shift.ll

index 755c4a7..9edecba 100644 (file)
@@ -344,17 +344,29 @@ define i1 @test19(i32 %A) {
 }
 
 
+;; X >u ~4
 define i1 @test19a(i32 %A) {
 ; CHECK-LABEL: @test19a(
 ; CHECK-NEXT:    [[C:%.*]] = icmp ugt i32 %A, -5
 ; CHECK-NEXT:    ret i1 [[C]]
 ;
-  %B = ashr i32 %A, 2             ; <i32> [#uses=1]
-  ;; X >u ~4
-  %C = icmp eq i32 %B, -1         ; <i1> [#uses=1]
+  %B = ashr i32 %A, 2
+  %C = icmp eq i32 %B, -1
   ret i1 %C
 }
 
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test19a_vec(<2 x i32> %A) {
+; CHECK-LABEL: @test19a_vec(
+; CHECK-NEXT:    [[B:%.*]] = ashr <2 x i32> %A, <i32 2, i32 2>
+; CHECK-NEXT:    [[C:%.*]] = icmp eq <2 x i32> [[B]], <i32 -1, i32 -1>
+; CHECK-NEXT:    ret <2 x i1> [[C]]
+;
+  %B = ashr <2 x i32> %A, <i32 2, i32 2>
+  %C = icmp eq <2 x i32> %B, <i32 -1, i32 -1>
+  ret <2 x i1> %C
+}
+
 define i1 @test20(i8 %A) {
 ; CHECK-LABEL: @test20(
 ; CHECK-NEXT:    ret i1 false