[llvm] [DAG] Recognise AVGFLOOR (((A >> 1) + (B >> 1)) + (A & B & 1)) patterns (PR #169644)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 2 10:19:28 PST 2025
================
@@ -3154,19 +3154,31 @@ SDValue DAGCombiner::visitADDLike(SDNode *N) {
}
// Attempt to form avgfloor(A, B) from (A & B) + ((A ^ B) >> 1)
+// Attempt to form avgfloor(A, B) from ((A >> 1) + (B >> 1)) + (A & B & 1)
SDValue DAGCombiner::foldAddToAvg(SDNode *N, const SDLoc &DL) {
SDValue N0 = N->getOperand(0);
EVT VT = N0.getValueType();
SDValue A, B;
+ // FIXME: m_ReassociatableAdd can't handle m_Value/m_Deferred mixing.
----------------
RKSimon wrote:
It looks like @bermondd is working on this at #170061 (new contributors not being able to assign reviewers is REALLY annoying).
https://github.com/llvm/llvm-project/pull/169644
More information about the llvm-commits
mailing list