[llvm] [X86] Fold AND(Y, XOR(X, SUB(0, X))) to ANDN(Y, BLSMSK(X)) (PR #128348)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 02:54:18 PST 2025
================
@@ -51045,6 +51045,33 @@ static SDValue combineBMILogicOp(SDNode *N, SelectionDAG &DAG,
return SDValue();
}
+/// Fold AND(Y, XOR(X, NEG(X))) -> ANDN(Y, BLSMSK(X)) if BMI is available.
+static SDValue combineAndXorSubWithBMI(SDNode *And, const SDLoc &DL,
+ SelectionDAG &DAG,
+ const X86Subtarget &Subtarget) {
+ using namespace llvm::SDPatternMatch;
+
+ EVT VT = And->getValueType(0);
+ // Make sure this node is a candidate for BMI instructions.
+ if (!Subtarget.hasBMI() || !VT.isScalarInteger() ||
----------------
RKSimon wrote:
Drop isScalarInteger check as its faster to just check i32/i64
https://github.com/llvm/llvm-project/pull/128348
More information about the llvm-commits
mailing list