about summary refs log tree commit diff
path: root/library/compiler-builtins/libm/src/math/arch
AgeCommit message (Collapse)AuthorLines
2025-07-27Implement `floor` and `ceil` in assembly on `i586`Folkert de Vries-30/+55
Fixes: https://github.com/rust-lang/compiler-builtins/issues/837 The assembly is based on - https://github.com/NetBSD/src/blob/20433927938987dd64c8f6aa46904b7aca3fa39e/lib/libm/arch/i387/s_floor.S - https://github.com/NetBSD/src/blob/20433927938987dd64c8f6aa46904b7aca3fa39e/lib/libm/arch/i387/s_ceil.S Which both state /* * Written by J.T. Conklin <jtc@NetBSD.org>. * Public domain. */ Which I believe means we're good in terms of licensing.
2025-05-28aarch64: Add a note saying why we use `frintx` rather than `frintn`Trevor Gross-0/+6
2025-05-06Require `target_has_atomic = "ptr"` for runtime feature detectionTrevor Gross-3/+7
The `feature_detect` module is currently being built on all targets, but the use of `AtomicU32` causes a problem if atomics are not available (such as with `bpfel-unknown-none`). Gate this module behind `target_has_atomic = "ptr"`. The below now completes successfully: cargo build -p compiler_builtins --target=bpfel-unknown-none -Z build-std=core Fixes: https://github.com/rust-lang/compiler-builtins/issues/908
2025-05-03Use runtime feature detection for fma routines on x86Trevor Gross-1/+369
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]: https://github.com/bminor/musl/blob/c47ad25ea3b484e10326f933e927c0bc8cded3da/src/math/x32/fma.c
2025-05-03Rename the i686 module to x86Trevor Gross-2/+2
This module is used for both i686 and x86-64.
2025-04-19libm: Flatten the `libm/libm` directoryTrevor Gross-0/+279