[llvm] [X86] LowerAndToBT - fold ICMP_ZERO(AND(X, AND(Y, SHL(1, Z)))) -> BT(AND(X,Y),Z) patterns (PR #182007)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 05:31:30 PST 2026


================
@@ -24384,6 +24384,10 @@ static SDValue LowerAndToBT(SDValue And, ISD::CondCode CC, const SDLoc &dl,
       if (Known.countMinLeadingZeros() < (BitWidth - AndBitWidth))
         return SDValue();
     }
+  } else if (sd_match(And,
+                      m_ReassociatableAnd(m_Value(Src), m_Value(Mask),
+                                          m_Shl(m_One(), m_Value(BitNo))))) {
+    // (Src & Mask & (1 << BitNo)) ==/!= 0
----------------
phoebewang wrote:

Question: why don't we need to handle `(Src & (1 << BitNo)) ==/!= 0` here?

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


More information about the llvm-commits mailing list