[clang] [Driver] Introduce ffp-model=aggressive (PR #100453)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 14:14:16 PDT 2024


andykaylor wrote:

@kpneal I think the tolerance of excess precision is mostly a concession to the hardware limitations. I believe we only apply it when half-precision types are used but the hardware doesn't support native half-precision operations. In this sense, it is equivalent to the situation when math was commonly performed using x87 instructions for x86 targets (pre-SSE). To get the semantics described by the source types, you'd need to perform intermediate rounding all over the place, but in the interest of performance most people preferred to allow excess precision, and so the language standards also allowed this.

The result you get with excess precision is more accurate relative to the theoretically correct result with unbounded precision, but it doesn't match the result implied by the source types. As with the older x87 case, I think most people would prefer the performance of keeping excess precision, but there may be some people who prefer to round everything to source precision.

In general, though, I think you're right that this should be independent of whether strict mode is enabled. I don't think we should disallow combining strict exception semantics with forcing source precision.

In any case, all of that is beyond the scope of the changes I'm proposing in this PR.

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


More information about the cfe-commits mailing list