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

Hal Finkel hfinkel at anl.gov
Thu Jun 21 14:50:21 PDT 2012


On Thu, 21 Jun 2012 14:34:03 -0700
Lang Hames <lhames at gmail.com> wrote:

> Hi Hal,
> 
> I object to 'never' because there may be cases in the future where we
> > can determine that extra precision cannot change the result so we
> > can use fma while maintaining strict standard compliance. 'strict'
> > is much better.
> >
> 
> That's two votes for 'strict'. I'm happy with that. :)
> 
> For an option whose job it is to set the default FP_CONTRACT state, I
> > think that -ffp-contract=[no|yes|default] is the best. This makes
> > the one-to-one correspondence clear to the user.
> >
> 
> This flag isn't intended to set the default FP_CONTRACT behaviour,
> it's about providing FMA formation modes outside those described by
> FP_CONTRACT, in particular enabling aggressive formation of FMAs
> across expression boundaries. I had intended enable this aggressve
> FMA formation under the -fexcess-precision flag, but as Steve pointed
> out that flag is overly broad.

But the LLVM option is called enable-excess-fp-precision; I would like
to have consistency across both LLVM and clang. If -fexcess-precision
is overbroad for clang then I think it should be considered overbroad
for LLVM and we should change the LLVM option name and description as
well.

> 
> So, proposal:
> 
> New flag: -ffuse-fp-ops={fast,standard,strict}.  Default value will be
> 'standard', which means following FP_CONTRACT rules.
> 
> When -ffuse-fp-ops=fast we form FMAs wherever they're profitable,
> regardless of the FP_CONTRACT state.
> When -ffuse-fp-ops=strict we form FMAs iff/when we can prove that the
> excess precision won't change the result (which to start with will
> mean never forming FMAs).
> 
> -ffast-math implies -ffuse-fp-ops=fast
> -fexcess-precision implies -ffuse-fp-ops=fast

I assume you mean -fexcess-precision=fast here.
-fexcess-precision=standard should do nothing (as it is the default
here), but providing -fexcess-precision=standard and also
-ffuse-fp-ops=fast should generate a warning.

 -Hal

> 
> Sound ok?
> 
> Cheers,
> Lang.



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



More information about the cfe-commits mailing list