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

Kevin P. Neal via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 09:43:45 PDT 2024


kpneal wrote:

Wouldn't retrieving the rounding mode count as "accessing the floating-point environment"? Granted, this isn't checking the status flags and can be done in the default environment, true, but this still feels like lawyering too close to the specification. And the C standard isn't authoritative with regards to IR semantics so long as the IR semantics enable adhering to the C standard. So, while we can't ignore the C standard, the C standard isn't definitive when it comes to LLVM's IR.

I'd love to hear from a backend person. Does or should any backend require the strictfp attribute on a call to retrieve the rounding mode or any of the other FP environment state that isn't a "status flag"?

If a call to get_rounding() is done in a function that isn't marked strictfp, and doesn't have the strictfp attribute at the call site, then doesn't that imply that since we're in the default FP environment we can just constant fold the call? We already assume we're in the default FP environment normally already.

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


More information about the llvm-commits mailing list