[llvm] [DAG] SDPatternMatch - add a m_SpecificNeg() matcher (PR #173807)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 2 10:07:33 PST 2026
================
@@ -1299,6 +1299,32 @@ inline BinaryOpc_match<ValTy, AllOnes_match, true> m_Not(const ValTy &V) {
return m_Xor(V, m_AllOnes());
}
+struct SpecificNeg_match {
+ SDValue V;
+
+ explicit SpecificNeg_match(SDValue V) : V(V) {}
+
+ template <typename MatchContext>
+ bool match(const MatchContext &Ctx, SDValue N) {
+ if (sd_context_match(N, Ctx, m_Neg(m_Specific(V))))
+ return true;
+
+ return ISD::matchBinaryPredicate(
----------------
mshockwave wrote:
> i think keeping them separate is cleaner.
> it doesn't change the existing behavior of m_Neg which is purely structural
I also think we should keep them separate, to avoid confusion and/or potential foot gun in the future
https://github.com/llvm/llvm-project/pull/173807
More information about the llvm-commits
mailing list