[llvm] [DAG] Fold (and X, (add (not Y), Z)) -> (and X, (not (sub Y, Z))). (PR #141476)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 3 05:51:22 PDT 2025
================
@@ -11609,6 +11625,28 @@ SDValue DAGCombiner::foldShiftToAvg(SDNode *N) {
return DAG.getNode(FloorISD, SDLoc(N), N->getValueType(0), {A, B});
}
+SDValue DAGCombiner::foldBitwiseOpWithNeg(SDNode *N, const SDLoc &DL, EVT VT) {
+ if (!TLI.hasAndNot(SDValue(N, 0)))
----------------
RKSimon wrote:
It was me, I'd focus on getting this PR completed just for the ANDNOT case. Then a followup PR would split the hasAndNot/hasAndNotCompare dependency (and probably simplify the hasAndNot call to hasAndNot(EVT)). Then a final PR would replace hasAndNot with hasBitwiseLogicNot and finally extend foldBitwiseOpWithNeg to OR/XOR - like I said, yak shaving :/
https://github.com/llvm/llvm-project/pull/141476
More information about the llvm-commits
mailing list