[llvm] r340144 - [InstCombine] Add test cases for an icmp combine that is missing support for splat vector constants.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 19 11:03:34 PDT 2018


Author: ctopper
Date: Sun Aug 19 11:03:34 2018
New Revision: 340144

URL: http://llvm.org/viewvc/llvm-project?rev=340144&view=rev
Log:
[InstCombine] Add test cases for an icmp combine that is missing support for splat vector constants.

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

Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=340144&r1=340143&r2=340144&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Sun Aug 19 11:03:34 2018
@@ -99,6 +99,17 @@ define i1 @test7(i32 %x) {
   ret i1 %b
 }
 
+define <2 x i1> @test7_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test7_vec(
+; CHECK-NEXT:    [[A:%.*]] = add <2 x i32> [[X:%.*]], <i32 -1, i32 -1>
+; CHECK-NEXT:    [[B:%.*]] = icmp ult <2 x i32> [[A]], [[X]]
+; CHECK-NEXT:    ret <2 x i1> [[B]]
+;
+  %a = add <2 x i32> %x, <i32 -1, i32 -1>
+  %b = icmp ult <2 x i32> %a, %x
+  ret <2 x i1> %b
+}
+
 define i1 @test8(i32 %x) {
 ; CHECK-LABEL: @test8(
 ; CHECK-NEXT:    ret i1 false
@@ -108,6 +119,15 @@ define i1 @test8(i32 %x) {
   ret i1 %b
 }
 
+define <2 x i1> @test8_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test8_vec(
+; CHECK-NEXT:    ret <2 x i1> zeroinitializer
+;
+  %a = add <2 x i32> %x, <i32 -1, i32 -1>
+  %b = icmp eq <2 x i32> %a, %x
+  ret <2 x i1> %b
+}
+
 define i1 @test9(i32 %x) {
 ; CHECK-LABEL: @test9(
 ; CHECK-NEXT:    [[B:%.*]] = icmp ugt i32 %x, 1
@@ -118,6 +138,17 @@ define i1 @test9(i32 %x) {
   ret i1 %b
 }
 
+define <2 x i1> @test9_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test9_vec(
+; CHECK-NEXT:    [[A:%.*]] = add <2 x i32> [[X:%.*]], <i32 -2, i32 -2>
+; CHECK-NEXT:    [[B:%.*]] = icmp ult <2 x i32> [[A]], [[X]]
+; CHECK-NEXT:    ret <2 x i1> [[B]]
+;
+  %a = add <2 x i32> %x, <i32 -2, i32 -2>
+  %b = icmp ugt <2 x i32> %x, %a
+  ret <2 x i1> %b
+}
+
 define i1 @test10(i32 %x) {
 ; CHECK-LABEL: @test10(
 ; CHECK-NEXT:    [[B:%.*]] = icmp ne i32 %x, -2147483648
@@ -128,6 +159,17 @@ define i1 @test10(i32 %x) {
   ret i1 %b
 }
 
+define <2 x i1> @test10_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test10_vec(
+; CHECK-NEXT:    [[A:%.*]] = add <2 x i32> [[X:%.*]], <i32 -1, i32 -1>
+; CHECK-NEXT:    [[B:%.*]] = icmp slt <2 x i32> [[A]], [[X]]
+; CHECK-NEXT:    ret <2 x i1> [[B]]
+;
+  %a = add <2 x i32> %x, <i32 -1, i32 -1>
+  %b = icmp slt <2 x i32> %a, %x
+  ret <2 x i1> %b
+}
+
 define i1 @test11(i32 %x) {
 ; CHECK-LABEL: @test11(
 ; CHECK-NEXT:    ret i1 true
@@ -137,6 +179,15 @@ define i1 @test11(i32 %x) {
   ret i1 %b
 }
 
+define <2 x i1> @test11_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test11_vec(
+; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
+;
+  %a = add nsw <2 x i32> %x, <i32 8, i32 8>
+  %b = icmp slt <2 x i32> %x, %a
+  ret <2 x i1> %b
+}
+
 ; PR6195
 define i1 @test12(i1 %A) {
 ; CHECK-LABEL: @test12(




More information about the llvm-commits mailing list