[llvm] r278635 - [InstCombine] add test for missing vector icmp fold

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 14 15:29:27 PDT 2016


Author: spatel
Date: Sun Aug 14 17:29:27 2016
New Revision: 278635

URL: http://llvm.org/viewvc/llvm-project?rev=278635&view=rev
Log:
[InstCombine] add test for missing vector icmp fold

Modified:
    llvm/trunk/test/Transforms/InstCombine/shift.ll

Modified: llvm/trunk/test/Transforms/InstCombine/shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/shift.ll?rev=278635&r1=278634&r2=278635&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/shift.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/shift.ll Sun Aug 14 17:29:27 2016
@@ -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




More information about the llvm-commits mailing list