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

Serge Pavlov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 05:41:05 PDT 2024


================
@@ -354,6 +354,16 @@ class TargetLoweringBase {
     return IsStrictFPEnabled;
   }
 
+  /// Returns true if the target supports static rounding mode for the given
+  /// instruction.
+  virtual bool isStaticRoundingSupportedFor(const Instruction &I) const {
+    return false;
+  }
----------------
spavloff wrote:

Shouldn't DAGBuilder just use the best target-specific implementation of a target-independent operation? The call: 

> call float @llvm.experimental.constrained.fadd.f32(float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")

is lowered to STRICT_FADD on X86 because there is no static rounding on this platform and DAG node anyway would be an operation with rounding mode taken from a hardware register. On RISCV, a better representation exist, so SelectionDAGBuilbder can use it.

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


More information about the llvm-commits mailing list