[llvm] [SelectionDAG][RISCV] Operations with static rounding (PR #100999)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 11:36:32 PDT 2024


================
@@ -8131,15 +8131,73 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
 void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
     const ConstrainedFPIntrinsic &FPI) {
   SDLoc sdl = getCurSDLoc();
+  const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+  EVT VT = TLI.getValueType(DAG.getDataLayout(), FPI.getType());
+  fp::ExceptionBehavior EB = *FPI.getExceptionBehavior();
+  std::optional<RoundingMode> RM = FPI.getRoundingMode();
+
+  SDNodeFlags Flags;
+  if (EB == fp::ExceptionBehavior::ebIgnore)
+    Flags.setNoFPExcept(true);
+
+  if (auto *FPOp = dyn_cast<FPMathOperator>(&FPI))
+    Flags.copyFMF(*FPOp);
+
+  bool UseStaticRounding = EB == fp::ExceptionBehavior::ebIgnore && RM &&
+                           *RM != RoundingMode::Dynamic &&
----------------
efriedma-quic wrote:

Right... if we want floating-point ops with an explicitly specified rounding mode, we need IR support.  And "STRICT_" forms of the SelectionDAG ops.  If you want to go this route, it needs an RFC.

(If you just want the nodes for SelectionDAG-internal optimizations, you can skip this, though.)

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


More information about the llvm-commits mailing list