diff options
| author | Craig Topper <craig.topper@intel.com> | 2017-06-16 05:10:37 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2017-06-16 05:10:37 +0000 |
| commit | da6ea0d3e8c0bc94c806101c885154900f5573a9 (patch) | |
| tree | 07a61361428bd7269f3806aad2f025b10bf2ebca /llvm/test | |
| parent | bbd1bf9951e7af4e83eceb997b4d51af2a6fd00e (diff) | |
| download | bcm5719-llvm-da6ea0d3e8c0bc94c806101c885154900f5573a9.tar.gz bcm5719-llvm-da6ea0d3e8c0bc94c806101c885154900f5573a9.zip | |
[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
llvm-svn: 305548
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/onehot_merge.ll | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/llvm/test/Transforms/InstCombine/onehot_merge.ll b/llvm/test/Transforms/InstCombine/onehot_merge.ll index 086de3ef70c..47a4ca4b628 100644 --- a/llvm/test/Transforms/InstCombine/onehot_merge.ll +++ b/llvm/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 |

