]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #32256 - bluss:float-fast-math, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 19 Mar 2016 04:12:00 +0000 (21:12 -0700)
committerbors <bors@rust-lang.org>
Sat, 19 Mar 2016 04:12:00 +0000 (21:12 -0700)
Add intrinsics for float arithmetic with `fast` flag enabled

Add intrinsics for float arithmetic with `fast` flag enabled

`fast` a.k.a UnsafeAlgebra is the flag for enabling all "unsafe"
(according to llvm) float optimizations.

See LangRef for more information http://llvm.org/docs/LangRef.html#fast-math-flags

Providing these operations with less associativity rules (for example)
is useful to numerical applications.

For example, the summation loop:

    let sum = 0.;
    for element in data {
        sum += *element;
    }

Using the default floating point semantics, this loop expresses that the
floats must be added in a sequence, one after another. This constraint
is usually completely unintended, and it means that no auto-vectorization
is possible.


Trivial merge