libm/Cargo.toml

31 lines
555 B
TOML
Raw Normal View History

2018-07-12 00:44:28 -05:00
[package]
2018-07-13 19:38:51 -05:00
authors = ["Jorge Aparicio <jorge@japaric.io>"]
categories = ["no-std"]
description = "libm in pure Rust"
documentation = "https://docs.rs/libm"
keywords = ["libm", "math"]
license = "MIT OR Apache-2.0"
2018-07-12 00:44:28 -05:00
name = "libm"
2018-07-13 19:38:51 -05:00
repository = "https://github.com/japaric/libm"
2018-07-18 11:48:47 -05:00
version = "0.1.2"
2018-07-12 00:44:28 -05:00
[features]
# only used to run our test suite
checked = []
2018-07-12 00:44:28 -05:00
[workspace]
members = [
"cb",
"input-generator",
"musl-generator",
"newlib-generator",
"shared",
]
[dev-dependencies]
shared = { path = "shared" }
Optimize intrinsics on wasm32 Profiling a recent demo I was playing with on `wasm32-unknown-unknown` pointed me to the surprising result that 15% of the execution time was in the `sqrt` intrinsic (there's a lot of math here). Upon investigation I remembered that wasm (unconditionally) has a native `f32.sqrt` instruction! I was then subsequently confused that a simple `f.sqrt()` actually codegens to use `f32.sqrt` in Rust, but I later realized that the implementations of intrinsics in this library often use other intrinsics to implement them. That means that the real intrinsic here, `acos`, internally called `sqrt` at some point but wasn't using the optimized implementation! To help fix this situation this PR is intended on providing the infrastructure for optimized implementations (via code generation) to be used for each intrinsic. I've gone thorugh the various math instructions that wasm has available and updated each of the intrinsic implementations in this crate to optionally use the LLVM intrinsic versions, which are known to unconditionally compile down to a single instruction (unlike the arbitrary platform, where we don't know what it will compile down to!). To do this I created a new macro to wrap the invocation of LLVM intrinsics. Invoking LLVM intrinsics is turned off by default (through a new and on-by-default feature, `stable`). When the `stable` feature is disabled, however, then the wasm-target specifically will enable usage of the LLVM intrinsics. I've additionally added a CI builder which should verify that these continue to build on Travis. After this I intended to update the submodule in the `compiler-builtins` repository so we can pull in the optimized implementation there, and `compiler-builtins` naturally won't set `feature = "stable"` when compiling so all the intrinsics should get compiled in by default. After a further update of `the libcompiler_builtins` submodule in rust-lang/rust we should be good to go!
2018-10-11 14:43:19 -07:00
[features]
default = ['stable']
stable = []