[LLVMdev] [RFC] Extend LLVM IR to express "fast-math" at a per-instruction level
milseman at apple.com
Mon Oct 29 20:22:46 PDT 2012
On Oct 29, 2012, at 5:18 PM, Krzysztof Parzyszek <kparzysz at codeaurora.org> wrote:
> On 10/29/2012 6:34 PM, Michael Ilseman wrote:
> > N: no NaNs - ignore the existence of NaNs when convenient
> Maybe distinguish between quiet and signaling NaNs?
> > NI - no infs AND no NaNs
> > x - x ==> 0
> > Inf > x ==> true
> Inf * x ==> 0?
> I think that if an infinity appears when NI (or I) is given, the result should be left as "undefined". Similarly with NaNs. In such cases, it's impossible to predict the accuracy of the result, so trying to define what happens is pretty much moot. In this case Inf > x may as well be simplified to "false" without any loss of (already absent) meaning.
The goal is not necessarily to un-define Inf/NaN, but to opt-in to unsafe optimizations that would otherwise not be allowed to be applied, e.g. x*0==>0. There may be examples where these optimizations produce arbitrary results as though those constructs were absent in meaning, but that doesn't make Inf/NaN constants completely undefined in general. The "when convenient" wording is already a little vague/permissive, and could be re-worded to state that Values are assumed to not be Inf/NaN when convenient, but Constants may be honored.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev