[llvm] [DAG] Add SpecificFP matcher (PR #167438)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 11 00:34:56 PST 2025


================
@@ -1144,6 +1144,27 @@ inline SpecificInt_match m_SpecificInt(uint64_t V) {
   return SpecificInt_match(APInt(64, V));
 }
 
+struct SpecificFP_match {
+  double Val;
+
+  explicit SpecificFP_match(double V) : Val(V) {}
+
+  template <typename MatchContext>
+  bool match(const MatchContext &Ctx, SDValue V) {
+    if (const auto *CFP = dyn_cast<ConstantFPSDNode>(V.getNode()))
+      if (CFP->isExactlyValue(Val))
+        return true;
+    return false;
----------------
RKSimon wrote:

Is it possible to add splat handling as well?

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


More information about the llvm-commits mailing list