[llvm] [InstCombine] simplify average of lsb (PR #95684)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 16 10:48:27 PDT 2024
================
@@ -1284,6 +1284,13 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
return NewSub;
}
+ // Fold (X + Y) / 2 --> (X & Y) iff (X u<= 1) && (Y u<= 1)
+ if (match(Op0, m_Add(m_Value(X), m_Value(Y))) && match(Op1, m_One()) &&
+ computeKnownBits(X, 0, &I).countMaxActiveBits() <= 1 &&
----------------
dtcxzyw wrote:
http://llvm-compile-time-tracker.com/compare.php?from=d442bf043537fd4bc0c2fc5a4d77337b0d482ea9&to=8fda4ae9c656cec3a12a04a0a218149aac28eddf&stat=instructions:u
https://github.com/llvm/llvm-project/pull/95684
More information about the llvm-commits
mailing list