diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-02-08 17:37:17 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-02-08 17:37:17 +0000 |
commit | d11a03b263f676bd198711b8e2818577228be648 (patch) | |
tree | 4124fc711370c1448c8568bc2f4f367fa9219f84 | |
parent | fc674bcb1211eb937823f36852e4b6cf7597a23a (diff) | |
download | bcm5719-llvm-d11a03b263f676bd198711b8e2818577228be648.tar.gz bcm5719-llvm-d11a03b263f676bd198711b8e2818577228be648.zip |
[InstCombine] add test for missed vector icmp fold; NFC
Also, move the related existing scalar test to a renamed file
where I'm planning to add more icmp-add tests.
llvm-svn: 294487
-rw-r--r-- | llvm/test/Transforms/InstCombine/icmp-add.ll (renamed from llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll) | 23 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 10 |
2 files changed, 23 insertions, 10 deletions
diff --git a/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll b/llvm/test/Transforms/InstCombine/icmp-add.ll index a33eb9c1ddd..3bf1849c91c 100644 --- a/llvm/test/Transforms/InstCombine/2008-01-29-AddICmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp-add.ll @@ -83,3 +83,26 @@ define <2 x i1> @test4vec(<2 x i32> %a) { ret <2 x i1> %c } +define i1 @slt_zero_add_nsw(i32 %a) { +; CHECK-LABEL: @slt_zero_add_nsw( +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 %a, -1 +; CHECK-NEXT: ret i1 [[CMP]] +; + %add = add nsw i32 %a, 1 + %cmp = icmp slt i32 %add, 0 + ret i1 %cmp +} + +; FIXME: The same fold should work with vectors. + +define <2 x i1> @slt_zero_add_nsw_splat_vec(<2 x i8> %a) { +; CHECK-LABEL: @slt_zero_add_nsw_splat_vec( +; CHECK-NEXT: [[ADD:%.*]] = add nsw <2 x i8> %a, <i8 1, i8 1> +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <2 x i8> [[ADD]], zeroinitializer +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %add = add nsw <2 x i8> %a, <i8 1, i8 1> + %cmp = icmp slt <2 x i8> %add, zeroinitializer + ret <2 x i1> %cmp +} + diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index ad1f8654014..888fd95fb4a 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -2231,16 +2231,6 @@ define i1 @icmp_sge_zero_add_nsw(i32 %a) { ret i1 %cmp } -define i1 @icmp_slt_zero_add_nsw(i32 %a) { -; CHECK-LABEL: @icmp_slt_zero_add_nsw( -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 %a, -1 -; CHECK-NEXT: ret i1 [[CMP]] -; - %add = add nsw i32 %a, 1 - %cmp = icmp slt i32 %add, 0 - ret i1 %cmp -} - define i1 @icmp_sle_zero_add_nsw(i32 %a) { ; CHECK-LABEL: @icmp_sle_zero_add_nsw( ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 %a, 0 |