[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
Wed Jun 11 07:05:21 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:
Sorry I missed this - yes it looks like its a mess. Maybe adding a hasBitwiseLogicNot(Opc, VT) variant first and then moving over as many of the hasAndNot calls as possible?
https://github.com/llvm/llvm-project/pull/141476
More information about the llvm-commits
mailing list