rust/library/compiler-builtins
Trevor Gross 8995ac0448 Use runtime feature detection for fma routines on x86
Get performance closer to the glibc implementations by adding assembly
fma routines, with runtime feature detection so they are used even if
not compiled with `+fma` (as the distributed standard library is often
not). Glibc uses ifuncs, this implementation stores a function pointer
in an atomic.

Results of CPU flags are also cached in order to avoid repeating the
startup time in calls to different functions. The feature detection code
is a slightly simplified version of `std-detect`.

Musl sources were used as a reference [1].

Fixes: https://github.com/rust-lang/rust/issues/140452 once synced

[1]: c47ad25ea3/src/math/x32/fma.c
2025-05-03 14:17:49 -04:00
..
2025-04-21 22:50:42 -04:00
2025-04-21 22:50:42 -04:00
2025-04-19 20:42:40 -04:00
2025-04-19 18:23:45 -04:00
2025-04-22 04:00:49 -04:00

compiler-builtins and libm

This repository contains two main crates:

  • compiler-builtins: symbols that the compiler expects to be available at link time
  • libm: a Rust implementation of C math libraries, used to provide implementations in ocre.

More details are at compiler-builtins/README.md and libm/README.md.

For instructions on contributing, see CONTRIBUTING.md.

License

  • libm may be used under the MIT License
  • compiler-builtins may be used under the MIT License and the Apache License, Version 2.0 with the LLVM exception.
  • All original contributions must be under all of: the MIT license, the Apache-2.0 license, and the Apache-2.0 license with the LLVM exception.

More details are in LICENSE.txt and libm/LICENSE.txt.