[llvm] [FPEnv] Add strictfp attribute to the FP environment manipulation intrinsics (PR #96093)

Serge Pavlov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 11:17:00 PDT 2024


spavloff wrote:

> If a strictfp function can safely be called from a non-strictfp function then the caller doesn't need to know these details.

But what if the strictfp function changes FP environment, like `fesetround`? It requires all FP operations in the calling function to be converted into constrained intrinsic. It falls into the definition of `strictfp` attribute in LangRef:
```
This attribute indicates that the function was called from a scope that requires strict floating-point semantics.
```
Such function cannot be safely called from non-strictfp function. This property is independent of using constrained intrinsics in the function. If a function contains constrained intrinsics but restores the FP state at exit, it can be called from a non-strictfp function.

This is why we probably need two attributes.

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


More information about the llvm-commits mailing list