[llvm] [SDPatternMatch] Add m_CondCode, m_NoneOf, and some ZExt/SExt improvements (PR #90762)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 12:30:16 PDT 2024


================
@@ -718,6 +723,20 @@ inline SpecificInt_match m_Zero() { return m_SpecificInt(0U); }
 inline SpecificInt_match m_One() { return m_SpecificInt(1U); }
 inline SpecificInt_match m_AllOnes() { return m_SpecificInt(~0U); }
 
+// FIXME: We probably ought to move constant matchers before
+// most of the others so that m_ZExt/m_ZExtOrSelf can be
+// with other extension matchers.
+template <typename Opnd> inline auto m_ZExt(const Opnd &Op) {
+  return m_AnyOf(UnaryOpc_match<Opnd>(ISD::ZERO_EXTEND, Op),
+                 m_And(Op, m_AllOnes()));
----------------
topperc wrote:

m_And(Op, m_AllOnes()) is not a zero extend. That's equivalent to `Op`. No bits are cleared.

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


More information about the llvm-commits mailing list