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

Lang Hames lhames at gmail.com
Thu Jun 21 14:34:03 PDT 2012


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.

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

Sound ok?

Cheers,
Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120621/d005cdb9/attachment.html>


More information about the cfe-commits mailing list