[llvm] [X86]: Reassoc demorgan rule for ANDN (PR #163789)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 16 07:49:21 PDT 2025


================
@@ -51651,6 +51651,31 @@ static SDValue combineAndXorSubWithBMI(SDNode *And, const SDLoc &DL,
   return AndN;
 }
 
+// fold (not (or A, B)) -> nand(A, not(B)) if BMI
+static SDValue
+combineReassocDemorganWithNANDWithBMI(SDNode *Xor, const SDLoc &DL,
+                                      SelectionDAG &DAG,
+                                      const X86Subtarget &Subtarget) {
+  using namespace llvm::SDPatternMatch;
+
+  EVT VT = Xor->getValueType(0);
+  // Make sure this node is a candidate for BMI instructions.
+  if (!Subtarget.hasBMI() || (VT != MVT::i32 && VT != MVT::i64))
----------------
RKSimon wrote:

Search DAGCombiner.cpp for hasAndNot

https://github.com/llvm/llvm-project/pull/163789


More information about the llvm-commits mailing list