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

Chandler Carruth chandlerc at google.com
Thu Jun 21 11:34:22 PDT 2012


On Thu, Jun 21, 2012 at 11:28 AM, Lang Hames <lhames at gmail.com> wrote:

> Hi Steve, Chandler, Hal,
>
>
>> That said, I don't love overloading excess-precision for this, even if
>> fma is formally a special case of excess precision, mostly because excess
>> precision has even more bizarre corner cases -- it leads to such
>> monstrosities as cos(x) != cos(x).
>>
>
> Sounds like -fexcess-precision is too blunt of an instrument for this.
> Should setting -fexcess-precision=fast enable this optimization though?
>

I'm leery of it doing anything other than allowing use of higher precision
registers... Mostly because I don't want to ever get a bug report about it.
;] Others may be less reluctant though.

> If we're not going to use excess-precision, I would suggest a name that is
>> completely explicit; something along the lines of -fallow-fma-anywhere or
>> -fallow-fma-across-expressions (those might be too wordy).
>>
>> "-fallow-fma-anywhere" sounds fine to me if this flag is going to be
> targeted specifically at FMA formation. Does anybody have any objections to
> this?
>

> Should this flag, whatever it's eventually called, have a "never-form"
> mode that over-rides FP_CONTRACT and prevents any FMA formation? That seems
> like it could be useful, if only for debugging. FP_CONTRACT doesn't
> guarantee any fusing, so a flag that disabled any fusing wouldn't violate
> FP_CONTRACT semantics, it would just provide a baseline with no fusing
> carried out. This is what I had in mind when I penned the comments that you
> referred to Hal.
>
> In that case an alternative flag could be:
>
> "-fform-fma={anywhere,standard,never}"
>

I do think that "never" is an important mode. I like the term "strict" for
that personally, but paint the bikeshed as you like.

I wouldn't restrict this to FMA though, at the very least there is a fused
mul+sub on some architectures... How about this shade of blue for our
favorite shed:

-ffuse-fp-ops={fast,standard,never}

Where 'fast' allows any amount of fusing, 'standard' only allows that which
is allowed in the relevant language standard (FP_CONTRACT), and 'never' (or
'strict') completely disables op fusion?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120621/07fd822e/attachment.html>


More information about the cfe-commits mailing list