[cfe-commits] [PATCH] Add -fexcess-precision option.

Hal Finkel hfinkel at anl.gov
Thu Jun 21 06:05:46 PDT 2012


On Thu, 21 Jun 2012 00:27:15 -0700
Chandler Carruth <chandlerc at google.com> wrote:

> On Wed, Jun 20, 2012 at 11:43 PM, Lang Hames <lhames at gmail.com> wrote:
> 
> > Hi All,
> >
> > This patch adds support for gcc's -fexcess-precision flag to clang.
> > I'm new to clang's option handling. Could somebody please sanity
> > check it for me?
> >
> 
> A high level point:
> 
> The flag semantics '-fexcess-precision' (as spec'ed for GCC) don't
> seem to map clearly onto this use case, especially as John argued so
> effectively in the previous email thread. I feel like this flag
> should remain very specifically attached to FP operations with more
> bits, but none of the asymmetrical properties of FMAs, so that there
> is no confusion between Clang's semantics and GCC's.
> 
> I'd suggest a new flag without any baggage, and one that perhaps ties
> more closely into the idea of contracted expressions, or some other
> concept intrinsic to fusing operations. Maybe
> '-fcontract-expressions={fast,standard,strict}'? Dunno. Naming things
> is hard.

As things currently stand in LLVM, I agree and disagree with Lang's
approach:

1. Both LLVM and gcc have backend options to enable use of excess
precision. For this purpose we should use the same flag.

2. Except perhaps via a warning, the excess precision flag should not
get mixed up with the FP_CONTRACT implementation. While that does
relate to excess precision, is is restricted to a very specific form
with other rules governing use. The FP_CONTRACT pragma uses ON/OFF, so
I suggest -ffp-contract=off to change the default. 

 -Hal

> 
> 
> Anyways, details about the patch:
> 
> - You should integrate the forwarding of this with the -ffast-math
> section more fully -- -ffast-math and maybe some other flags should
> synthesize the 'fast' variation.
> 
> - You need to handle serializing this flag in the frontend.
> 
> - Maybe add a help section to the flag?



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-commits mailing list