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

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 21:32:19 PDT 2017


anemet added inline comments.


================
Comment at: docs/LangRef.rst:2199
+   Allow floating-point contraction (e.g. fusing a multiply followed by an
+   addition into a fused multiply-and-add).
+
----------------
mehdi_amini wrote:
> anemet wrote:
> > mehdi_amini wrote:
> > > Is it the intent to allow this as well :  x + x + x ->  3 * x  ?
> > I don't think so.  We do the general case (any number of terms) under unsafe-math, in FAddCombine::simplify in InstCombine.
> I know we do this under unsafe-fp-math, I was wondering specifically about how fat the "contract" mode allows to go.
Ah ok, sorry, I misunderstood.  The C standard frames FP_CONTRACT as a permission to omit rounding errors while contracting, so potentially this may be included too.


https://reviews.llvm.org/D31164





More information about the llvm-commits mailing list