[PATCH] D31164: [IR] Add AllowContract to FastMathFlags

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 10:43:57 PDT 2017


anemet added inline comments.


================
Comment at: docs/LangRef.rst:2197-2200
+``contract``
+   Allow floating-point contraction (e.g. fusing a multiply followed by an
+   addition into a fused multiply-and-add).
+
----------------
spatel wrote:
> mehdi_amini wrote:
> > anemet wrote:
> > > arsenm wrote:
> > > > mehdi_amini wrote:
> > > > > arsenm wrote:
> > > > > > Should we also have an unsafe algebra that preserves signed zeros/nans etc?
> > > > > @arsenm : isn't it the default when there is no `nsz` or `nnan` ?
> > > > > 
> > > > > 
> > > > No, that is normal safe math. I mean unsafe algebraic transformations similar to contraction which will preserve nan/signed zeros/inf behavior but are still not safe.
> > > Maybe but we may want that separate from contraction where the result is more exact.
> > Do you have an example of such transformations?
> If I'm understanding Matt's question, a mode that allows reassociation but is independent of the other relaxation bits could be handled by not having "fast" imply all of the other bits. This came up here:
> http://lists.llvm.org/pipermail/llvm-dev/2016-November/107104.html
> 
> I think we need that mode, but it's separate from this set of patches.
@spatel, thanks for the context.  I agree that is a different topic from this set of patches.  Here the goal is to represent -ffp-contract=fast in the IR without changing semantics or its relation to -ffast-math ('fast' implies contraction).


https://reviews.llvm.org/D31164





More information about the llvm-commits mailing list