[llvm] [LangRef] Clarify the semantics of the contract fast-math flag. (PR #187340)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 14:32:14 PDT 2026


jcranmer-intel wrote:

> I think the last paragraph is overly strict; why would it have to be a new correctly rounded result? The new thing isn't correctly rounded, but the net result is more accurate than performing the separate operations

The purpose of the last rule is to exclude things like trigonometric functions or `pow` as the target of the contraction--I don't think we want `contract` to be a more powerful generic algebraic rewrite tool to turn `sin(x)/cos(x)` to `tan(x)`, and "correctly-rounded" versus "incorrectly-rounded" was the dividing line I could come up with.

I'm definitely amenable to choosing a different way of distinguishing between cases that are reasonable under a possibly on-by-default `contract` flag versus ones that should require some more user thought before enabling.

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


More information about the llvm-commits mailing list