[PATCH] D112966: [InstCombine] (~a & b & c) | ~(a | b | c) -> ~(a | (b ^ c))
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 10 12:48:29 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 ^ c)
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%and1 = and i4 %b, %a
%and2 = and i4 %and1, %c
%not1 = xor i4 %and2, 15
%not2 = xor i4 %a, 15
%or1 = or i4 %not2, %b
%or2 = or i4 %or1, %c
%and3 = and i4 %or2, %not1
ret i4 %and3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%xor = xor i4 %b, %c
%not = xor i4 %a, 15
%or = or i4 %xor, %not
ret i4 %or
}
Transformation seems to be correct!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112966/new/
https://reviews.llvm.org/D112966
More information about the llvm-commits
mailing list