[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
Mon Nov 1 15:27:15 PDT 2021
rampitec created this revision.
rampitec added a reviewer: spatel.
Herald added a subscriber: hiraditya.
rampitec requested review of this revision.
Herald added a project: LLVM.
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%or1 = or i4 %b, %a
%or2 = or i4 %or1, %c
%not1 = xor i4 %or2, 15
%not2 = xor i4 %a, 15
%and1 = and i4 %b, %not2
%and2 = and i4 %and1, %c
%or3 = or i4 %and2, %not1
ret i4 %or3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%1 = xor i4 %c, %b
%2 = or i4 %1, %a
%or3 = xor i4 %2, 15
ret i4 %or3
}
Transformation seems to be correct!
https://reviews.llvm.org/D112966
Files:
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/and-xor-or.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112966.383910.patch
Type: text/x-patch
Size: 12239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211101/d16a3624/attachment-0001.bin>
More information about the llvm-commits
mailing list