[llvm] r278717 - [InstCombine] add tests for missing vector icmp folds

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 12:16:33 PDT 2016


Author: spatel
Date: Mon Aug 15 14:16:33 2016
New Revision: 278717

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

Modified:
    llvm/trunk/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll
    llvm/trunk/test/Transforms/InstCombine/div.ll

Modified: llvm/trunk/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll?rev=278717&r1=278716&r2=278717&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll Mon Aug 15 14:16:33 2016
@@ -14,3 +14,15 @@ define i1 @test(i32 %tmp6) {
   ret i1 %1
 }
 
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test_vec(<2 x i32> %tmp6) {
+; CHECK-LABEL: @test_vec(
+; CHECK-NEXT:    [[TMP7:%.*]] = sdiv <2 x i32> %tmp6, <i32 12, i32 12>
+; CHECK-NEXT:    [[TMP1:%.*]] = icmp ne <2 x i32> [[TMP7]], <i32 -6, i32 -6>
+; CHECK-NEXT:    ret <2 x i1> [[TMP1]]
+;
+  %tmp7 = sdiv <2 x i32> %tmp6, <i32 12, i32 12>
+  icmp ne <2 x i32> %tmp7, <i32 -6, i32 -6>
+  ret <2 x i1> %1
+}
+

Modified: llvm/trunk/test/Transforms/InstCombine/div.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/div.ll?rev=278717&r1=278716&r2=278717&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/div.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/div.ll Mon Aug 15 14:16:33 2016
@@ -72,6 +72,18 @@ define i1 @test7(i32 %A) {
   ret i1 %C
 }
 
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test7vec(<2 x i32> %A) {
+; CHECK-LABEL: @test7vec(
+; CHECK-NEXT:    [[B:%.*]] = udiv <2 x i32> %A, <i32 10, i32 10>
+; CHECK-NEXT:    [[C:%.*]] = icmp eq <2 x i32> [[B]], <i32 2, i32 2>
+; CHECK-NEXT:    ret <2 x i1> [[C]]
+;
+  %B = udiv <2 x i32> %A, <i32 10, i32 10>
+  %C = icmp eq <2 x i32> %B, <i32 2, i32 2>
+  ret <2 x i1> %C
+}
+
 define i1 @test8(i8 %A) {
 ; CHECK-LABEL: @test8(
 ; CHECK-NEXT:    [[C:%.*]] = icmp ugt i8 %A, -11
@@ -83,6 +95,18 @@ define i1 @test8(i8 %A) {
   ret i1 %C
 }
 
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test8vec(<2 x i8> %A) {
+; CHECK-LABEL: @test8vec(
+; CHECK-NEXT:    [[B:%.*]] = udiv <2 x i8> %A, <i8 123, i8 123>
+; CHECK-NEXT:    [[C:%.*]] = icmp eq <2 x i8> [[B]], <i8 2, i8 2>
+; CHECK-NEXT:    ret <2 x i1> [[C]]
+;
+  %B = udiv <2 x i8> %A, <i8 123, i8 123>
+  %C = icmp eq <2 x i8> %B, <i8 2, i8 2>
+  ret <2 x i1> %C
+}
+
 define i1 @test9(i8 %A) {
 ; CHECK-LABEL: @test9(
 ; CHECK-NEXT:    [[C:%.*]] = icmp ult i8 %A, -10
@@ -94,6 +118,18 @@ define i1 @test9(i8 %A) {
   ret i1 %C
 }
 
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test9vec(<2 x i8> %A) {
+; CHECK-LABEL: @test9vec(
+; CHECK-NEXT:    [[B:%.*]] = udiv <2 x i8> %A, <i8 123, i8 123>
+; CHECK-NEXT:    [[C:%.*]] = icmp ne <2 x i8> [[B]], <i8 2, i8 2>
+; CHECK-NEXT:    ret <2 x i1> [[C]]
+;
+  %B = udiv <2 x i8> %A, <i8 123, i8 123>
+  %C = icmp ne <2 x i8> %B, <i8 2, i8 2>
+  ret <2 x i1> %C
+}
+
 define i32 @test10(i32 %X, i1 %C) {
 ; CHECK-LABEL: @test10(
 ; CHECK-NEXT:    [[R_V:%.*]] = select i1 %C, i32 6, i32 3




More information about the llvm-commits mailing list