From 58077543d542908a6fc6b16fa297c21e946eefc2 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 9 Apr 2025 01:21:33 +0000 Subject: [PATCH 1/2] refactor: Move the `libm` crate to a subdirectory In preparation for switching to a virtual manifest, move the `libm` crate into a subdirectory and update paths to match. Updating `Cargo.toml` is done in the next commit so git tracks the moved file correctly. --- .github/workflows/main.yaml | 2 +- ci/ci-util.py | 6 +-- crates/compiler-builtins-smoke-test/build.rs | 4 +- .../compiler-builtins-smoke-test/src/math.rs | 2 +- crates/libm-test/Cargo.toml | 2 +- crates/libm-test/build.rs | 4 +- crates/musl-math-sys/Cargo.toml | 2 +- crates/util/Cargo.toml | 2 +- crates/util/build.rs | 4 +- etc/update-api-list.py | 18 ++++----- Cargo.toml => libm/Cargo.toml | 0 build.rs => libm/build.rs | 1 + configure.rs => libm/configure.rs | 0 {src => libm/src}/lib.rs | 0 {src => libm/src}/libm_helper.rs | 0 {src => libm/src}/math/acos.rs | 0 {src => libm/src}/math/acosf.rs | 0 {src => libm/src}/math/acosh.rs | 0 {src => libm/src}/math/acoshf.rs | 0 {src => libm/src}/math/arch/aarch64.rs | 0 {src => libm/src}/math/arch/i586.rs | 0 {src => libm/src}/math/arch/i686.rs | 0 {src => libm/src}/math/arch/mod.rs | 0 {src => libm/src}/math/arch/wasm32.rs | 0 {src => libm/src}/math/asin.rs | 0 {src => libm/src}/math/asinf.rs | 0 {src => libm/src}/math/asinh.rs | 0 {src => libm/src}/math/asinhf.rs | 0 {src => libm/src}/math/atan.rs | 0 {src => libm/src}/math/atan2.rs | 0 {src => libm/src}/math/atan2f.rs | 0 {src => libm/src}/math/atanf.rs | 0 {src => libm/src}/math/atanh.rs | 0 {src => libm/src}/math/atanhf.rs | 0 {src => libm/src}/math/cbrt.rs | 0 {src => libm/src}/math/cbrtf.rs | 0 {src => libm/src}/math/ceil.rs | 0 {src => libm/src}/math/copysign.rs | 0 libm/src/math/copysignf.rs | 8 ++++ libm/src/math/copysignf128.rs | 8 ++++ libm/src/math/copysignf16.rs | 8 ++++ {src => libm/src}/math/cos.rs | 0 {src => libm/src}/math/cosf.rs | 0 {src => libm/src}/math/cosh.rs | 0 {src => libm/src}/math/coshf.rs | 0 {src => libm/src}/math/erf.rs | 0 {src => libm/src}/math/erff.rs | 0 {src => libm/src}/math/exp.rs | 0 {src => libm/src}/math/exp10.rs | 0 {src => libm/src}/math/exp10f.rs | 0 {src => libm/src}/math/exp2.rs | 0 {src => libm/src}/math/exp2f.rs | 0 {src => libm/src}/math/expf.rs | 0 {src => libm/src}/math/expm1.rs | 0 {src => libm/src}/math/expm1f.rs | 0 {src => libm/src}/math/expo2.rs | 0 {src => libm/src}/math/fabs.rs | 0 libm/src/math/fabsf.rs | 39 +++++++++++++++++++ libm/src/math/fabsf128.rs | 31 +++++++++++++++ libm/src/math/fabsf16.rs | 31 +++++++++++++++ {src => libm/src}/math/fdim.rs | 0 libm/src/math/fdimf.rs | 12 ++++++ libm/src/math/fdimf128.rs | 12 ++++++ libm/src/math/fdimf16.rs | 12 ++++++ {src => libm/src}/math/floor.rs | 0 libm/src/math/floorf.rs | 13 +++++++ libm/src/math/floorf128.rs | 7 ++++ libm/src/math/floorf16.rs | 7 ++++ {src => libm/src}/math/fma.rs | 0 {src => libm/src}/math/fma_wide.rs | 0 {src => libm/src}/math/fmin_fmax.rs | 0 {src => libm/src}/math/fminimum_fmaximum.rs | 0 .../src}/math/fminimum_fmaximum_num.rs | 0 {src => libm/src}/math/fmod.rs | 0 libm/src/math/fmodf.rs | 5 +++ libm/src/math/fmodf128.rs | 5 +++ libm/src/math/fmodf16.rs | 5 +++ {src => libm/src}/math/frexp.rs | 0 {src => libm/src}/math/frexpf.rs | 0 {src => libm/src}/math/generic/ceil.rs | 0 {src => libm/src}/math/generic/copysign.rs | 0 {src => libm/src}/math/generic/fabs.rs | 0 {src => libm/src}/math/generic/fdim.rs | 0 {src => libm/src}/math/generic/floor.rs | 0 {src => libm/src}/math/generic/fmax.rs | 0 {src => libm/src}/math/generic/fmaximum.rs | 0 .../src}/math/generic/fmaximum_num.rs | 0 {src => libm/src}/math/generic/fmin.rs | 0 {src => libm/src}/math/generic/fminimum.rs | 0 .../src}/math/generic/fminimum_num.rs | 0 {src => libm/src}/math/generic/fmod.rs | 0 {src => libm/src}/math/generic/mod.rs | 0 {src => libm/src}/math/generic/rint.rs | 0 {src => libm/src}/math/generic/round.rs | 0 {src => libm/src}/math/generic/scalbn.rs | 0 {src => libm/src}/math/generic/sqrt.rs | 0 {src => libm/src}/math/generic/trunc.rs | 0 {src => libm/src}/math/hypot.rs | 0 {src => libm/src}/math/hypotf.rs | 0 {src => libm/src}/math/ilogb.rs | 0 {src => libm/src}/math/ilogbf.rs | 0 {src => libm/src}/math/j0.rs | 0 {src => libm/src}/math/j0f.rs | 0 {src => libm/src}/math/j1.rs | 0 {src => libm/src}/math/j1f.rs | 0 {src => libm/src}/math/jn.rs | 0 {src => libm/src}/math/jnf.rs | 0 {src => libm/src}/math/k_cos.rs | 0 {src => libm/src}/math/k_cosf.rs | 0 {src => libm/src}/math/k_expo2.rs | 0 {src => libm/src}/math/k_expo2f.rs | 0 {src => libm/src}/math/k_sin.rs | 0 {src => libm/src}/math/k_sinf.rs | 0 {src => libm/src}/math/k_tan.rs | 0 {src => libm/src}/math/k_tanf.rs | 0 {src => libm/src}/math/ldexp.rs | 0 libm/src/math/ldexpf.rs | 4 ++ libm/src/math/ldexpf128.rs | 4 ++ libm/src/math/ldexpf16.rs | 4 ++ {src => libm/src}/math/lgamma.rs | 0 {src => libm/src}/math/lgamma_r.rs | 0 {src => libm/src}/math/lgammaf.rs | 0 {src => libm/src}/math/lgammaf_r.rs | 0 {src => libm/src}/math/log.rs | 0 {src => libm/src}/math/log10.rs | 0 {src => libm/src}/math/log10f.rs | 0 {src => libm/src}/math/log1p.rs | 0 {src => libm/src}/math/log1pf.rs | 0 {src => libm/src}/math/log2.rs | 0 {src => libm/src}/math/log2f.rs | 0 {src => libm/src}/math/logf.rs | 0 {src => libm/src}/math/mod.rs | 0 {src => libm/src}/math/modf.rs | 0 {src => libm/src}/math/modff.rs | 0 {src => libm/src}/math/nextafter.rs | 0 {src => libm/src}/math/nextafterf.rs | 0 {src => libm/src}/math/pow.rs | 0 {src => libm/src}/math/powf.rs | 0 {src => libm/src}/math/rem_pio2.rs | 0 {src => libm/src}/math/rem_pio2_large.rs | 0 {src => libm/src}/math/rem_pio2f.rs | 0 {src => libm/src}/math/remainder.rs | 0 {src => libm/src}/math/remainderf.rs | 0 {src => libm/src}/math/remquo.rs | 0 {src => libm/src}/math/remquof.rs | 0 {src => libm/src}/math/rint.rs | 0 {src => libm/src}/math/round.rs | 0 {src => libm/src}/math/roundeven.rs | 0 libm/src/math/roundf.rs | 5 +++ libm/src/math/roundf128.rs | 5 +++ libm/src/math/roundf16.rs | 5 +++ {src => libm/src}/math/scalbn.rs | 0 libm/src/math/scalbnf.rs | 4 ++ libm/src/math/scalbnf128.rs | 4 ++ libm/src/math/scalbnf16.rs | 4 ++ {src => libm/src}/math/sin.rs | 0 {src => libm/src}/math/sincos.rs | 0 {src => libm/src}/math/sincosf.rs | 0 {src => libm/src}/math/sinf.rs | 0 {src => libm/src}/math/sinh.rs | 0 {src => libm/src}/math/sinhf.rs | 0 {src => libm/src}/math/sqrt.rs | 0 libm/src/math/sqrtf.rs | 15 +++++++ libm/src/math/sqrtf128.rs | 5 +++ libm/src/math/sqrtf16.rs | 11 ++++++ {src => libm/src}/math/support/big.rs | 0 {src => libm/src}/math/support/big/tests.rs | 0 {src => libm/src}/math/support/env.rs | 0 .../src}/math/support/float_traits.rs | 0 {src => libm/src}/math/support/hex_float.rs | 0 {src => libm/src}/math/support/int_traits.rs | 0 {src => libm/src}/math/support/macros.rs | 0 {src => libm/src}/math/support/mod.rs | 0 {src => libm/src}/math/tan.rs | 0 {src => libm/src}/math/tanf.rs | 0 {src => libm/src}/math/tanh.rs | 0 {src => libm/src}/math/tanhf.rs | 0 {src => libm/src}/math/tgamma.rs | 0 {src => libm/src}/math/tgammaf.rs | 0 {src => libm/src}/math/trunc.rs | 0 libm/src/math/truncf.rs | 23 +++++++++++ libm/src/math/truncf128.rs | 7 ++++ libm/src/math/truncf16.rs | 7 ++++ 183 files changed, 334 insertions(+), 23 deletions(-) rename Cargo.toml => libm/Cargo.toml (100%) rename build.rs => libm/build.rs (88%) rename configure.rs => libm/configure.rs (100%) rename {src => libm/src}/lib.rs (100%) rename {src => libm/src}/libm_helper.rs (100%) rename {src => libm/src}/math/acos.rs (100%) rename {src => libm/src}/math/acosf.rs (100%) rename {src => libm/src}/math/acosh.rs (100%) rename {src => libm/src}/math/acoshf.rs (100%) rename {src => libm/src}/math/arch/aarch64.rs (100%) rename {src => libm/src}/math/arch/i586.rs (100%) rename {src => libm/src}/math/arch/i686.rs (100%) rename {src => libm/src}/math/arch/mod.rs (100%) rename {src => libm/src}/math/arch/wasm32.rs (100%) rename {src => libm/src}/math/asin.rs (100%) rename {src => libm/src}/math/asinf.rs (100%) rename {src => libm/src}/math/asinh.rs (100%) rename {src => libm/src}/math/asinhf.rs (100%) rename {src => libm/src}/math/atan.rs (100%) rename {src => libm/src}/math/atan2.rs (100%) rename {src => libm/src}/math/atan2f.rs (100%) rename {src => libm/src}/math/atanf.rs (100%) rename {src => libm/src}/math/atanh.rs (100%) rename {src => libm/src}/math/atanhf.rs (100%) rename {src => libm/src}/math/cbrt.rs (100%) rename {src => libm/src}/math/cbrtf.rs (100%) rename {src => libm/src}/math/ceil.rs (100%) rename {src => libm/src}/math/copysign.rs (100%) create mode 100644 libm/src/math/copysignf.rs create mode 100644 libm/src/math/copysignf128.rs create mode 100644 libm/src/math/copysignf16.rs rename {src => libm/src}/math/cos.rs (100%) rename {src => libm/src}/math/cosf.rs (100%) rename {src => libm/src}/math/cosh.rs (100%) rename {src => libm/src}/math/coshf.rs (100%) rename {src => libm/src}/math/erf.rs (100%) rename {src => libm/src}/math/erff.rs (100%) rename {src => libm/src}/math/exp.rs (100%) rename {src => libm/src}/math/exp10.rs (100%) rename {src => libm/src}/math/exp10f.rs (100%) rename {src => libm/src}/math/exp2.rs (100%) rename {src => libm/src}/math/exp2f.rs (100%) rename {src => libm/src}/math/expf.rs (100%) rename {src => libm/src}/math/expm1.rs (100%) rename {src => libm/src}/math/expm1f.rs (100%) rename {src => libm/src}/math/expo2.rs (100%) rename {src => libm/src}/math/fabs.rs (100%) create mode 100644 libm/src/math/fabsf.rs create mode 100644 libm/src/math/fabsf128.rs create mode 100644 libm/src/math/fabsf16.rs rename {src => libm/src}/math/fdim.rs (100%) create mode 100644 libm/src/math/fdimf.rs create mode 100644 libm/src/math/fdimf128.rs create mode 100644 libm/src/math/fdimf16.rs rename {src => libm/src}/math/floor.rs (100%) create mode 100644 libm/src/math/floorf.rs create mode 100644 libm/src/math/floorf128.rs create mode 100644 libm/src/math/floorf16.rs rename {src => libm/src}/math/fma.rs (100%) rename {src => libm/src}/math/fma_wide.rs (100%) rename {src => libm/src}/math/fmin_fmax.rs (100%) rename {src => libm/src}/math/fminimum_fmaximum.rs (100%) rename {src => libm/src}/math/fminimum_fmaximum_num.rs (100%) rename {src => libm/src}/math/fmod.rs (100%) create mode 100644 libm/src/math/fmodf.rs create mode 100644 libm/src/math/fmodf128.rs create mode 100644 libm/src/math/fmodf16.rs rename {src => libm/src}/math/frexp.rs (100%) rename {src => libm/src}/math/frexpf.rs (100%) rename {src => libm/src}/math/generic/ceil.rs (100%) rename {src => libm/src}/math/generic/copysign.rs (100%) rename {src => libm/src}/math/generic/fabs.rs (100%) rename {src => libm/src}/math/generic/fdim.rs (100%) rename {src => libm/src}/math/generic/floor.rs (100%) rename {src => libm/src}/math/generic/fmax.rs (100%) rename {src => libm/src}/math/generic/fmaximum.rs (100%) rename {src => libm/src}/math/generic/fmaximum_num.rs (100%) rename {src => libm/src}/math/generic/fmin.rs (100%) rename {src => libm/src}/math/generic/fminimum.rs (100%) rename {src => libm/src}/math/generic/fminimum_num.rs (100%) rename {src => libm/src}/math/generic/fmod.rs (100%) rename {src => libm/src}/math/generic/mod.rs (100%) rename {src => libm/src}/math/generic/rint.rs (100%) rename {src => libm/src}/math/generic/round.rs (100%) rename {src => libm/src}/math/generic/scalbn.rs (100%) rename {src => libm/src}/math/generic/sqrt.rs (100%) rename {src => libm/src}/math/generic/trunc.rs (100%) rename {src => libm/src}/math/hypot.rs (100%) rename {src => libm/src}/math/hypotf.rs (100%) rename {src => libm/src}/math/ilogb.rs (100%) rename {src => libm/src}/math/ilogbf.rs (100%) rename {src => libm/src}/math/j0.rs (100%) rename {src => libm/src}/math/j0f.rs (100%) rename {src => libm/src}/math/j1.rs (100%) rename {src => libm/src}/math/j1f.rs (100%) rename {src => libm/src}/math/jn.rs (100%) rename {src => libm/src}/math/jnf.rs (100%) rename {src => libm/src}/math/k_cos.rs (100%) rename {src => libm/src}/math/k_cosf.rs (100%) rename {src => libm/src}/math/k_expo2.rs (100%) rename {src => libm/src}/math/k_expo2f.rs (100%) rename {src => libm/src}/math/k_sin.rs (100%) rename {src => libm/src}/math/k_sinf.rs (100%) rename {src => libm/src}/math/k_tan.rs (100%) rename {src => libm/src}/math/k_tanf.rs (100%) rename {src => libm/src}/math/ldexp.rs (100%) create mode 100644 libm/src/math/ldexpf.rs create mode 100644 libm/src/math/ldexpf128.rs create mode 100644 libm/src/math/ldexpf16.rs rename {src => libm/src}/math/lgamma.rs (100%) rename {src => libm/src}/math/lgamma_r.rs (100%) rename {src => libm/src}/math/lgammaf.rs (100%) rename {src => libm/src}/math/lgammaf_r.rs (100%) rename {src => libm/src}/math/log.rs (100%) rename {src => libm/src}/math/log10.rs (100%) rename {src => libm/src}/math/log10f.rs (100%) rename {src => libm/src}/math/log1p.rs (100%) rename {src => libm/src}/math/log1pf.rs (100%) rename {src => libm/src}/math/log2.rs (100%) rename {src => libm/src}/math/log2f.rs (100%) rename {src => libm/src}/math/logf.rs (100%) rename {src => libm/src}/math/mod.rs (100%) rename {src => libm/src}/math/modf.rs (100%) rename {src => libm/src}/math/modff.rs (100%) rename {src => libm/src}/math/nextafter.rs (100%) rename {src => libm/src}/math/nextafterf.rs (100%) rename {src => libm/src}/math/pow.rs (100%) rename {src => libm/src}/math/powf.rs (100%) rename {src => libm/src}/math/rem_pio2.rs (100%) rename {src => libm/src}/math/rem_pio2_large.rs (100%) rename {src => libm/src}/math/rem_pio2f.rs (100%) rename {src => libm/src}/math/remainder.rs (100%) rename {src => libm/src}/math/remainderf.rs (100%) rename {src => libm/src}/math/remquo.rs (100%) rename {src => libm/src}/math/remquof.rs (100%) rename {src => libm/src}/math/rint.rs (100%) rename {src => libm/src}/math/round.rs (100%) rename {src => libm/src}/math/roundeven.rs (100%) create mode 100644 libm/src/math/roundf.rs create mode 100644 libm/src/math/roundf128.rs create mode 100644 libm/src/math/roundf16.rs rename {src => libm/src}/math/scalbn.rs (100%) create mode 100644 libm/src/math/scalbnf.rs create mode 100644 libm/src/math/scalbnf128.rs create mode 100644 libm/src/math/scalbnf16.rs rename {src => libm/src}/math/sin.rs (100%) rename {src => libm/src}/math/sincos.rs (100%) rename {src => libm/src}/math/sincosf.rs (100%) rename {src => libm/src}/math/sinf.rs (100%) rename {src => libm/src}/math/sinh.rs (100%) rename {src => libm/src}/math/sinhf.rs (100%) rename {src => libm/src}/math/sqrt.rs (100%) create mode 100644 libm/src/math/sqrtf.rs create mode 100644 libm/src/math/sqrtf128.rs create mode 100644 libm/src/math/sqrtf16.rs rename {src => libm/src}/math/support/big.rs (100%) rename {src => libm/src}/math/support/big/tests.rs (100%) rename {src => libm/src}/math/support/env.rs (100%) rename {src => libm/src}/math/support/float_traits.rs (100%) rename {src => libm/src}/math/support/hex_float.rs (100%) rename {src => libm/src}/math/support/int_traits.rs (100%) rename {src => libm/src}/math/support/macros.rs (100%) rename {src => libm/src}/math/support/mod.rs (100%) rename {src => libm/src}/math/tan.rs (100%) rename {src => libm/src}/math/tanf.rs (100%) rename {src => libm/src}/math/tanh.rs (100%) rename {src => libm/src}/math/tanhf.rs (100%) rename {src => libm/src}/math/tgamma.rs (100%) rename {src => libm/src}/math/tgammaf.rs (100%) rename {src => libm/src}/math/trunc.rs (100%) create mode 100644 libm/src/math/truncf.rs create mode 100644 libm/src/math/truncf128.rs create mode 100644 libm/src/math/truncf16.rs diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c925e63aa..a717c3ea8 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -213,7 +213,7 @@ jobs: steps: - uses: actions/checkout@master - run: | - msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' Cargo.toml)" + msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' libm/Cargo.toml)" echo "MSRV: $msrv" echo "MSRV=$msrv" >> "$GITHUB_ENV" - name: Install Rust diff --git a/ci/ci-util.py b/ci/ci-util.py index 7468fd690..ed63d6dee 100755 --- a/ci/ci-util.py +++ b/ci/ci-util.py @@ -63,9 +63,9 @@ # Don't run exhaustive tests if these files change, even if they contaiin a function # definition. IGNORE_FILES = [ - "src/math/support/", - "src/libm_helper.rs", - "src/math/arch/intrinsics.rs", + "libm/src/math/support/", + "libm/src/libm_helper.rs", + "libm/src/math/arch/intrinsics.rs", ] TYPES = ["f16", "f32", "f64", "f128"] diff --git a/crates/compiler-builtins-smoke-test/build.rs b/crates/compiler-builtins-smoke-test/build.rs index 4ee5ab585..ef8d613c9 100644 --- a/crates/compiler-builtins-smoke-test/build.rs +++ b/crates/compiler-builtins-smoke-test/build.rs @@ -1,8 +1,8 @@ -#[path = "../../configure.rs"] +#[path = "../../libm/configure.rs"] mod configure; fn main() { - println!("cargo:rerun-if-changed=../../configure.rs"); + println!("cargo:rerun-if-changed=../../libm/configure.rs"); let cfg = configure::Config::from_env(); configure::emit_libm_config(&cfg); } diff --git a/crates/compiler-builtins-smoke-test/src/math.rs b/crates/compiler-builtins-smoke-test/src/math.rs index 7e0146998..f17fc1231 100644 --- a/crates/compiler-builtins-smoke-test/src/math.rs +++ b/crates/compiler-builtins-smoke-test/src/math.rs @@ -3,7 +3,7 @@ use core::ffi::c_int; #[allow(dead_code)] #[allow(clippy::all)] // We don't get `libm`'s list of `allow`s, so just ignore Clippy. #[allow(unused_imports)] -#[path = "../../../src/math/mod.rs"] +#[path = "../../../libm/src/math/mod.rs"] pub mod libm; /// Mark functions `#[no_mangle]` and with the C ABI. diff --git a/crates/libm-test/Cargo.toml b/crates/libm-test/Cargo.toml index 98da73cea..1bcc163ed 100644 --- a/crates/libm-test/Cargo.toml +++ b/crates/libm-test/Cargo.toml @@ -32,7 +32,7 @@ anyhow = "1.0.97" gmp-mpfr-sys = { version = "1.6.4", optional = true, default-features = false } iai-callgrind = { version = "0.14.0", optional = true } indicatif = { version = "0.17.11", default-features = false } -libm = { path = "../..", features = ["unstable-public-internals"] } +libm = { path = "../../libm", features = ["unstable-public-internals"] } libm-macros = { path = "../libm-macros" } musl-math-sys = { path = "../musl-math-sys", optional = true } paste = "1.0.15" diff --git a/crates/libm-test/build.rs b/crates/libm-test/build.rs index d2d0df9cb..f75e3dda5 100644 --- a/crates/libm-test/build.rs +++ b/crates/libm-test/build.rs @@ -1,9 +1,9 @@ -#[path = "../../configure.rs"] +#[path = "../../libm/configure.rs"] mod configure; use configure::Config; fn main() { - println!("cargo:rerun-if-changed=../../configure.rs"); + println!("cargo:rerun-if-changed=../../libm/configure.rs"); let cfg = Config::from_env(); configure::emit_test_config(&cfg); } diff --git a/crates/musl-math-sys/Cargo.toml b/crates/musl-math-sys/Cargo.toml index 34682b74c..ad73578d8 100644 --- a/crates/musl-math-sys/Cargo.toml +++ b/crates/musl-math-sys/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] [dev-dependencies] -libm = { path = "../../" } +libm = { path = "../../libm" } [build-dependencies] cc = "1.2.16" diff --git a/crates/util/Cargo.toml b/crates/util/Cargo.toml index 8005459db..94c7f1033 100644 --- a/crates/util/Cargo.toml +++ b/crates/util/Cargo.toml @@ -11,7 +11,7 @@ build-mpfr = ["libm-test/build-mpfr", "dep:rug"] unstable-float = ["libm/unstable-float", "libm-test/unstable-float", "rug?/nightly-float"] [dependencies] -libm = { path = "../..", default-features = false } +libm = { path = "../../libm", default-features = false } libm-macros = { path = "../libm-macros" } libm-test = { path = "../libm-test", default-features = false } musl-math-sys = { path = "../musl-math-sys", optional = true } diff --git a/crates/util/build.rs b/crates/util/build.rs index b6cceb5f1..a1be41275 100644 --- a/crates/util/build.rs +++ b/crates/util/build.rs @@ -1,10 +1,10 @@ #![allow(unexpected_cfgs)] -#[path = "../../configure.rs"] +#[path = "../../libm/configure.rs"] mod configure; fn main() { - println!("cargo:rerun-if-changed=../../configure.rs"); + println!("cargo:rerun-if-changed=../../libm/configure.rs"); let cfg = configure::Config::from_env(); configure::emit_libm_config(&cfg); } diff --git a/etc/update-api-list.py b/etc/update-api-list.py index b4ce2c453..950824fc4 100755 --- a/etc/update-api-list.py +++ b/etc/update-api-list.py @@ -18,7 +18,7 @@ SELF_PATH = Path(__file__) ETC_DIR = SELF_PATH.parent -ROOT_DIR = ETC_DIR.parent +LIBM_DIR = ETC_DIR.parent.joinpath("libm") # These files do not trigger a retest. IGNORED_SOURCES = ["src/libm_helper.rs", "src/math/support/float_traits.rs"] @@ -75,7 +75,7 @@ def get_rustdoc_json() -> dict[Any, Any]: "-Zunstable-options", "-o-", ], - cwd=ROOT_DIR, + cwd=LIBM_DIR, text=True, ) j = json.loads(j) @@ -121,8 +121,8 @@ def _init_defs(self, index: IndexTy) -> None: # A lot of the `arch` module is often configured out so doesn't show up in docs. Use # string matching as a fallback. - for fname in glob("src/math/arch/**.rs", root_dir=ROOT_DIR): - contents = (ROOT_DIR.joinpath(fname)).read_text() + for fname in glob("src/math/arch/**.rs", root_dir=LIBM_DIR): + contents = (LIBM_DIR.joinpath(fname)).read_text() for name in self.public_functions: if f"fn {name}" in contents: @@ -188,10 +188,10 @@ def tidy_lists(self) -> None: include all public API. """ - flist = sp.check_output(["git", "ls-files"], cwd=ROOT_DIR, text=True) + flist = sp.check_output(["git", "ls-files"], cwd=LIBM_DIR, text=True) for path in flist.splitlines(): - fpath = ROOT_DIR.joinpath(path) + fpath = LIBM_DIR.joinpath(path) if fpath.is_dir() or fpath == SELF_PATH: continue @@ -229,7 +229,7 @@ def ensure_contains_api(self, fpath: Path, line_num: int, lines: list[str]): if len(not_found) == 0: return - relpath = fpath.relative_to(ROOT_DIR) + relpath = fpath.relative_to(LIBM_DIR) eprint(f"functions not found at {relpath}:{line_num}: {not_found}") exit(1) @@ -244,7 +244,7 @@ def validate_delimited_block( """Identify blocks of code wrapped within `start` and `end`, collect their contents to a list of strings, and call `validate` for each of those lists. """ - relpath = fpath.relative_to(ROOT_DIR) + relpath = fpath.relative_to(LIBM_DIR) block_lines = [] block_start_line: None | int = None for line_num, line in enumerate(lines): @@ -274,7 +274,7 @@ def validate_delimited_block( def ensure_sorted(fpath: Path, block_start_line: int, lines: list[str]) -> None: """Ensure that a list of lines is sorted, otherwise print a diff and exit.""" - relpath = fpath.relative_to(ROOT_DIR) + relpath = fpath.relative_to(LIBM_DIR) diff_and_exit( "\n".join(lines), "\n".join(sorted(lines)), diff --git a/Cargo.toml b/libm/Cargo.toml similarity index 100% rename from Cargo.toml rename to libm/Cargo.toml diff --git a/build.rs b/libm/build.rs similarity index 88% rename from build.rs rename to libm/build.rs index 7042b54d7..07d08ed43 100644 --- a/build.rs +++ b/libm/build.rs @@ -6,6 +6,7 @@ fn main() { let cfg = configure::Config::from_env(); println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=configure.rs"); println!("cargo:rustc-check-cfg=cfg(assert_no_panic)"); // If set, enable `no-panic`. Requires LTO (`release-opt` profile). diff --git a/configure.rs b/libm/configure.rs similarity index 100% rename from configure.rs rename to libm/configure.rs diff --git a/src/lib.rs b/libm/src/lib.rs similarity index 100% rename from src/lib.rs rename to libm/src/lib.rs diff --git a/src/libm_helper.rs b/libm/src/libm_helper.rs similarity index 100% rename from src/libm_helper.rs rename to libm/src/libm_helper.rs diff --git a/src/math/acos.rs b/libm/src/math/acos.rs similarity index 100% rename from src/math/acos.rs rename to libm/src/math/acos.rs diff --git a/src/math/acosf.rs b/libm/src/math/acosf.rs similarity index 100% rename from src/math/acosf.rs rename to libm/src/math/acosf.rs diff --git a/src/math/acosh.rs b/libm/src/math/acosh.rs similarity index 100% rename from src/math/acosh.rs rename to libm/src/math/acosh.rs diff --git a/src/math/acoshf.rs b/libm/src/math/acoshf.rs similarity index 100% rename from src/math/acoshf.rs rename to libm/src/math/acoshf.rs diff --git a/src/math/arch/aarch64.rs b/libm/src/math/arch/aarch64.rs similarity index 100% rename from src/math/arch/aarch64.rs rename to libm/src/math/arch/aarch64.rs diff --git a/src/math/arch/i586.rs b/libm/src/math/arch/i586.rs similarity index 100% rename from src/math/arch/i586.rs rename to libm/src/math/arch/i586.rs diff --git a/src/math/arch/i686.rs b/libm/src/math/arch/i686.rs similarity index 100% rename from src/math/arch/i686.rs rename to libm/src/math/arch/i686.rs diff --git a/src/math/arch/mod.rs b/libm/src/math/arch/mod.rs similarity index 100% rename from src/math/arch/mod.rs rename to libm/src/math/arch/mod.rs diff --git a/src/math/arch/wasm32.rs b/libm/src/math/arch/wasm32.rs similarity index 100% rename from src/math/arch/wasm32.rs rename to libm/src/math/arch/wasm32.rs diff --git a/src/math/asin.rs b/libm/src/math/asin.rs similarity index 100% rename from src/math/asin.rs rename to libm/src/math/asin.rs diff --git a/src/math/asinf.rs b/libm/src/math/asinf.rs similarity index 100% rename from src/math/asinf.rs rename to libm/src/math/asinf.rs diff --git a/src/math/asinh.rs b/libm/src/math/asinh.rs similarity index 100% rename from src/math/asinh.rs rename to libm/src/math/asinh.rs diff --git a/src/math/asinhf.rs b/libm/src/math/asinhf.rs similarity index 100% rename from src/math/asinhf.rs rename to libm/src/math/asinhf.rs diff --git a/src/math/atan.rs b/libm/src/math/atan.rs similarity index 100% rename from src/math/atan.rs rename to libm/src/math/atan.rs diff --git a/src/math/atan2.rs b/libm/src/math/atan2.rs similarity index 100% rename from src/math/atan2.rs rename to libm/src/math/atan2.rs diff --git a/src/math/atan2f.rs b/libm/src/math/atan2f.rs similarity index 100% rename from src/math/atan2f.rs rename to libm/src/math/atan2f.rs diff --git a/src/math/atanf.rs b/libm/src/math/atanf.rs similarity index 100% rename from src/math/atanf.rs rename to libm/src/math/atanf.rs diff --git a/src/math/atanh.rs b/libm/src/math/atanh.rs similarity index 100% rename from src/math/atanh.rs rename to libm/src/math/atanh.rs diff --git a/src/math/atanhf.rs b/libm/src/math/atanhf.rs similarity index 100% rename from src/math/atanhf.rs rename to libm/src/math/atanhf.rs diff --git a/src/math/cbrt.rs b/libm/src/math/cbrt.rs similarity index 100% rename from src/math/cbrt.rs rename to libm/src/math/cbrt.rs diff --git a/src/math/cbrtf.rs b/libm/src/math/cbrtf.rs similarity index 100% rename from src/math/cbrtf.rs rename to libm/src/math/cbrtf.rs diff --git a/src/math/ceil.rs b/libm/src/math/ceil.rs similarity index 100% rename from src/math/ceil.rs rename to libm/src/math/ceil.rs diff --git a/src/math/copysign.rs b/libm/src/math/copysign.rs similarity index 100% rename from src/math/copysign.rs rename to libm/src/math/copysign.rs diff --git a/libm/src/math/copysignf.rs b/libm/src/math/copysignf.rs new file mode 100644 index 000000000..8b9bed4c0 --- /dev/null +++ b/libm/src/math/copysignf.rs @@ -0,0 +1,8 @@ +/// Sign of Y, magnitude of X (f32) +/// +/// Constructs a number with the magnitude (absolute value) of its +/// first argument, `x`, and the sign of its second argument, `y`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn copysignf(x: f32, y: f32) -> f32 { + super::generic::copysign(x, y) +} diff --git a/libm/src/math/copysignf128.rs b/libm/src/math/copysignf128.rs new file mode 100644 index 000000000..7bd81d42b --- /dev/null +++ b/libm/src/math/copysignf128.rs @@ -0,0 +1,8 @@ +/// Sign of Y, magnitude of X (f128) +/// +/// Constructs a number with the magnitude (absolute value) of its +/// first argument, `x`, and the sign of its second argument, `y`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn copysignf128(x: f128, y: f128) -> f128 { + super::generic::copysign(x, y) +} diff --git a/libm/src/math/copysignf16.rs b/libm/src/math/copysignf16.rs new file mode 100644 index 000000000..820658686 --- /dev/null +++ b/libm/src/math/copysignf16.rs @@ -0,0 +1,8 @@ +/// Sign of Y, magnitude of X (f16) +/// +/// Constructs a number with the magnitude (absolute value) of its +/// first argument, `x`, and the sign of its second argument, `y`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn copysignf16(x: f16, y: f16) -> f16 { + super::generic::copysign(x, y) +} diff --git a/src/math/cos.rs b/libm/src/math/cos.rs similarity index 100% rename from src/math/cos.rs rename to libm/src/math/cos.rs diff --git a/src/math/cosf.rs b/libm/src/math/cosf.rs similarity index 100% rename from src/math/cosf.rs rename to libm/src/math/cosf.rs diff --git a/src/math/cosh.rs b/libm/src/math/cosh.rs similarity index 100% rename from src/math/cosh.rs rename to libm/src/math/cosh.rs diff --git a/src/math/coshf.rs b/libm/src/math/coshf.rs similarity index 100% rename from src/math/coshf.rs rename to libm/src/math/coshf.rs diff --git a/src/math/erf.rs b/libm/src/math/erf.rs similarity index 100% rename from src/math/erf.rs rename to libm/src/math/erf.rs diff --git a/src/math/erff.rs b/libm/src/math/erff.rs similarity index 100% rename from src/math/erff.rs rename to libm/src/math/erff.rs diff --git a/src/math/exp.rs b/libm/src/math/exp.rs similarity index 100% rename from src/math/exp.rs rename to libm/src/math/exp.rs diff --git a/src/math/exp10.rs b/libm/src/math/exp10.rs similarity index 100% rename from src/math/exp10.rs rename to libm/src/math/exp10.rs diff --git a/src/math/exp10f.rs b/libm/src/math/exp10f.rs similarity index 100% rename from src/math/exp10f.rs rename to libm/src/math/exp10f.rs diff --git a/src/math/exp2.rs b/libm/src/math/exp2.rs similarity index 100% rename from src/math/exp2.rs rename to libm/src/math/exp2.rs diff --git a/src/math/exp2f.rs b/libm/src/math/exp2f.rs similarity index 100% rename from src/math/exp2f.rs rename to libm/src/math/exp2f.rs diff --git a/src/math/expf.rs b/libm/src/math/expf.rs similarity index 100% rename from src/math/expf.rs rename to libm/src/math/expf.rs diff --git a/src/math/expm1.rs b/libm/src/math/expm1.rs similarity index 100% rename from src/math/expm1.rs rename to libm/src/math/expm1.rs diff --git a/src/math/expm1f.rs b/libm/src/math/expm1f.rs similarity index 100% rename from src/math/expm1f.rs rename to libm/src/math/expm1f.rs diff --git a/src/math/expo2.rs b/libm/src/math/expo2.rs similarity index 100% rename from src/math/expo2.rs rename to libm/src/math/expo2.rs diff --git a/src/math/fabs.rs b/libm/src/math/fabs.rs similarity index 100% rename from src/math/fabs.rs rename to libm/src/math/fabs.rs diff --git a/libm/src/math/fabsf.rs b/libm/src/math/fabsf.rs new file mode 100644 index 000000000..e5820a26c --- /dev/null +++ b/libm/src/math/fabsf.rs @@ -0,0 +1,39 @@ +/// Absolute value (magnitude) (f32) +/// +/// Calculates the absolute value (magnitude) of the argument `x`, +/// by direct manipulation of the bit representation of `x`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fabsf(x: f32) -> f32 { + select_implementation! { + name: fabsf, + use_arch: all(target_arch = "wasm32", intrinsics_enabled), + args: x, + } + + super::generic::fabs(x) +} + +// PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520 +#[cfg(not(target_arch = "powerpc64"))] +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn sanity_check() { + assert_eq!(fabsf(-1.0), 1.0); + assert_eq!(fabsf(2.8), 2.8); + } + + /// The spec: https://en.cppreference.com/w/cpp/numeric/math/fabs + #[test] + fn spec_tests() { + assert!(fabsf(f32::NAN).is_nan()); + for f in [0.0, -0.0].iter().copied() { + assert_eq!(fabsf(f), 0.0); + } + for f in [f32::INFINITY, f32::NEG_INFINITY].iter().copied() { + assert_eq!(fabsf(f), f32::INFINITY); + } + } +} diff --git a/libm/src/math/fabsf128.rs b/libm/src/math/fabsf128.rs new file mode 100644 index 000000000..46429ca49 --- /dev/null +++ b/libm/src/math/fabsf128.rs @@ -0,0 +1,31 @@ +/// Absolute value (magnitude) (f128) +/// +/// Calculates the absolute value (magnitude) of the argument `x`, +/// by direct manipulation of the bit representation of `x`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fabsf128(x: f128) -> f128 { + super::generic::fabs(x) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn sanity_check() { + assert_eq!(fabsf128(-1.0), 1.0); + assert_eq!(fabsf128(2.8), 2.8); + } + + /// The spec: https://en.cppreference.com/w/cpp/numeric/math/fabs + #[test] + fn spec_tests() { + assert!(fabsf128(f128::NAN).is_nan()); + for f in [0.0, -0.0].iter().copied() { + assert_eq!(fabsf128(f), 0.0); + } + for f in [f128::INFINITY, f128::NEG_INFINITY].iter().copied() { + assert_eq!(fabsf128(f), f128::INFINITY); + } + } +} diff --git a/libm/src/math/fabsf16.rs b/libm/src/math/fabsf16.rs new file mode 100644 index 000000000..eee42ac6a --- /dev/null +++ b/libm/src/math/fabsf16.rs @@ -0,0 +1,31 @@ +/// Absolute value (magnitude) (f16) +/// +/// Calculates the absolute value (magnitude) of the argument `x`, +/// by direct manipulation of the bit representation of `x`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fabsf16(x: f16) -> f16 { + super::generic::fabs(x) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn sanity_check() { + assert_eq!(fabsf16(-1.0), 1.0); + assert_eq!(fabsf16(2.8), 2.8); + } + + /// The spec: https://en.cppreference.com/w/cpp/numeric/math/fabs + #[test] + fn spec_tests() { + assert!(fabsf16(f16::NAN).is_nan()); + for f in [0.0, -0.0].iter().copied() { + assert_eq!(fabsf16(f), 0.0); + } + for f in [f16::INFINITY, f16::NEG_INFINITY].iter().copied() { + assert_eq!(fabsf16(f), f16::INFINITY); + } + } +} diff --git a/src/math/fdim.rs b/libm/src/math/fdim.rs similarity index 100% rename from src/math/fdim.rs rename to libm/src/math/fdim.rs diff --git a/libm/src/math/fdimf.rs b/libm/src/math/fdimf.rs new file mode 100644 index 000000000..367ef517c --- /dev/null +++ b/libm/src/math/fdimf.rs @@ -0,0 +1,12 @@ +/// Positive difference (f32) +/// +/// Determines the positive difference between arguments, returning: +/// * x - y if x > y, or +/// * +0 if x <= y, or +/// * NAN if either argument is NAN. +/// +/// A range error may occur. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fdimf(x: f32, y: f32) -> f32 { + super::generic::fdim(x, y) +} diff --git a/libm/src/math/fdimf128.rs b/libm/src/math/fdimf128.rs new file mode 100644 index 000000000..6f3d1d0ff --- /dev/null +++ b/libm/src/math/fdimf128.rs @@ -0,0 +1,12 @@ +/// Positive difference (f128) +/// +/// Determines the positive difference between arguments, returning: +/// * x - y if x > y, or +/// * +0 if x <= y, or +/// * NAN if either argument is NAN. +/// +/// A range error may occur. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fdimf128(x: f128, y: f128) -> f128 { + super::generic::fdim(x, y) +} diff --git a/libm/src/math/fdimf16.rs b/libm/src/math/fdimf16.rs new file mode 100644 index 000000000..37bd68858 --- /dev/null +++ b/libm/src/math/fdimf16.rs @@ -0,0 +1,12 @@ +/// Positive difference (f16) +/// +/// Determines the positive difference between arguments, returning: +/// * x - y if x > y, or +/// * +0 if x <= y, or +/// * NAN if either argument is NAN. +/// +/// A range error may occur. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fdimf16(x: f16, y: f16) -> f16 { + super::generic::fdim(x, y) +} diff --git a/src/math/floor.rs b/libm/src/math/floor.rs similarity index 100% rename from src/math/floor.rs rename to libm/src/math/floor.rs diff --git a/libm/src/math/floorf.rs b/libm/src/math/floorf.rs new file mode 100644 index 000000000..16957b7f3 --- /dev/null +++ b/libm/src/math/floorf.rs @@ -0,0 +1,13 @@ +/// Floor (f32) +/// +/// Finds the nearest integer less than or equal to `x`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn floorf(x: f32) -> f32 { + select_implementation! { + name: floorf, + use_arch: all(target_arch = "wasm32", intrinsics_enabled), + args: x, + } + + return super::generic::floor(x); +} diff --git a/libm/src/math/floorf128.rs b/libm/src/math/floorf128.rs new file mode 100644 index 000000000..9a9fe4151 --- /dev/null +++ b/libm/src/math/floorf128.rs @@ -0,0 +1,7 @@ +/// Floor (f128) +/// +/// Finds the nearest integer less than or equal to `x`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn floorf128(x: f128) -> f128 { + return super::generic::floor(x); +} diff --git a/libm/src/math/floorf16.rs b/libm/src/math/floorf16.rs new file mode 100644 index 000000000..f9b868e04 --- /dev/null +++ b/libm/src/math/floorf16.rs @@ -0,0 +1,7 @@ +/// Floor (f16) +/// +/// Finds the nearest integer less than or equal to `x`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn floorf16(x: f16) -> f16 { + return super::generic::floor(x); +} diff --git a/src/math/fma.rs b/libm/src/math/fma.rs similarity index 100% rename from src/math/fma.rs rename to libm/src/math/fma.rs diff --git a/src/math/fma_wide.rs b/libm/src/math/fma_wide.rs similarity index 100% rename from src/math/fma_wide.rs rename to libm/src/math/fma_wide.rs diff --git a/src/math/fmin_fmax.rs b/libm/src/math/fmin_fmax.rs similarity index 100% rename from src/math/fmin_fmax.rs rename to libm/src/math/fmin_fmax.rs diff --git a/src/math/fminimum_fmaximum.rs b/libm/src/math/fminimum_fmaximum.rs similarity index 100% rename from src/math/fminimum_fmaximum.rs rename to libm/src/math/fminimum_fmaximum.rs diff --git a/src/math/fminimum_fmaximum_num.rs b/libm/src/math/fminimum_fmaximum_num.rs similarity index 100% rename from src/math/fminimum_fmaximum_num.rs rename to libm/src/math/fminimum_fmaximum_num.rs diff --git a/src/math/fmod.rs b/libm/src/math/fmod.rs similarity index 100% rename from src/math/fmod.rs rename to libm/src/math/fmod.rs diff --git a/libm/src/math/fmodf.rs b/libm/src/math/fmodf.rs new file mode 100644 index 000000000..4e95696e2 --- /dev/null +++ b/libm/src/math/fmodf.rs @@ -0,0 +1,5 @@ +/// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fmodf(x: f32, y: f32) -> f32 { + super::generic::fmod(x, y) +} diff --git a/libm/src/math/fmodf128.rs b/libm/src/math/fmodf128.rs new file mode 100644 index 000000000..ff0e0493e --- /dev/null +++ b/libm/src/math/fmodf128.rs @@ -0,0 +1,5 @@ +/// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fmodf128(x: f128, y: f128) -> f128 { + super::generic::fmod(x, y) +} diff --git a/libm/src/math/fmodf16.rs b/libm/src/math/fmodf16.rs new file mode 100644 index 000000000..11972a7de --- /dev/null +++ b/libm/src/math/fmodf16.rs @@ -0,0 +1,5 @@ +/// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn fmodf16(x: f16, y: f16) -> f16 { + super::generic::fmod(x, y) +} diff --git a/src/math/frexp.rs b/libm/src/math/frexp.rs similarity index 100% rename from src/math/frexp.rs rename to libm/src/math/frexp.rs diff --git a/src/math/frexpf.rs b/libm/src/math/frexpf.rs similarity index 100% rename from src/math/frexpf.rs rename to libm/src/math/frexpf.rs diff --git a/src/math/generic/ceil.rs b/libm/src/math/generic/ceil.rs similarity index 100% rename from src/math/generic/ceil.rs rename to libm/src/math/generic/ceil.rs diff --git a/src/math/generic/copysign.rs b/libm/src/math/generic/copysign.rs similarity index 100% rename from src/math/generic/copysign.rs rename to libm/src/math/generic/copysign.rs diff --git a/src/math/generic/fabs.rs b/libm/src/math/generic/fabs.rs similarity index 100% rename from src/math/generic/fabs.rs rename to libm/src/math/generic/fabs.rs diff --git a/src/math/generic/fdim.rs b/libm/src/math/generic/fdim.rs similarity index 100% rename from src/math/generic/fdim.rs rename to libm/src/math/generic/fdim.rs diff --git a/src/math/generic/floor.rs b/libm/src/math/generic/floor.rs similarity index 100% rename from src/math/generic/floor.rs rename to libm/src/math/generic/floor.rs diff --git a/src/math/generic/fmax.rs b/libm/src/math/generic/fmax.rs similarity index 100% rename from src/math/generic/fmax.rs rename to libm/src/math/generic/fmax.rs diff --git a/src/math/generic/fmaximum.rs b/libm/src/math/generic/fmaximum.rs similarity index 100% rename from src/math/generic/fmaximum.rs rename to libm/src/math/generic/fmaximum.rs diff --git a/src/math/generic/fmaximum_num.rs b/libm/src/math/generic/fmaximum_num.rs similarity index 100% rename from src/math/generic/fmaximum_num.rs rename to libm/src/math/generic/fmaximum_num.rs diff --git a/src/math/generic/fmin.rs b/libm/src/math/generic/fmin.rs similarity index 100% rename from src/math/generic/fmin.rs rename to libm/src/math/generic/fmin.rs diff --git a/src/math/generic/fminimum.rs b/libm/src/math/generic/fminimum.rs similarity index 100% rename from src/math/generic/fminimum.rs rename to libm/src/math/generic/fminimum.rs diff --git a/src/math/generic/fminimum_num.rs b/libm/src/math/generic/fminimum_num.rs similarity index 100% rename from src/math/generic/fminimum_num.rs rename to libm/src/math/generic/fminimum_num.rs diff --git a/src/math/generic/fmod.rs b/libm/src/math/generic/fmod.rs similarity index 100% rename from src/math/generic/fmod.rs rename to libm/src/math/generic/fmod.rs diff --git a/src/math/generic/mod.rs b/libm/src/math/generic/mod.rs similarity index 100% rename from src/math/generic/mod.rs rename to libm/src/math/generic/mod.rs diff --git a/src/math/generic/rint.rs b/libm/src/math/generic/rint.rs similarity index 100% rename from src/math/generic/rint.rs rename to libm/src/math/generic/rint.rs diff --git a/src/math/generic/round.rs b/libm/src/math/generic/round.rs similarity index 100% rename from src/math/generic/round.rs rename to libm/src/math/generic/round.rs diff --git a/src/math/generic/scalbn.rs b/libm/src/math/generic/scalbn.rs similarity index 100% rename from src/math/generic/scalbn.rs rename to libm/src/math/generic/scalbn.rs diff --git a/src/math/generic/sqrt.rs b/libm/src/math/generic/sqrt.rs similarity index 100% rename from src/math/generic/sqrt.rs rename to libm/src/math/generic/sqrt.rs diff --git a/src/math/generic/trunc.rs b/libm/src/math/generic/trunc.rs similarity index 100% rename from src/math/generic/trunc.rs rename to libm/src/math/generic/trunc.rs diff --git a/src/math/hypot.rs b/libm/src/math/hypot.rs similarity index 100% rename from src/math/hypot.rs rename to libm/src/math/hypot.rs diff --git a/src/math/hypotf.rs b/libm/src/math/hypotf.rs similarity index 100% rename from src/math/hypotf.rs rename to libm/src/math/hypotf.rs diff --git a/src/math/ilogb.rs b/libm/src/math/ilogb.rs similarity index 100% rename from src/math/ilogb.rs rename to libm/src/math/ilogb.rs diff --git a/src/math/ilogbf.rs b/libm/src/math/ilogbf.rs similarity index 100% rename from src/math/ilogbf.rs rename to libm/src/math/ilogbf.rs diff --git a/src/math/j0.rs b/libm/src/math/j0.rs similarity index 100% rename from src/math/j0.rs rename to libm/src/math/j0.rs diff --git a/src/math/j0f.rs b/libm/src/math/j0f.rs similarity index 100% rename from src/math/j0f.rs rename to libm/src/math/j0f.rs diff --git a/src/math/j1.rs b/libm/src/math/j1.rs similarity index 100% rename from src/math/j1.rs rename to libm/src/math/j1.rs diff --git a/src/math/j1f.rs b/libm/src/math/j1f.rs similarity index 100% rename from src/math/j1f.rs rename to libm/src/math/j1f.rs diff --git a/src/math/jn.rs b/libm/src/math/jn.rs similarity index 100% rename from src/math/jn.rs rename to libm/src/math/jn.rs diff --git a/src/math/jnf.rs b/libm/src/math/jnf.rs similarity index 100% rename from src/math/jnf.rs rename to libm/src/math/jnf.rs diff --git a/src/math/k_cos.rs b/libm/src/math/k_cos.rs similarity index 100% rename from src/math/k_cos.rs rename to libm/src/math/k_cos.rs diff --git a/src/math/k_cosf.rs b/libm/src/math/k_cosf.rs similarity index 100% rename from src/math/k_cosf.rs rename to libm/src/math/k_cosf.rs diff --git a/src/math/k_expo2.rs b/libm/src/math/k_expo2.rs similarity index 100% rename from src/math/k_expo2.rs rename to libm/src/math/k_expo2.rs diff --git a/src/math/k_expo2f.rs b/libm/src/math/k_expo2f.rs similarity index 100% rename from src/math/k_expo2f.rs rename to libm/src/math/k_expo2f.rs diff --git a/src/math/k_sin.rs b/libm/src/math/k_sin.rs similarity index 100% rename from src/math/k_sin.rs rename to libm/src/math/k_sin.rs diff --git a/src/math/k_sinf.rs b/libm/src/math/k_sinf.rs similarity index 100% rename from src/math/k_sinf.rs rename to libm/src/math/k_sinf.rs diff --git a/src/math/k_tan.rs b/libm/src/math/k_tan.rs similarity index 100% rename from src/math/k_tan.rs rename to libm/src/math/k_tan.rs diff --git a/src/math/k_tanf.rs b/libm/src/math/k_tanf.rs similarity index 100% rename from src/math/k_tanf.rs rename to libm/src/math/k_tanf.rs diff --git a/src/math/ldexp.rs b/libm/src/math/ldexp.rs similarity index 100% rename from src/math/ldexp.rs rename to libm/src/math/ldexp.rs diff --git a/libm/src/math/ldexpf.rs b/libm/src/math/ldexpf.rs new file mode 100644 index 000000000..95b27fc49 --- /dev/null +++ b/libm/src/math/ldexpf.rs @@ -0,0 +1,4 @@ +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn ldexpf(x: f32, n: i32) -> f32 { + super::scalbnf(x, n) +} diff --git a/libm/src/math/ldexpf128.rs b/libm/src/math/ldexpf128.rs new file mode 100644 index 000000000..b35277d15 --- /dev/null +++ b/libm/src/math/ldexpf128.rs @@ -0,0 +1,4 @@ +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn ldexpf128(x: f128, n: i32) -> f128 { + super::scalbnf128(x, n) +} diff --git a/libm/src/math/ldexpf16.rs b/libm/src/math/ldexpf16.rs new file mode 100644 index 000000000..8de6cffd6 --- /dev/null +++ b/libm/src/math/ldexpf16.rs @@ -0,0 +1,4 @@ +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn ldexpf16(x: f16, n: i32) -> f16 { + super::scalbnf16(x, n) +} diff --git a/src/math/lgamma.rs b/libm/src/math/lgamma.rs similarity index 100% rename from src/math/lgamma.rs rename to libm/src/math/lgamma.rs diff --git a/src/math/lgamma_r.rs b/libm/src/math/lgamma_r.rs similarity index 100% rename from src/math/lgamma_r.rs rename to libm/src/math/lgamma_r.rs diff --git a/src/math/lgammaf.rs b/libm/src/math/lgammaf.rs similarity index 100% rename from src/math/lgammaf.rs rename to libm/src/math/lgammaf.rs diff --git a/src/math/lgammaf_r.rs b/libm/src/math/lgammaf_r.rs similarity index 100% rename from src/math/lgammaf_r.rs rename to libm/src/math/lgammaf_r.rs diff --git a/src/math/log.rs b/libm/src/math/log.rs similarity index 100% rename from src/math/log.rs rename to libm/src/math/log.rs diff --git a/src/math/log10.rs b/libm/src/math/log10.rs similarity index 100% rename from src/math/log10.rs rename to libm/src/math/log10.rs diff --git a/src/math/log10f.rs b/libm/src/math/log10f.rs similarity index 100% rename from src/math/log10f.rs rename to libm/src/math/log10f.rs diff --git a/src/math/log1p.rs b/libm/src/math/log1p.rs similarity index 100% rename from src/math/log1p.rs rename to libm/src/math/log1p.rs diff --git a/src/math/log1pf.rs b/libm/src/math/log1pf.rs similarity index 100% rename from src/math/log1pf.rs rename to libm/src/math/log1pf.rs diff --git a/src/math/log2.rs b/libm/src/math/log2.rs similarity index 100% rename from src/math/log2.rs rename to libm/src/math/log2.rs diff --git a/src/math/log2f.rs b/libm/src/math/log2f.rs similarity index 100% rename from src/math/log2f.rs rename to libm/src/math/log2f.rs diff --git a/src/math/logf.rs b/libm/src/math/logf.rs similarity index 100% rename from src/math/logf.rs rename to libm/src/math/logf.rs diff --git a/src/math/mod.rs b/libm/src/math/mod.rs similarity index 100% rename from src/math/mod.rs rename to libm/src/math/mod.rs diff --git a/src/math/modf.rs b/libm/src/math/modf.rs similarity index 100% rename from src/math/modf.rs rename to libm/src/math/modf.rs diff --git a/src/math/modff.rs b/libm/src/math/modff.rs similarity index 100% rename from src/math/modff.rs rename to libm/src/math/modff.rs diff --git a/src/math/nextafter.rs b/libm/src/math/nextafter.rs similarity index 100% rename from src/math/nextafter.rs rename to libm/src/math/nextafter.rs diff --git a/src/math/nextafterf.rs b/libm/src/math/nextafterf.rs similarity index 100% rename from src/math/nextafterf.rs rename to libm/src/math/nextafterf.rs diff --git a/src/math/pow.rs b/libm/src/math/pow.rs similarity index 100% rename from src/math/pow.rs rename to libm/src/math/pow.rs diff --git a/src/math/powf.rs b/libm/src/math/powf.rs similarity index 100% rename from src/math/powf.rs rename to libm/src/math/powf.rs diff --git a/src/math/rem_pio2.rs b/libm/src/math/rem_pio2.rs similarity index 100% rename from src/math/rem_pio2.rs rename to libm/src/math/rem_pio2.rs diff --git a/src/math/rem_pio2_large.rs b/libm/src/math/rem_pio2_large.rs similarity index 100% rename from src/math/rem_pio2_large.rs rename to libm/src/math/rem_pio2_large.rs diff --git a/src/math/rem_pio2f.rs b/libm/src/math/rem_pio2f.rs similarity index 100% rename from src/math/rem_pio2f.rs rename to libm/src/math/rem_pio2f.rs diff --git a/src/math/remainder.rs b/libm/src/math/remainder.rs similarity index 100% rename from src/math/remainder.rs rename to libm/src/math/remainder.rs diff --git a/src/math/remainderf.rs b/libm/src/math/remainderf.rs similarity index 100% rename from src/math/remainderf.rs rename to libm/src/math/remainderf.rs diff --git a/src/math/remquo.rs b/libm/src/math/remquo.rs similarity index 100% rename from src/math/remquo.rs rename to libm/src/math/remquo.rs diff --git a/src/math/remquof.rs b/libm/src/math/remquof.rs similarity index 100% rename from src/math/remquof.rs rename to libm/src/math/remquof.rs diff --git a/src/math/rint.rs b/libm/src/math/rint.rs similarity index 100% rename from src/math/rint.rs rename to libm/src/math/rint.rs diff --git a/src/math/round.rs b/libm/src/math/round.rs similarity index 100% rename from src/math/round.rs rename to libm/src/math/round.rs diff --git a/src/math/roundeven.rs b/libm/src/math/roundeven.rs similarity index 100% rename from src/math/roundeven.rs rename to libm/src/math/roundeven.rs diff --git a/libm/src/math/roundf.rs b/libm/src/math/roundf.rs new file mode 100644 index 000000000..b5d7c9d69 --- /dev/null +++ b/libm/src/math/roundf.rs @@ -0,0 +1,5 @@ +/// Round `x` to the nearest integer, breaking ties away from zero. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn roundf(x: f32) -> f32 { + super::generic::round(x) +} diff --git a/libm/src/math/roundf128.rs b/libm/src/math/roundf128.rs new file mode 100644 index 000000000..fc3164929 --- /dev/null +++ b/libm/src/math/roundf128.rs @@ -0,0 +1,5 @@ +/// Round `x` to the nearest integer, breaking ties away from zero. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn roundf128(x: f128) -> f128 { + super::generic::round(x) +} diff --git a/libm/src/math/roundf16.rs b/libm/src/math/roundf16.rs new file mode 100644 index 000000000..8b356eaab --- /dev/null +++ b/libm/src/math/roundf16.rs @@ -0,0 +1,5 @@ +/// Round `x` to the nearest integer, breaking ties away from zero. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn roundf16(x: f16) -> f16 { + super::generic::round(x) +} diff --git a/src/math/scalbn.rs b/libm/src/math/scalbn.rs similarity index 100% rename from src/math/scalbn.rs rename to libm/src/math/scalbn.rs diff --git a/libm/src/math/scalbnf.rs b/libm/src/math/scalbnf.rs new file mode 100644 index 000000000..57e7ba76f --- /dev/null +++ b/libm/src/math/scalbnf.rs @@ -0,0 +1,4 @@ +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn scalbnf(x: f32, n: i32) -> f32 { + super::generic::scalbn(x, n) +} diff --git a/libm/src/math/scalbnf128.rs b/libm/src/math/scalbnf128.rs new file mode 100644 index 000000000..c1d2b4855 --- /dev/null +++ b/libm/src/math/scalbnf128.rs @@ -0,0 +1,4 @@ +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn scalbnf128(x: f128, n: i32) -> f128 { + super::generic::scalbn(x, n) +} diff --git a/libm/src/math/scalbnf16.rs b/libm/src/math/scalbnf16.rs new file mode 100644 index 000000000..2209e1a17 --- /dev/null +++ b/libm/src/math/scalbnf16.rs @@ -0,0 +1,4 @@ +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn scalbnf16(x: f16, n: i32) -> f16 { + super::generic::scalbn(x, n) +} diff --git a/src/math/sin.rs b/libm/src/math/sin.rs similarity index 100% rename from src/math/sin.rs rename to libm/src/math/sin.rs diff --git a/src/math/sincos.rs b/libm/src/math/sincos.rs similarity index 100% rename from src/math/sincos.rs rename to libm/src/math/sincos.rs diff --git a/src/math/sincosf.rs b/libm/src/math/sincosf.rs similarity index 100% rename from src/math/sincosf.rs rename to libm/src/math/sincosf.rs diff --git a/src/math/sinf.rs b/libm/src/math/sinf.rs similarity index 100% rename from src/math/sinf.rs rename to libm/src/math/sinf.rs diff --git a/src/math/sinh.rs b/libm/src/math/sinh.rs similarity index 100% rename from src/math/sinh.rs rename to libm/src/math/sinh.rs diff --git a/src/math/sinhf.rs b/libm/src/math/sinhf.rs similarity index 100% rename from src/math/sinhf.rs rename to libm/src/math/sinhf.rs diff --git a/src/math/sqrt.rs b/libm/src/math/sqrt.rs similarity index 100% rename from src/math/sqrt.rs rename to libm/src/math/sqrt.rs diff --git a/libm/src/math/sqrtf.rs b/libm/src/math/sqrtf.rs new file mode 100644 index 000000000..c28a705e3 --- /dev/null +++ b/libm/src/math/sqrtf.rs @@ -0,0 +1,15 @@ +/// The square root of `x` (f32). +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn sqrtf(x: f32) -> f32 { + select_implementation! { + name: sqrtf, + use_arch: any( + all(target_arch = "aarch64", target_feature = "neon"), + all(target_arch = "wasm32", intrinsics_enabled), + target_feature = "sse2" + ), + args: x, + } + + super::generic::sqrt(x) +} diff --git a/libm/src/math/sqrtf128.rs b/libm/src/math/sqrtf128.rs new file mode 100644 index 000000000..eaef6ae0c --- /dev/null +++ b/libm/src/math/sqrtf128.rs @@ -0,0 +1,5 @@ +/// The square root of `x` (f128). +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn sqrtf128(x: f128) -> f128 { + return super::generic::sqrt(x); +} diff --git a/libm/src/math/sqrtf16.rs b/libm/src/math/sqrtf16.rs new file mode 100644 index 000000000..7bedb7f8b --- /dev/null +++ b/libm/src/math/sqrtf16.rs @@ -0,0 +1,11 @@ +/// The square root of `x` (f16). +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn sqrtf16(x: f16) -> f16 { + select_implementation! { + name: sqrtf16, + use_arch: all(target_arch = "aarch64", target_feature = "fp16"), + args: x, + } + + return super::generic::sqrt(x); +} diff --git a/src/math/support/big.rs b/libm/src/math/support/big.rs similarity index 100% rename from src/math/support/big.rs rename to libm/src/math/support/big.rs diff --git a/src/math/support/big/tests.rs b/libm/src/math/support/big/tests.rs similarity index 100% rename from src/math/support/big/tests.rs rename to libm/src/math/support/big/tests.rs diff --git a/src/math/support/env.rs b/libm/src/math/support/env.rs similarity index 100% rename from src/math/support/env.rs rename to libm/src/math/support/env.rs diff --git a/src/math/support/float_traits.rs b/libm/src/math/support/float_traits.rs similarity index 100% rename from src/math/support/float_traits.rs rename to libm/src/math/support/float_traits.rs diff --git a/src/math/support/hex_float.rs b/libm/src/math/support/hex_float.rs similarity index 100% rename from src/math/support/hex_float.rs rename to libm/src/math/support/hex_float.rs diff --git a/src/math/support/int_traits.rs b/libm/src/math/support/int_traits.rs similarity index 100% rename from src/math/support/int_traits.rs rename to libm/src/math/support/int_traits.rs diff --git a/src/math/support/macros.rs b/libm/src/math/support/macros.rs similarity index 100% rename from src/math/support/macros.rs rename to libm/src/math/support/macros.rs diff --git a/src/math/support/mod.rs b/libm/src/math/support/mod.rs similarity index 100% rename from src/math/support/mod.rs rename to libm/src/math/support/mod.rs diff --git a/src/math/tan.rs b/libm/src/math/tan.rs similarity index 100% rename from src/math/tan.rs rename to libm/src/math/tan.rs diff --git a/src/math/tanf.rs b/libm/src/math/tanf.rs similarity index 100% rename from src/math/tanf.rs rename to libm/src/math/tanf.rs diff --git a/src/math/tanh.rs b/libm/src/math/tanh.rs similarity index 100% rename from src/math/tanh.rs rename to libm/src/math/tanh.rs diff --git a/src/math/tanhf.rs b/libm/src/math/tanhf.rs similarity index 100% rename from src/math/tanhf.rs rename to libm/src/math/tanhf.rs diff --git a/src/math/tgamma.rs b/libm/src/math/tgamma.rs similarity index 100% rename from src/math/tgamma.rs rename to libm/src/math/tgamma.rs diff --git a/src/math/tgammaf.rs b/libm/src/math/tgammaf.rs similarity index 100% rename from src/math/tgammaf.rs rename to libm/src/math/tgammaf.rs diff --git a/src/math/trunc.rs b/libm/src/math/trunc.rs similarity index 100% rename from src/math/trunc.rs rename to libm/src/math/trunc.rs diff --git a/libm/src/math/truncf.rs b/libm/src/math/truncf.rs new file mode 100644 index 000000000..14533a267 --- /dev/null +++ b/libm/src/math/truncf.rs @@ -0,0 +1,23 @@ +/// Rounds the number toward 0 to the closest integral value (f32). +/// +/// This effectively removes the decimal part of the number, leaving the integral part. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn truncf(x: f32) -> f32 { + select_implementation! { + name: truncf, + use_arch: all(target_arch = "wasm32", intrinsics_enabled), + args: x, + } + + super::generic::trunc(x) +} + +// PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520 +#[cfg(not(target_arch = "powerpc64"))] +#[cfg(test)] +mod tests { + #[test] + fn sanity_check() { + assert_eq!(super::truncf(1.1), 1.0); + } +} diff --git a/libm/src/math/truncf128.rs b/libm/src/math/truncf128.rs new file mode 100644 index 000000000..9dccc0d0e --- /dev/null +++ b/libm/src/math/truncf128.rs @@ -0,0 +1,7 @@ +/// Rounds the number toward 0 to the closest integral value (f128). +/// +/// This effectively removes the decimal part of the number, leaving the integral part. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn truncf128(x: f128) -> f128 { + super::generic::trunc(x) +} diff --git a/libm/src/math/truncf16.rs b/libm/src/math/truncf16.rs new file mode 100644 index 000000000..d7c3d225c --- /dev/null +++ b/libm/src/math/truncf16.rs @@ -0,0 +1,7 @@ +/// Rounds the number toward 0 to the closest integral value (f16). +/// +/// This effectively removes the decimal part of the number, leaving the integral part. +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn truncf16(x: f16) -> f16 { + super::generic::trunc(x) +} From 84f0f3ff9e264fe4fafb5d86339a3ff5e9311e97 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 9 Apr 2025 01:21:44 +0000 Subject: [PATCH 2/2] refactor: Introduce a virtual manifest Move the workspace configuration to a virtual manifest. This reorganization makes a more clear separation between package contents and support files that don't get distributed. It will also make it easier to merge this repository with `compiler-builtins` which is planned (builtins had a similar update done in [1]). LICENSE.txt and README.md are symlinkedinto the new directory to ensure they get included in the package. [1]: https://github.com/rust-lang/compiler-builtins/pull/702 --- Cargo.toml | 37 +++ ci/ci-util.py | 2 +- etc/function-definitions.json | 502 +++++++++++++++++----------------- etc/update-api-list.py | 26 +- libm/Cargo.toml | 38 --- libm/LICENSE.txt | 1 + libm/README.md | 1 + 7 files changed, 305 insertions(+), 302 deletions(-) create mode 100644 Cargo.toml create mode 120000 libm/LICENSE.txt create mode 120000 libm/README.md diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..268b6fb0e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,37 @@ +[workspace] +resolver = "2" +members = [ + "libm", + "crates/libm-macros", + "crates/libm-test", + "crates/musl-math-sys", + "crates/util", +] +default-members = [ + "libm", + "crates/libm-macros", + "crates/libm-test" +] +exclude = [ + # Requires `panic = abort` so can't be a member of the workspace + "crates/compiler-builtins-smoke-test", +] + +# The default release profile is unchanged. + +# Release mode with debug assertions +[profile.release-checked] +inherits = "release" +debug-assertions = true +overflow-checks = true + +# Release with maximum optimizations, which is very slow to build. This is also +# what is needed to check `no-panic`. +[profile.release-opt] +inherits = "release" +codegen-units = 1 +lto = "fat" + +[profile.bench] +# Required for iai-callgrind +debug = true diff --git a/ci/ci-util.py b/ci/ci-util.py index ed63d6dee..d9e402d6b 100755 --- a/ci/ci-util.py +++ b/ci/ci-util.py @@ -25,7 +25,7 @@ COMMAND: generate-matrix Calculate a matrix of which functions had source change, print that as - a JSON object. + a JSON object. locate-baseline [--download] [--extract] Locate the most recent benchmark baseline available in CI and, if flags diff --git a/etc/function-definitions.json b/etc/function-definitions.json index ead1f807f..3e33343c4 100644 --- a/etc/function-definitions.json +++ b/etc/function-definitions.json @@ -2,1067 +2,1067 @@ "__comment": "Autogenerated by update-api-list.py. List of files that define a function with a given name. This file is checked in to make it obvious if refactoring breaks things", "acos": { "sources": [ - "src/math/acos.rs" + "libm/src/math/acos.rs" ], "type": "f64" }, "acosf": { "sources": [ - "src/math/acosf.rs" + "libm/src/math/acosf.rs" ], "type": "f32" }, "acosh": { "sources": [ - "src/math/acosh.rs" + "libm/src/math/acosh.rs" ], "type": "f64" }, "acoshf": { "sources": [ - "src/math/acoshf.rs" + "libm/src/math/acoshf.rs" ], "type": "f32" }, "asin": { "sources": [ - "src/math/asin.rs" + "libm/src/math/asin.rs" ], "type": "f64" }, "asinf": { "sources": [ - "src/math/asinf.rs" + "libm/src/math/asinf.rs" ], "type": "f32" }, "asinh": { "sources": [ - "src/math/asinh.rs" + "libm/src/math/asinh.rs" ], "type": "f64" }, "asinhf": { "sources": [ - "src/math/asinhf.rs" + "libm/src/math/asinhf.rs" ], "type": "f32" }, "atan": { "sources": [ - "src/math/atan.rs" + "libm/src/math/atan.rs" ], "type": "f64" }, "atan2": { "sources": [ - "src/math/atan2.rs" + "libm/src/math/atan2.rs" ], "type": "f64" }, "atan2f": { "sources": [ - "src/math/atan2f.rs" + "libm/src/math/atan2f.rs" ], "type": "f32" }, "atanf": { "sources": [ - "src/math/atanf.rs" + "libm/src/math/atanf.rs" ], "type": "f32" }, "atanh": { "sources": [ - "src/math/atanh.rs" + "libm/src/math/atanh.rs" ], "type": "f64" }, "atanhf": { "sources": [ - "src/math/atanhf.rs" + "libm/src/math/atanhf.rs" ], "type": "f32" }, "cbrt": { "sources": [ - "src/math/cbrt.rs" + "libm/src/math/cbrt.rs" ], "type": "f64" }, "cbrtf": { "sources": [ - "src/math/cbrtf.rs" + "libm/src/math/cbrtf.rs" ], "type": "f32" }, "ceil": { "sources": [ - "src/math/arch/i586.rs", - "src/math/arch/wasm32.rs", - "src/math/ceil.rs", - "src/math/generic/ceil.rs" + "libm/src/math/arch/i586.rs", + "libm/src/math/arch/wasm32.rs", + "libm/src/math/ceil.rs", + "libm/src/math/generic/ceil.rs" ], "type": "f64" }, "ceilf": { "sources": [ - "src/math/arch/wasm32.rs", - "src/math/ceil.rs", - "src/math/generic/ceil.rs" + "libm/src/math/arch/wasm32.rs", + "libm/src/math/ceil.rs", + "libm/src/math/generic/ceil.rs" ], "type": "f32" }, "ceilf128": { "sources": [ - "src/math/ceil.rs", - "src/math/generic/ceil.rs" + "libm/src/math/ceil.rs", + "libm/src/math/generic/ceil.rs" ], "type": "f128" }, "ceilf16": { "sources": [ - "src/math/ceil.rs", - "src/math/generic/ceil.rs" + "libm/src/math/ceil.rs", + "libm/src/math/generic/ceil.rs" ], "type": "f16" }, "copysign": { "sources": [ - "src/math/copysign.rs", - "src/math/generic/copysign.rs" + "libm/src/math/copysign.rs", + "libm/src/math/generic/copysign.rs" ], "type": "f64" }, "copysignf": { "sources": [ - "src/math/copysign.rs", - "src/math/generic/copysign.rs" + "libm/src/math/copysign.rs", + "libm/src/math/generic/copysign.rs" ], "type": "f32" }, "copysignf128": { "sources": [ - "src/math/copysign.rs", - "src/math/generic/copysign.rs" + "libm/src/math/copysign.rs", + "libm/src/math/generic/copysign.rs" ], "type": "f128" }, "copysignf16": { "sources": [ - "src/math/copysign.rs", - "src/math/generic/copysign.rs" + "libm/src/math/copysign.rs", + "libm/src/math/generic/copysign.rs" ], "type": "f16" }, "cos": { "sources": [ - "src/math/cos.rs" + "libm/src/math/cos.rs" ], "type": "f64" }, "cosf": { "sources": [ - "src/math/cosf.rs" + "libm/src/math/cosf.rs" ], "type": "f32" }, "cosh": { "sources": [ - "src/math/cosh.rs" + "libm/src/math/cosh.rs" ], "type": "f64" }, "coshf": { "sources": [ - "src/math/coshf.rs" + "libm/src/math/coshf.rs" ], "type": "f32" }, "erf": { "sources": [ - "src/math/erf.rs" + "libm/src/math/erf.rs" ], "type": "f64" }, "erfc": { "sources": [ - "src/math/erf.rs" + "libm/src/math/erf.rs" ], "type": "f64" }, "erfcf": { "sources": [ - "src/math/erff.rs" + "libm/src/math/erff.rs" ], "type": "f32" }, "erff": { "sources": [ - "src/math/erff.rs" + "libm/src/math/erff.rs" ], "type": "f32" }, "exp": { "sources": [ - "src/math/exp.rs" + "libm/src/math/exp.rs" ], "type": "f64" }, "exp10": { "sources": [ - "src/math/exp10.rs" + "libm/src/math/exp10.rs" ], "type": "f64" }, "exp10f": { "sources": [ - "src/math/exp10f.rs" + "libm/src/math/exp10f.rs" ], "type": "f32" }, "exp2": { "sources": [ - "src/math/exp2.rs" + "libm/src/math/exp2.rs" ], "type": "f64" }, "exp2f": { "sources": [ - "src/math/exp2f.rs" + "libm/src/math/exp2f.rs" ], "type": "f32" }, "expf": { "sources": [ - "src/math/expf.rs" + "libm/src/math/expf.rs" ], "type": "f32" }, "expm1": { "sources": [ - "src/math/expm1.rs" + "libm/src/math/expm1.rs" ], "type": "f64" }, "expm1f": { "sources": [ - "src/math/expm1f.rs" + "libm/src/math/expm1f.rs" ], "type": "f32" }, "fabs": { "sources": [ - "src/math/arch/wasm32.rs", - "src/math/fabs.rs", - "src/math/generic/fabs.rs" + "libm/src/math/arch/wasm32.rs", + "libm/src/math/fabs.rs", + "libm/src/math/generic/fabs.rs" ], "type": "f64" }, "fabsf": { "sources": [ - "src/math/arch/wasm32.rs", - "src/math/fabs.rs", - "src/math/generic/fabs.rs" + "libm/src/math/arch/wasm32.rs", + "libm/src/math/fabs.rs", + "libm/src/math/generic/fabs.rs" ], "type": "f32" }, "fabsf128": { "sources": [ - "src/math/fabs.rs", - "src/math/generic/fabs.rs" + "libm/src/math/fabs.rs", + "libm/src/math/generic/fabs.rs" ], "type": "f128" }, "fabsf16": { "sources": [ - "src/math/fabs.rs", - "src/math/generic/fabs.rs" + "libm/src/math/fabs.rs", + "libm/src/math/generic/fabs.rs" ], "type": "f16" }, "fdim": { "sources": [ - "src/math/fdim.rs", - "src/math/generic/fdim.rs" + "libm/src/math/fdim.rs", + "libm/src/math/generic/fdim.rs" ], "type": "f64" }, "fdimf": { "sources": [ - "src/math/fdim.rs", - "src/math/generic/fdim.rs" + "libm/src/math/fdim.rs", + "libm/src/math/generic/fdim.rs" ], "type": "f32" }, "fdimf128": { "sources": [ - "src/math/fdim.rs", - "src/math/generic/fdim.rs" + "libm/src/math/fdim.rs", + "libm/src/math/generic/fdim.rs" ], "type": "f128" }, "fdimf16": { "sources": [ - "src/math/fdim.rs", - "src/math/generic/fdim.rs" + "libm/src/math/fdim.rs", + "libm/src/math/generic/fdim.rs" ], "type": "f16" }, "floor": { "sources": [ - "src/math/arch/i586.rs", - "src/math/arch/wasm32.rs", - "src/math/floor.rs", - "src/math/generic/floor.rs" + "libm/src/math/arch/i586.rs", + "libm/src/math/arch/wasm32.rs", + "libm/src/math/floor.rs", + "libm/src/math/generic/floor.rs" ], "type": "f64" }, "floorf": { "sources": [ - "src/math/arch/wasm32.rs", - "src/math/floor.rs", - "src/math/generic/floor.rs" + "libm/src/math/arch/wasm32.rs", + "libm/src/math/floor.rs", + "libm/src/math/generic/floor.rs" ], "type": "f32" }, "floorf128": { "sources": [ - "src/math/floor.rs", - "src/math/generic/floor.rs" + "libm/src/math/floor.rs", + "libm/src/math/generic/floor.rs" ], "type": "f128" }, "floorf16": { "sources": [ - "src/math/floor.rs", - "src/math/generic/floor.rs" + "libm/src/math/floor.rs", + "libm/src/math/generic/floor.rs" ], "type": "f16" }, "fma": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/fma.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/fma.rs" ], "type": "f64" }, "fmaf": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/fma_wide.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/fma_wide.rs" ], "type": "f32" }, "fmaf128": { "sources": [ - "src/math/fma.rs" + "libm/src/math/fma.rs" ], "type": "f128" }, "fmax": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmax.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmax.rs" ], "type": "f64" }, "fmaxf": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmax.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmax.rs" ], "type": "f32" }, "fmaxf128": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmax.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmax.rs" ], "type": "f128" }, "fmaxf16": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmax.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmax.rs" ], "type": "f16" }, "fmaximum": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fmaximum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fmaximum.rs" ], "type": "f64" }, "fmaximum_num": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fmaximum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fmaximum_num.rs" ], "type": "f64" }, "fmaximum_numf": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fmaximum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fmaximum_num.rs" ], "type": "f32" }, "fmaximum_numf128": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fmaximum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fmaximum_num.rs" ], "type": "f128" }, "fmaximum_numf16": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fmaximum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fmaximum_num.rs" ], "type": "f16" }, "fmaximumf": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fmaximum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fmaximum.rs" ], "type": "f32" }, "fmaximumf128": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fmaximum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fmaximum.rs" ], "type": "f128" }, "fmaximumf16": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fmaximum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fmaximum.rs" ], "type": "f16" }, "fmin": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmin.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmin.rs" ], "type": "f64" }, "fminf": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmin.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmin.rs" ], "type": "f32" }, "fminf128": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmin.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmin.rs" ], "type": "f128" }, "fminf16": { "sources": [ - "src/math/fmin_fmax.rs", - "src/math/generic/fmin.rs" + "libm/src/math/fmin_fmax.rs", + "libm/src/math/generic/fmin.rs" ], "type": "f16" }, "fminimum": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fminimum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fminimum.rs" ], "type": "f64" }, "fminimum_num": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fminimum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fminimum_num.rs" ], "type": "f64" }, "fminimum_numf": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fminimum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fminimum_num.rs" ], "type": "f32" }, "fminimum_numf128": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fminimum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fminimum_num.rs" ], "type": "f128" }, "fminimum_numf16": { "sources": [ - "src/math/fminimum_fmaximum_num.rs", - "src/math/generic/fminimum_num.rs" + "libm/src/math/fminimum_fmaximum_num.rs", + "libm/src/math/generic/fminimum_num.rs" ], "type": "f16" }, "fminimumf": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fminimum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fminimum.rs" ], "type": "f32" }, "fminimumf128": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fminimum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fminimum.rs" ], "type": "f128" }, "fminimumf16": { "sources": [ - "src/math/fminimum_fmaximum.rs", - "src/math/generic/fminimum.rs" + "libm/src/math/fminimum_fmaximum.rs", + "libm/src/math/generic/fminimum.rs" ], "type": "f16" }, "fmod": { "sources": [ - "src/math/fmod.rs", - "src/math/generic/fmod.rs" + "libm/src/math/fmod.rs", + "libm/src/math/generic/fmod.rs" ], "type": "f64" }, "fmodf": { "sources": [ - "src/math/fmod.rs", - "src/math/generic/fmod.rs" + "libm/src/math/fmod.rs", + "libm/src/math/generic/fmod.rs" ], "type": "f32" }, "fmodf128": { "sources": [ - "src/math/fmod.rs", - "src/math/generic/fmod.rs" + "libm/src/math/fmod.rs", + "libm/src/math/generic/fmod.rs" ], "type": "f128" }, "fmodf16": { "sources": [ - "src/math/fmod.rs", - "src/math/generic/fmod.rs" + "libm/src/math/fmod.rs", + "libm/src/math/generic/fmod.rs" ], "type": "f16" }, "frexp": { "sources": [ - "src/math/frexp.rs" + "libm/src/math/frexp.rs" ], "type": "f64" }, "frexpf": { "sources": [ - "src/math/frexpf.rs" + "libm/src/math/frexpf.rs" ], "type": "f32" }, "hypot": { "sources": [ - "src/math/hypot.rs" + "libm/src/math/hypot.rs" ], "type": "f64" }, "hypotf": { "sources": [ - "src/math/hypotf.rs" + "libm/src/math/hypotf.rs" ], "type": "f32" }, "ilogb": { "sources": [ - "src/math/ilogb.rs" + "libm/src/math/ilogb.rs" ], "type": "f64" }, "ilogbf": { "sources": [ - "src/math/ilogbf.rs" + "libm/src/math/ilogbf.rs" ], "type": "f32" }, "j0": { "sources": [ - "src/math/j0.rs" + "libm/src/math/j0.rs" ], "type": "f64" }, "j0f": { "sources": [ - "src/math/j0f.rs" + "libm/src/math/j0f.rs" ], "type": "f32" }, "j1": { "sources": [ - "src/math/j1.rs" + "libm/src/math/j1.rs" ], "type": "f64" }, "j1f": { "sources": [ - "src/math/j1f.rs" + "libm/src/math/j1f.rs" ], "type": "f32" }, "jn": { "sources": [ - "src/math/jn.rs" + "libm/src/math/jn.rs" ], "type": "f64" }, "jnf": { "sources": [ - "src/math/jnf.rs" + "libm/src/math/jnf.rs" ], "type": "f32" }, "ldexp": { "sources": [ - "src/math/ldexp.rs" + "libm/src/math/ldexp.rs" ], "type": "f64" }, "ldexpf": { "sources": [ - "src/math/ldexp.rs" + "libm/src/math/ldexp.rs" ], "type": "f32" }, "ldexpf128": { "sources": [ - "src/math/ldexp.rs" + "libm/src/math/ldexp.rs" ], "type": "f128" }, "ldexpf16": { "sources": [ - "src/math/ldexp.rs" + "libm/src/math/ldexp.rs" ], "type": "f16" }, "lgamma": { "sources": [ - "src/math/lgamma.rs" + "libm/src/math/lgamma.rs" ], "type": "f64" }, "lgamma_r": { "sources": [ - "src/math/lgamma_r.rs" + "libm/src/math/lgamma_r.rs" ], "type": "f64" }, "lgammaf": { "sources": [ - "src/math/lgammaf.rs" + "libm/src/math/lgammaf.rs" ], "type": "f32" }, "lgammaf_r": { "sources": [ - "src/math/lgammaf_r.rs" + "libm/src/math/lgammaf_r.rs" ], "type": "f32" }, "log": { "sources": [ - "src/math/log.rs" + "libm/src/math/log.rs" ], "type": "f64" }, "log10": { "sources": [ - "src/math/log10.rs" + "libm/src/math/log10.rs" ], "type": "f64" }, "log10f": { "sources": [ - "src/math/log10f.rs" + "libm/src/math/log10f.rs" ], "type": "f32" }, "log1p": { "sources": [ - "src/math/log1p.rs" + "libm/src/math/log1p.rs" ], "type": "f64" }, "log1pf": { "sources": [ - "src/math/log1pf.rs" + "libm/src/math/log1pf.rs" ], "type": "f32" }, "log2": { "sources": [ - "src/math/log2.rs" + "libm/src/math/log2.rs" ], "type": "f64" }, "log2f": { "sources": [ - "src/math/log2f.rs" + "libm/src/math/log2f.rs" ], "type": "f32" }, "logf": { "sources": [ - "src/math/logf.rs" + "libm/src/math/logf.rs" ], "type": "f32" }, "modf": { "sources": [ - "src/math/modf.rs" + "libm/src/math/modf.rs" ], "type": "f64" }, "modff": { "sources": [ - "src/math/modff.rs" + "libm/src/math/modff.rs" ], "type": "f32" }, "nextafter": { "sources": [ - "src/math/nextafter.rs" + "libm/src/math/nextafter.rs" ], "type": "f64" }, "nextafterf": { "sources": [ - "src/math/nextafterf.rs" + "libm/src/math/nextafterf.rs" ], "type": "f32" }, "pow": { "sources": [ - "src/math/pow.rs" + "libm/src/math/pow.rs" ], "type": "f64" }, "powf": { "sources": [ - "src/math/powf.rs" + "libm/src/math/powf.rs" ], "type": "f32" }, "remainder": { "sources": [ - "src/math/remainder.rs" + "libm/src/math/remainder.rs" ], "type": "f64" }, "remainderf": { "sources": [ - "src/math/remainderf.rs" + "libm/src/math/remainderf.rs" ], "type": "f32" }, "remquo": { "sources": [ - "src/math/remquo.rs" + "libm/src/math/remquo.rs" ], "type": "f64" }, "remquof": { "sources": [ - "src/math/remquof.rs" + "libm/src/math/remquof.rs" ], "type": "f32" }, "rint": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/arch/wasm32.rs", - "src/math/rint.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/arch/wasm32.rs", + "libm/src/math/rint.rs" ], "type": "f64" }, "rintf": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/arch/wasm32.rs", - "src/math/rint.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/arch/wasm32.rs", + "libm/src/math/rint.rs" ], "type": "f32" }, "rintf128": { "sources": [ - "src/math/rint.rs" + "libm/src/math/rint.rs" ], "type": "f128" }, "rintf16": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/rint.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/rint.rs" ], "type": "f16" }, "round": { "sources": [ - "src/math/generic/round.rs", - "src/math/round.rs" + "libm/src/math/generic/round.rs", + "libm/src/math/round.rs" ], "type": "f64" }, "roundeven": { "sources": [ - "src/math/roundeven.rs" + "libm/src/math/roundeven.rs" ], "type": "f64" }, "roundevenf": { "sources": [ - "src/math/roundeven.rs" + "libm/src/math/roundeven.rs" ], "type": "f32" }, "roundevenf128": { "sources": [ - "src/math/roundeven.rs" + "libm/src/math/roundeven.rs" ], "type": "f128" }, "roundevenf16": { "sources": [ - "src/math/roundeven.rs" + "libm/src/math/roundeven.rs" ], "type": "f16" }, "roundf": { "sources": [ - "src/math/generic/round.rs", - "src/math/round.rs" + "libm/src/math/generic/round.rs", + "libm/src/math/round.rs" ], "type": "f32" }, "roundf128": { "sources": [ - "src/math/generic/round.rs", - "src/math/round.rs" + "libm/src/math/generic/round.rs", + "libm/src/math/round.rs" ], "type": "f128" }, "roundf16": { "sources": [ - "src/math/generic/round.rs", - "src/math/round.rs" + "libm/src/math/generic/round.rs", + "libm/src/math/round.rs" ], "type": "f16" }, "scalbn": { "sources": [ - "src/math/generic/scalbn.rs", - "src/math/scalbn.rs" + "libm/src/math/generic/scalbn.rs", + "libm/src/math/scalbn.rs" ], "type": "f64" }, "scalbnf": { "sources": [ - "src/math/generic/scalbn.rs", - "src/math/scalbn.rs" + "libm/src/math/generic/scalbn.rs", + "libm/src/math/scalbn.rs" ], "type": "f32" }, "scalbnf128": { "sources": [ - "src/math/generic/scalbn.rs", - "src/math/scalbn.rs" + "libm/src/math/generic/scalbn.rs", + "libm/src/math/scalbn.rs" ], "type": "f128" }, "scalbnf16": { "sources": [ - "src/math/generic/scalbn.rs", - "src/math/scalbn.rs" + "libm/src/math/generic/scalbn.rs", + "libm/src/math/scalbn.rs" ], "type": "f16" }, "sin": { "sources": [ - "src/math/sin.rs" + "libm/src/math/sin.rs" ], "type": "f64" }, "sincos": { "sources": [ - "src/math/sincos.rs" + "libm/src/math/sincos.rs" ], "type": "f64" }, "sincosf": { "sources": [ - "src/math/sincosf.rs" + "libm/src/math/sincosf.rs" ], "type": "f32" }, "sinf": { "sources": [ - "src/math/sinf.rs" + "libm/src/math/sinf.rs" ], "type": "f32" }, "sinh": { "sources": [ - "src/math/sinh.rs" + "libm/src/math/sinh.rs" ], "type": "f64" }, "sinhf": { "sources": [ - "src/math/sinhf.rs" + "libm/src/math/sinhf.rs" ], "type": "f32" }, "sqrt": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/arch/i686.rs", - "src/math/arch/wasm32.rs", - "src/math/generic/sqrt.rs", - "src/math/sqrt.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/arch/i686.rs", + "libm/src/math/arch/wasm32.rs", + "libm/src/math/generic/sqrt.rs", + "libm/src/math/sqrt.rs" ], "type": "f64" }, "sqrtf": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/arch/i686.rs", - "src/math/arch/wasm32.rs", - "src/math/generic/sqrt.rs", - "src/math/sqrt.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/arch/i686.rs", + "libm/src/math/arch/wasm32.rs", + "libm/src/math/generic/sqrt.rs", + "libm/src/math/sqrt.rs" ], "type": "f32" }, "sqrtf128": { "sources": [ - "src/math/generic/sqrt.rs", - "src/math/sqrt.rs" + "libm/src/math/generic/sqrt.rs", + "libm/src/math/sqrt.rs" ], "type": "f128" }, "sqrtf16": { "sources": [ - "src/math/arch/aarch64.rs", - "src/math/generic/sqrt.rs", - "src/math/sqrt.rs" + "libm/src/math/arch/aarch64.rs", + "libm/src/math/generic/sqrt.rs", + "libm/src/math/sqrt.rs" ], "type": "f16" }, "tan": { "sources": [ - "src/math/tan.rs" + "libm/src/math/tan.rs" ], "type": "f64" }, "tanf": { "sources": [ - "src/math/tanf.rs" + "libm/src/math/tanf.rs" ], "type": "f32" }, "tanh": { "sources": [ - "src/math/tanh.rs" + "libm/src/math/tanh.rs" ], "type": "f64" }, "tanhf": { "sources": [ - "src/math/tanhf.rs" + "libm/src/math/tanhf.rs" ], "type": "f32" }, "tgamma": { "sources": [ - "src/math/tgamma.rs" + "libm/src/math/tgamma.rs" ], "type": "f64" }, "tgammaf": { "sources": [ - "src/math/tgammaf.rs" + "libm/src/math/tgammaf.rs" ], "type": "f32" }, "trunc": { "sources": [ - "src/math/arch/wasm32.rs", - "src/math/generic/trunc.rs", - "src/math/trunc.rs" + "libm/src/math/arch/wasm32.rs", + "libm/src/math/generic/trunc.rs", + "libm/src/math/trunc.rs" ], "type": "f64" }, "truncf": { "sources": [ - "src/math/arch/wasm32.rs", - "src/math/generic/trunc.rs", - "src/math/trunc.rs" + "libm/src/math/arch/wasm32.rs", + "libm/src/math/generic/trunc.rs", + "libm/src/math/trunc.rs" ], "type": "f32" }, "truncf128": { "sources": [ - "src/math/generic/trunc.rs", - "src/math/trunc.rs" + "libm/src/math/generic/trunc.rs", + "libm/src/math/trunc.rs" ], "type": "f128" }, "truncf16": { "sources": [ - "src/math/generic/trunc.rs", - "src/math/trunc.rs" + "libm/src/math/generic/trunc.rs", + "libm/src/math/trunc.rs" ], "type": "f16" }, "y0": { "sources": [ - "src/math/j0.rs" + "libm/src/math/j0.rs" ], "type": "f64" }, "y0f": { "sources": [ - "src/math/j0f.rs" + "libm/src/math/j0f.rs" ], "type": "f32" }, "y1": { "sources": [ - "src/math/j1.rs" + "libm/src/math/j1.rs" ], "type": "f64" }, "y1f": { "sources": [ - "src/math/j1f.rs" + "libm/src/math/j1f.rs" ], "type": "f32" }, "yn": { "sources": [ - "src/math/jn.rs" + "libm/src/math/jn.rs" ], "type": "f64" }, "ynf": { "sources": [ - "src/math/jnf.rs" + "libm/src/math/jnf.rs" ], "type": "f32" } diff --git a/etc/update-api-list.py b/etc/update-api-list.py index 950824fc4..0770a8b20 100755 --- a/etc/update-api-list.py +++ b/etc/update-api-list.py @@ -18,10 +18,10 @@ SELF_PATH = Path(__file__) ETC_DIR = SELF_PATH.parent -LIBM_DIR = ETC_DIR.parent.joinpath("libm") +ROOT_DIR = ETC_DIR.parent # These files do not trigger a retest. -IGNORED_SOURCES = ["src/libm_helper.rs", "src/math/support/float_traits.rs"] +IGNORED_SOURCES = ["libm/src/libm_helper.rs", "libm/src/math/support/float_traits.rs"] IndexTy: TypeAlias = dict[str, dict[str, Any]] """Type of the `index` item in rustdoc's JSON output""" @@ -66,7 +66,7 @@ def get_rustdoc_json() -> dict[Any, Any]: j = sp.check_output( [ "rustdoc", - "src/lib.rs", + "libm/src/lib.rs", "--edition=2021", "--document-private-items", "--output-format=json", @@ -75,7 +75,7 @@ def get_rustdoc_json() -> dict[Any, Any]: "-Zunstable-options", "-o-", ], - cwd=LIBM_DIR, + cwd=ROOT_DIR, text=True, ) j = json.loads(j) @@ -94,7 +94,9 @@ def _init_function_list(self, index: IndexTy) -> None: # Collect a list of source IDs for reexported items in `lib.rs` or `mod math`. use = (i for i in public if "use" in i["inner"]) use = ( - i for i in use if i["span"]["filename"] in ["src/math/mod.rs", "src/lib.rs"] + i + for i in use + if i["span"]["filename"] in ["libm/src/math/mod.rs", "libm/src/lib.rs"] ) reexported_ids = [item["inner"]["use"]["id"] for item in use] @@ -121,8 +123,8 @@ def _init_defs(self, index: IndexTy) -> None: # A lot of the `arch` module is often configured out so doesn't show up in docs. Use # string matching as a fallback. - for fname in glob("src/math/arch/**.rs", root_dir=LIBM_DIR): - contents = (LIBM_DIR.joinpath(fname)).read_text() + for fname in glob("libm/src/math/arch/**.rs", root_dir=ROOT_DIR): + contents = (ROOT_DIR.joinpath(fname)).read_text() for name in self.public_functions: if f"fn {name}" in contents: @@ -188,10 +190,10 @@ def tidy_lists(self) -> None: include all public API. """ - flist = sp.check_output(["git", "ls-files"], cwd=LIBM_DIR, text=True) + flist = sp.check_output(["git", "ls-files"], cwd=ROOT_DIR, text=True) for path in flist.splitlines(): - fpath = LIBM_DIR.joinpath(path) + fpath = ROOT_DIR.joinpath(path) if fpath.is_dir() or fpath == SELF_PATH: continue @@ -229,7 +231,7 @@ def ensure_contains_api(self, fpath: Path, line_num: int, lines: list[str]): if len(not_found) == 0: return - relpath = fpath.relative_to(LIBM_DIR) + relpath = fpath.relative_to(ROOT_DIR) eprint(f"functions not found at {relpath}:{line_num}: {not_found}") exit(1) @@ -244,7 +246,7 @@ def validate_delimited_block( """Identify blocks of code wrapped within `start` and `end`, collect their contents to a list of strings, and call `validate` for each of those lists. """ - relpath = fpath.relative_to(LIBM_DIR) + relpath = fpath.relative_to(ROOT_DIR) block_lines = [] block_start_line: None | int = None for line_num, line in enumerate(lines): @@ -274,7 +276,7 @@ def validate_delimited_block( def ensure_sorted(fpath: Path, block_start_line: int, lines: list[str]) -> None: """Ensure that a list of lines is sorted, otherwise print a diff and exit.""" - relpath = fpath.relative_to(LIBM_DIR) + relpath = fpath.relative_to(ROOT_DIR) diff_and_exit( "\n".join(lines), "\n".join(sorted(lines)), diff --git a/libm/Cargo.toml b/libm/Cargo.toml index e0aeb07d5..44154c1a8 100644 --- a/libm/Cargo.toml +++ b/libm/Cargo.toml @@ -10,7 +10,6 @@ readme = "README.md" repository = "https://github.com/rust-lang/libm" version = "0.2.11" edition = "2021" -exclude = ["/ci/", "/.github/workflows/"] rust-version = "1.63" [features] @@ -40,24 +39,6 @@ unstable-float = [] # hard float operations. force-soft-floats = [] -[workspace] -resolver = "2" -members = [ - "crates/libm-macros", - "crates/libm-test", - "crates/musl-math-sys", - "crates/util", -] -default-members = [ - ".", - "crates/libm-macros", - "crates/libm-test", -] -exclude = [ - # Requires `panic = abort` so can't be a member of the workspace - "crates/compiler-builtins-smoke-test", -] - [dev-dependencies] no-panic = "0.1.35" @@ -66,22 +47,3 @@ unexpected_cfgs = { level = "warn", check-cfg = [ # compiler-builtins sets this feature, but we use it in `libm` 'cfg(feature, values("compiler-builtins"))', ] } - -# The default release profile is unchanged. - -# Release mode with debug assertions -[profile.release-checked] -inherits = "release" -debug-assertions = true -overflow-checks = true - -# Release with maximum optimizations, which is very slow to build. This is also -# what is needed to check `no-panic`. -[profile.release-opt] -inherits = "release" -codegen-units = 1 -lto = "fat" - -[profile.bench] -# Required for iai-callgrind -debug = true diff --git a/libm/LICENSE.txt b/libm/LICENSE.txt new file mode 120000 index 000000000..4ab43736a --- /dev/null +++ b/libm/LICENSE.txt @@ -0,0 +1 @@ +../LICENSE.txt \ No newline at end of file diff --git a/libm/README.md b/libm/README.md new file mode 120000 index 000000000..32d46ee88 --- /dev/null +++ b/libm/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file