[llvm] [X86] Use BMI2 shrx for range-known zero tests (PR #207904)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 00:36:20 PDT 2026


================
@@ -57313,6 +57313,53 @@ static SDValue combineExtSetcc(SDNode *N, SelectionDAG &DAG,
   return Res;
 }
 
+static SDValue combineZextSetccEqZeroToShift(SDNode *N, SelectionDAG &DAG,
+                                             const X86Subtarget &Subtarget) {
+  if (!Subtarget.hasBMI2() || !Subtarget.is64Bit() ||
+      N->getOpcode() != ISD::ZERO_EXTEND)
+    return SDValue();
+
+  SDValue N0 = N->getOperand(0);
+  if (N0.getOpcode() != ISD::SETCC || !N0.hasOneUse())
----------------
RKSimon wrote:

use sd_match to do all this matching

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


More information about the llvm-commits mailing list