[LLVMdev] Representing -ffast-math at the IR level

Dmitry Babokin babokin at gmail.com
Sun Apr 15 06:30:56 PDT 2012


On Sun, Apr 15, 2012 at 5:16 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> > I would define the set of transformations, such as (i can help with
> > more complete list if you prefer):
> >
> >    - reassociation
> >    - x+0.0=>x
> >    - x*0.0=>0.0
> >    - x*1.0=>x
> >    - a/b => a* 1/b
> >    - a*b+c=>fma(a,b,c)
> >    - ignoring NaNs in compare, i.e. (a<b) => !(a>=b)
> >    - value unsafe transformation (for aggressive fp optimizations,
> > like a*b+a*c => a(b+c)) and other of the kind.
> >
> > and several aliases for "strict", "precise", "fast" models (which are
> > effectively combination of flags above).
>
> From a user's perspective, I think that it is important to have
> categories defining:
>  - finite math (as precise as normal, but might do odd things for NaNs
>   or Infty, etc.) - I'd suppose this is a strictest "fast" option.
>

That's exactly "/fp:precise" or "-fp-model precise" in terms of MS and
Intel Compiler options.


>  - algebraic-equivalence - The compiler might do anything that is
>   algebraically the same (even if the numerics could be quite
>   different) - This is probably the loosest "fast" option.
>

That's "/fp:fast" or "-fp-model fast" in terms on MS and Intel Compiler
options.

Intel also supports "-fp-model fast=2" for the
most aggressive optimizations.


Dmitry.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120415/302daef6/attachment.html>


More information about the llvm-dev mailing list