mozilla/rust — pull request #5697 by dbaupp (2013-04-03 16:24:37+00:00)
Title: Use more floating point intrinsics

**See #5686 before any sort of review.** (Opened for discussion, etc.)

Uses the LLVM intrinsics for several of the floating point operations. Unfortunately, these seem to cause problems with the stack (e.g. https://gist.github.com/dbaupp/5300202). The most dangerous ones seem to be `sin`, `cos` and `exp`, so their intrinsic definitions are `sin_intr` etc, unsuffixed is still libc.

A testcase for all of the 1 argument ones:

```rust
use core::f64::*;
type T = f64;

macro_rules! run (
($f:ident) => {
{
let mut sum = 0.0;
for core::uint::range(1, 100000000) |i| {
sum += $f(i as T);
}
io::println(fmt!("%f", sum as float));
}
}
)

fn main() {
run!(abs);
run!(exp2);
run!(floor);
run!(ln);
run!(log10);
run!(log2);
run!(sqrt);
run!(cos_intr);
run!(sin_intr);
run!(exp_intr);
}
```

Crashes during the `cos_intr` run with:
```
intrinsics-bench: /home/huon/rust/src/rt/rust_stack.cpp:53: void check_stack_canary(stk_seg*): Assertion `stk->canary == canary_value && "Somebody killed the canary"' failed.
Aborted
```