From 3762bd1fe5f37b427894d0e0fba47870f0a0d38d Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 19 Aug 2018 18:03:34 +0000 Subject: [PATCH] [InstCombine] Add test cases for an icmp combine that is missing support for splat vector constants. llvm-svn: 340144 --- test/Transforms/InstCombine/icmp.ll | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll index 7e52e3c7ffb..64f060b8ac5 100644 --- a/test/Transforms/InstCombine/icmp.ll +++ b/test/Transforms/InstCombine/icmp.ll @@ -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:%.*]], +; CHECK-NEXT: [[B:%.*]] = icmp ult <2 x i32> [[A]], [[X]] +; CHECK-NEXT: ret <2 x i1> [[B]] +; + %a = add <2 x i32> %x, + %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, + %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:%.*]], +; CHECK-NEXT: [[B:%.*]] = icmp ult <2 x i32> [[A]], [[X]] +; CHECK-NEXT: ret <2 x i1> [[B]] +; + %a = add <2 x i32> %x, + %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:%.*]], +; CHECK-NEXT: [[B:%.*]] = icmp slt <2 x i32> [[A]], [[X]] +; CHECK-NEXT: ret <2 x i1> [[B]] +; + %a = add <2 x i32> %x, + %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> +; + %a = add nsw <2 x i32> %x, + %b = icmp slt <2 x i32> %x, %a + ret <2 x i1> %b +} + ; PR6195 define i1 @test12(i1 %A) { ; CHECK-LABEL: @test12(