aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/onehot_merge.ll
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-06-16 05:10:37 +0000
committerCraig Topper <craig.topper@intel.com>2017-06-16 05:10:37 +0000
commit091e96c54f2050bb89b1cf51eea088ddc4c41382 (patch)
treed41cb7cacb666ad5c893b313c164e7fa94138f32 /test/Transforms/InstCombine/onehot_merge.ll
parent9a18969a6644f385faf57ca847ff50a3b0827496 (diff)
[InstCombine] Fold (!iszero(A & K1) & !iszero(A & K2)) -> (A & (K1 | K2)) == (K1 | K2) if K1 and K2 are a 1-bit mask
Summary: This is the demorganed version of the case we already handle for the OR of iszero. Reviewers: spatel Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34244 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305548 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/onehot_merge.ll')
-rw-r--r--test/Transforms/InstCombine/onehot_merge.ll20
1 files changed, 8 insertions, 12 deletions
diff --git a/test/Transforms/InstCombine/onehot_merge.ll b/test/Transforms/InstCombine/onehot_merge.ll
index 086de3ef70c..47a4ca4b628 100644
--- a/test/Transforms/InstCombine/onehot_merge.ll
+++ b/test/Transforms/InstCombine/onehot_merge.ll
@@ -73,12 +73,10 @@ define i1 @foo1_or(i32 %k, i32 %c1, i32 %c2) {
; CHECK-LABEL: @foo1_or(
; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]]
-; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP]], [[K:%.*]]
-; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
-; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP4]], [[K]]
-; CHECK-NEXT: [[TMP6:%.*]] = icmp ne i32 [[TMP5]], 0
-; CHECK-NEXT: [[OR:%.*]] = and i1 [[TMP2]], [[TMP6]]
-; CHECK-NEXT: ret i1 [[OR]]
+; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP]], [[TMP4]]
+; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[K:%.*]]
+; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]]
+; CHECK-NEXT: ret i1 [[TMP3]]
;
%tmp = shl i32 1, %c1
%tmp4 = lshr i32 -2147483648, %c2
@@ -96,12 +94,10 @@ define i1 @foo1_or_commuted(i32 %k, i32 %c1, i32 %c2) {
; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]]
; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]]
-; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[K2]], [[TMP]]
-; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
-; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP4]], [[K2]]
-; CHECK-NEXT: [[TMP6:%.*]] = icmp ne i32 [[TMP5]], 0
-; CHECK-NEXT: [[OR:%.*]] = and i1 [[TMP2]], [[TMP6]]
-; CHECK-NEXT: ret i1 [[OR]]
+; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP]], [[TMP4]]
+; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[K2]], [[TMP1]]
+; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]]
+; CHECK-NEXT: ret i1 [[TMP3]]
;
%k2 = mul i32 %k, %k ; to trick the complexity sorting
%tmp = shl i32 1, %c1