diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-08-17 15:24:30 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-08-17 15:24:30 +0000 |
| commit | 4f7eb2aa95ddb69190f99f9b803e939d517dcb68 (patch) | |
| tree | 7281eb72b998742369093306f0835ab92a6b6a1d /llvm/test | |
| parent | e9a265a26709591c7338385012d07571873d9e9b (diff) | |
| download | bcm5719-llvm-4f7eb2aa95ddb69190f99f9b803e939d517dcb68.tar.gz bcm5719-llvm-4f7eb2aa95ddb69190f99f9b803e939d517dcb68.zip | |
[InstCombine] use m_APInt to allow icmp (add X, Y), C folds for splat constant vectors
This is a sibling of:
https://reviews.llvm.org/rL278859
llvm-svn: 278935
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll | 13 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 10 |
2 files changed, 8 insertions, 15 deletions
diff --git a/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll b/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll index 9aa65557476..a33eb9c1ddd 100644 --- a/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll +++ b/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll @@ -2,7 +2,6 @@ ; 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( @@ -16,8 +15,7 @@ define i1 @test1(i32 %a) { define <2 x i1> @test1vec(<2 x i32> %a) { ; CHECK-LABEL: @test1vec( -; CHECK-NEXT: [[B:%.*]] = add <2 x i32> %a, <i32 4, i32 4> -; CHECK-NEXT: [[C:%.*]] = icmp ult <2 x i32> [[B]], <i32 4, i32 4> +; CHECK-NEXT: [[C:%.*]] = icmp ugt <2 x i32> %a, <i32 -5, i32 -5> ; CHECK-NEXT: ret <2 x i1> [[C]] ; %b = add <2 x i32> %a, <i32 4, i32 4> @@ -37,8 +35,7 @@ define i1 @test2(i32 %a) { define <2 x i1> @test2vec(<2 x i32> %a) { ; CHECK-LABEL: @test2vec( -; CHECK-NEXT: [[B:%.*]] = add <2 x i32> %a, <i32 -4, i32 -4> -; CHECK-NEXT: [[C:%.*]] = icmp ugt <2 x i32> [[B]], <i32 -5, i32 -5> +; CHECK-NEXT: [[C:%.*]] = icmp ult <2 x i32> %a, <i32 4, i32 4> ; CHECK-NEXT: ret <2 x i1> [[C]] ; %b = sub <2 x i32> %a, <i32 4, i32 4> @@ -58,8 +55,7 @@ define i1 @test3(i32 %a) { define <2 x i1> @test3vec(<2 x i32> %a) { ; CHECK-LABEL: @test3vec( -; CHECK-NEXT: [[B:%.*]] = add <2 x i32> %a, <i32 4, i32 4> -; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> [[B]], <i32 -2147483644, i32 -2147483644> +; CHECK-NEXT: [[C:%.*]] = icmp sgt <2 x i32> %a, <i32 2147483643, i32 2147483643> ; CHECK-NEXT: ret <2 x i1> [[C]] ; %b = add <2 x i32> %a, <i32 4, i32 4> @@ -79,8 +75,7 @@ define i1 @test4(i32 %a) { define <2 x i1> @test4vec(<2 x i32> %a) { ; CHECK-LABEL: @test4vec( -; CHECK-NEXT: [[B:%.*]] = add <2 x i32> %a, <i32 -2147483644, i32 -2147483644> -; CHECK-NEXT: [[C:%.*]] = icmp sgt <2 x i32> [[B]], <i32 3, i32 3> +; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> %a, <i32 -4, i32 -4> ; CHECK-NEXT: ret <2 x i1> [[C]] ; %b = add <2 x i32> %a, <i32 2147483652, i32 2147483652> diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 4eadccd8cee..289c9f86061 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -1727,11 +1727,10 @@ define i1 @icmp_add_ult_2(i32 %X) { ret i1 %cmp } -; FIXME: Vectors should fold too. define <2 x i1> @icmp_add_X_-14_ult_2_vec(<2 x i32> %X) { ; CHECK-LABEL: @icmp_add_X_-14_ult_2_vec( -; CHECK-NEXT: [[ADD:%.*]] = add <2 x i32> %X, <i32 -14, i32 -14> -; CHECK-NEXT: [[CMP:%.*]] = icmp ult <2 x i32> [[ADD]], <i32 2, i32 2> +; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> %X, <i32 -2, i32 -2> +; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[TMP1]], <i32 14, i32 14> ; CHECK-NEXT: ret <2 x i1> [[CMP]] ; %add = add <2 x i32> %X, <i32 -14, i32 -14> @@ -1772,11 +1771,10 @@ define i1 @icmp_add_X_-14_uge_2(i32 %X) { ret i1 %cmp } -; FIXME: Vectors should fold too. define <2 x i1> @icmp_add_X_-14_uge_2_vec(<2 x i32> %X) { ; CHECK-LABEL: @icmp_add_X_-14_uge_2_vec( -; CHECK-NEXT: [[ADD:%.*]] = add <2 x i32> %X, <i32 -14, i32 -14> -; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> [[ADD]], <i32 1, i32 1> +; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> %X, <i32 -2, i32 -2> +; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[TMP1]], <i32 14, i32 14> ; CHECK-NEXT: ret <2 x i1> [[CMP]] ; %add = add <2 x i32> %X, <i32 -14, i32 -14> |

