[cfe-dev] question about fused multiply add and Clang GNU modes

Hal Finkel via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 21 05:37:50 PDT 2015

----- Original Message -----
> From: "Tim Northover via cfe-dev" <cfe-dev at lists.llvm.org>
> To: "Stephen Canon" <scanon at apple.com>
> Cc: cfe-dev at lists.llvm.org
> Sent: Sunday, September 20, 2015 11:42:56 PM
> Subject: Re: [cfe-dev] question about fused multiply add and Clang GNU modes
> Thanks Steve, an excellent summary of where IEEE-754 stands. I knew
> about the recommendation for languages to provide controls, but
> hadn't
> tracked down the one for the default.
> > Now, it *does* appear to me that we do not default to having STDC
> > FP_CONTRACT ON, which is inhibiting fma formation *even within an
> > expression*.  Given that we support STDC FP_CONTRACT OFF, we could
> > certainly
> > choose to make ON the default, and I would encourage doing so.
> I doubt we really supoprt FP_CONTRACT ON: I've never seen any attempt
> to track C expressions in the IR, which seems like a necessity. So
> the
> choice is probably between a conformant OFF and a buggy ON for
> default.

As someone who helped review the patches, I can assure you that we do support the pragmas. They work better than the command-line flags (for the reasons I pointed out in my previous e-mail). We don't track the C-level expressions in the IR, but Clang will directly form @llvm.fmuladd intrinsics where allowed. CodeGen then converts these into FMA nodes, or expands them into ADD + MUL depending on target hooks.


> Cheers.
> Tim.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory

More information about the cfe-dev mailing list