diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-09-15 21:35:30 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-09-15 21:35:30 +0000 |
commit | af91d1f81e8e407c5bad925067981fc6f770efa1 (patch) | |
tree | 467f190a5bfc52c48c8bd8652d008710b5772a64 /llvm/test/Transforms/InstCombine/icmp.ll | |
parent | aa9f1c59d2700629c4619d5d4e30e309de6fe4e5 (diff) | |
download | bcm5719-llvm-af91d1f81e8e407c5bad925067981fc6f770efa1.tar.gz bcm5719-llvm-af91d1f81e8e407c5bad925067981fc6f770efa1.zip |
[InstCombine] allow icmp (shr/shl) folds for vectors
These 2 helper functions were already using APInt internally, so just
change the API and caller to allow folds for splats. The scalar
regression tests look quite thorough, so I just added a couple of
tests to prove that vectors are handled too.
These folds should be grouped with the other cmp+shift folds though.
That can be an NFC follow-up.
llvm-svn: 281663
Diffstat (limited to 'llvm/test/Transforms/InstCombine/icmp.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index a2b5707ce69..da5913e3821 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -2194,6 +2194,16 @@ define i1 @shl_ap1_zero_ap2_non_zero_2(i32 %a) { ret i1 %cmp } +define <2 x i1> @shl_ap1_zero_ap2_non_zero_2_vec(<2 x i32> %a) { +; CHECK-LABEL: @shl_ap1_zero_ap2_non_zero_2_vec( +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> %a, <i32 29, i32 29> +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %shl = shl <2 x i32> <i32 4, i32 4>, %a + %cmp = icmp eq <2 x i32> %shl, zeroinitializer + ret <2 x i1> %cmp +} + define i1 @shl_ap1_zero_ap2_non_zero_4(i32 %a) { ; CHECK-LABEL: @shl_ap1_zero_ap2_non_zero_4( ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 %a, 30 |