[cfe-dev] fp-contract at -O0

Stephen Canon via cfe-dev cfe-dev at lists.llvm.org
Fri Feb 14 05:59:39 PST 2020


On Feb 13, 2020, at 9:17 PM, Kaylor, Andrew <andrew.kaylor at intel.com> wrote:

> > I don’t see a problem with the godbolt link; is your concern simply that you think -ffp-contract=fast should fuse a super-set of what is done by =on, or is there something else?
>  
> Yes, that is my concern. I think =fast should always produce at least as many FMA’s as =on.

I can imagine a few ways to handle this, if we really want to do something about it:

1 A diagnostic when combining -ffp-contract=fast with -O0 that you aren’t going to get FMA formation.
2 Make -ffp-contract=fast decay to =on under -O0.
3 Make -ffp-contract=fast always imply =on as well (so the frontend would form fmuladd nodes in both modes, but =fast would additionally license forming fma out of mul+add pairs).

Option 1 is easy but silly. Option 2 is only slightly more invasive and definitely fixes the “problem”, but is maybe a little too clever. Option 3 may be the best, but I haven’t thought through all the details, and it would require some experimentation.

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


More information about the cfe-dev mailing list