[llvm-dev] [cfe-dev] RFC: change -fp-contract=off to actually disable FMAs

Stephen Canon via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 12 10:16:55 PDT 2019


> On Jul 12, 2019, at 12:32 PM, Scott Manley <rscottmanley at gmail.com> wrote:
> 
> I think that makes sense, but the end result is the same. Wouldn't you agree that -fp-contract=off still contracts floating point expressions with the initial example I posted? That is the core of what I'm trying to resolve here. 

Yes, absolutely. The `fast` flag licenses many transforms that are not allowed in the default floating-point model, including contraction. So, yes, it’s being contracted in your initial example, and that’s OK!

> I still have some confusion of what FMAD is supposed to be. Is FMAD actually MAD? Or is it something else? I am fine with leaving it alone if FMAD is not actually contracting floating point operations.


     /// FMAD - Perform a * b + c, while getting the same result as the
     /// separately rounded operations.
     FMAD <https://llvm.org/doxygen/namespacellvm_1_1ISD.html#a22ea9cec080dd5f4f47ba234c2f59110a2415bea72c995bb9cf9f85bbbf90bcd7>,

It does exactly what it says on the tin. It represents an instruction that produces exactly the same result as FADD(FMUL(a,b), c). No contraction is occurring when such a node is formed.

– Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190712/cf64ec33/attachment.html>


More information about the llvm-dev mailing list