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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 05:32:37 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 &&
----------------
arsenm wrote:

But that's not what you are implementing here. You are implementing operations that do read the dynamic mode into ones that don't. We would need a separate set of operations corresponding to cases with a static mode. The metadata is not a request to use a specific mode, they only indicate what the mode is.

> Constrained intrinsics are not the best representation for static rounding mode in IR

These aren't a representation of it at all, it's conceptually different. 


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


More information about the llvm-commits mailing list