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-shr.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-shr.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/icmp-shr.ll | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp-shr.ll b/llvm/test/Transforms/InstCombine/icmp-shr.ll index 0b0ef982ef6..af608f3666e 100644 --- a/llvm/test/Transforms/InstCombine/icmp-shr.ll +++ b/llvm/test/Transforms/InstCombine/icmp-shr.ll @@ -13,6 +13,16 @@ define i1 @lshr_eq_msb_low_last_zero(i8 %a) { ret i1 %cmp } +define <2 x i1> @lshr_eq_msb_low_last_zero_vec(<2 x i8> %a) { +; CHECK-LABEL: @lshr_eq_msb_low_last_zero_vec( +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i8> %a, <i8 6, i8 6> +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %shr = lshr <2 x i8> <i8 127, i8 127>, %a + %cmp = icmp eq <2 x i8> %shr, zeroinitializer + ret <2 x i1> %cmp +} + define i1 @ashr_eq_msb_low_second_zero(i8 %a) { ; CHECK-LABEL: @ashr_eq_msb_low_second_zero( ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 %a, 6 |