[PATCH] D112955: [InstCombine] (~(a | b) & c) | ~(c | (a ^ b)) -> (a & b & ~c) | ~(a | b)
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 10 12:15:38 PST 2021
rampitec planned changes to this revision.
rampitec added a comment.
In the light of D113526 <https://reviews.llvm.org/D113526> this needs to be rebased and handle inverted pattern:
(a | ~(b & c)) & ~(a & (b ^ c)) --> ~(a | b) | (a ^ b ^ c)
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%and1 = and i4 %b, %c
%not1 = xor i4 %and1, 15
%or1 = or i4 %not1, %a
%xor1 = xor i4 %b, %c
%and2 = and i4 %xor1, %a
%not2 = xor i4 %and2, 15
%and3 = and i4 %or1, %not2
ret i4 %and3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%xor1 = xor i4 %b, %c
%xor2 = xor i4 %xor1, %a
%or1 = or i4 %a, %b
%not1 = xor i4 %or1, 15
%or2 = or i4 %xor2, %not1
ret i4 %or2
}
Transformation seems to be correct!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112955/new/
https://reviews.llvm.org/D112955
More information about the llvm-commits
mailing list