[llvm] CodeGen: Add ISD::AssertNoFPClass (PR #135946)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 02:15:26 PDT 2025


================
@@ -7406,6 +7417,17 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
            N2.getOpcode() == ISD::TargetConstant && "Invalid FP_ROUND!");
     if (N1.getValueType() == VT) return N1;  // noop conversion.
     break;
+  case ISD::AssertNoFPClass: {
+    assert(N1.getValueType().isFloatingPoint() &&
+           "AssertNoFPClass is used for a non-floating type");
+    assert(isa<ConstantSDNode>(N2) && "NoFPClass is not Constant");
+    FPClassTest NoFPClass =
+        static_cast<FPClassTest>(dyn_cast<ConstantSDNode>(N2)->getZExtValue());
+    assert(llvm::to_underlying(NoFPClass) <=
+               BitmaskEnumDetail::Mask<FPClassTest>() &&
+           "FPClassTest value too large");
----------------
arsenm wrote:

Use getConstantOperandVal like above 

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


More information about the llvm-commits mailing list