From 638b6131010e713c3b2adb21d77b42124ea5705b Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 15 Aug 2016 21:37:24 +0000 Subject: [PATCH] [InstCombine] add tests for missing vector icmp folds llvm-svn: 278747 --- .../Transforms/InstCombine/2008-01-29-AddICmp.ll | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll b/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll index d175762..0f0b5c3 100644 --- a/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll +++ b/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s ; PR1949 +; FIXME: Vectors should fold the same way for all tests. define i1 @test1(i32 %a) { ; CHECK-LABEL: @test1( @@ -13,6 +14,17 @@ define i1 @test1(i32 %a) { ret i1 %c } +define <2 x i1> @test1vec(<2 x i32> %a) { +; CHECK-LABEL: @test1vec( +; CHECK-NEXT: [[B:%.*]] = add <2 x i32> %a, +; CHECK-NEXT: [[C:%.*]] = icmp ult <2 x i32> [[B]], +; CHECK-NEXT: ret <2 x i1> [[C]] +; + %b = add <2 x i32> %a, + %c = icmp ult <2 x i32> %b, + ret <2 x i1> %c +} + define i1 @test2(i32 %a) { ; CHECK-LABEL: @test2( ; CHECK-NEXT: [[C:%.*]] = icmp ult i32 %a, 4 @@ -23,6 +35,17 @@ define i1 @test2(i32 %a) { ret i1 %c } +define <2 x i1> @test2vec(<2 x i32> %a) { +; CHECK-LABEL: @test2vec( +; CHECK-NEXT: [[B:%.*]] = add <2 x i32> %a, +; CHECK-NEXT: [[C:%.*]] = icmp ugt <2 x i32> [[B]], +; CHECK-NEXT: ret <2 x i1> [[C]] +; + %b = sub <2 x i32> %a, + %c = icmp ugt <2 x i32> %b, + ret <2 x i1> %c +} + define i1 @test3(i32 %a) { ; CHECK-LABEL: @test3( ; CHECK-NEXT: [[C:%.*]] = icmp sgt i32 %a, 2147483643 @@ -33,3 +56,14 @@ define i1 @test3(i32 %a) { ret i1 %c } +define <2 x i1> @test3vec(<2 x i32> %a) { +; CHECK-LABEL: @test3vec( +; CHECK-NEXT: [[B:%.*]] = add <2 x i32> %a, +; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> [[B]], +; CHECK-NEXT: ret <2 x i1> [[C]] +; + %b = add <2 x i32> %a, + %c = icmp slt <2 x i32> %b, + ret <2 x i1> %c +} + -- 2.7.4