diff --git a/library/compiler-builtins/libm/.github/workflows/main.yaml b/library/compiler-builtins/libm/.github/workflows/main.yaml index c925e63aa59b..a717c3ea8f87 100644 --- a/library/compiler-builtins/libm/.github/workflows/main.yaml +++ b/library/compiler-builtins/libm/.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/library/compiler-builtins/libm/ci/ci-util.py b/library/compiler-builtins/libm/ci/ci-util.py index 7468fd690cbb..ed63d6deea1e 100755 --- a/library/compiler-builtins/libm/ci/ci-util.py +++ b/library/compiler-builtins/libm/ci/ci-util.py @@ -63,9 +63,9 @@ MANY_EXTENSIVE_THRESHOLD = 20 # 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/library/compiler-builtins/libm/crates/compiler-builtins-smoke-test/build.rs b/library/compiler-builtins/libm/crates/compiler-builtins-smoke-test/build.rs index 4ee5ab585d50..ef8d613c9f45 100644 --- a/library/compiler-builtins/libm/crates/compiler-builtins-smoke-test/build.rs +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/crates/compiler-builtins-smoke-test/src/math.rs b/library/compiler-builtins/libm/crates/compiler-builtins-smoke-test/src/math.rs index 7e0146998aae..f17fc1231683 100644 --- a/library/compiler-builtins/libm/crates/compiler-builtins-smoke-test/src/math.rs +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/crates/libm-test/Cargo.toml b/library/compiler-builtins/libm/crates/libm-test/Cargo.toml index 98da73ceadc9..1bcc163ed1b6 100644 --- a/library/compiler-builtins/libm/crates/libm-test/Cargo.toml +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/crates/libm-test/build.rs b/library/compiler-builtins/libm/crates/libm-test/build.rs index d2d0df9cbe92..f75e3dda5ff1 100644 --- a/library/compiler-builtins/libm/crates/libm-test/build.rs +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/crates/musl-math-sys/Cargo.toml b/library/compiler-builtins/libm/crates/musl-math-sys/Cargo.toml index 34682b74c672..ad73578d8b8f 100644 --- a/library/compiler-builtins/libm/crates/musl-math-sys/Cargo.toml +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/crates/util/Cargo.toml b/library/compiler-builtins/libm/crates/util/Cargo.toml index 8005459dbf93..94c7f1033405 100644 --- a/library/compiler-builtins/libm/crates/util/Cargo.toml +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/crates/util/build.rs b/library/compiler-builtins/libm/crates/util/build.rs index b6cceb5f11b7..a1be4127527a 100644 --- a/library/compiler-builtins/libm/crates/util/build.rs +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/etc/update-api-list.py b/library/compiler-builtins/libm/etc/update-api-list.py index b4ce2c453ce6..950824fc442f 100755 --- a/library/compiler-builtins/libm/etc/update-api-list.py +++ b/library/compiler-builtins/libm/etc/update-api-list.py @@ -18,7 +18,7 @@ from typing import Any, Callable, TypeAlias 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 @@ class Crate: "-Zunstable-options", "-o-", ], - cwd=ROOT_DIR, + cwd=LIBM_DIR, text=True, ) j = json.loads(j) @@ -121,8 +121,8 @@ class Crate: # 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 @@ class Crate: 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 @@ class Crate: 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/library/compiler-builtins/libm/Cargo.toml b/library/compiler-builtins/libm/libm/Cargo.toml similarity index 100% rename from library/compiler-builtins/libm/Cargo.toml rename to library/compiler-builtins/libm/libm/Cargo.toml diff --git a/library/compiler-builtins/libm/build.rs b/library/compiler-builtins/libm/libm/build.rs similarity index 88% rename from library/compiler-builtins/libm/build.rs rename to library/compiler-builtins/libm/libm/build.rs index 7042b54d7e80..07d08ed4364d 100644 --- a/library/compiler-builtins/libm/build.rs +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/configure.rs b/library/compiler-builtins/libm/libm/configure.rs similarity index 100% rename from library/compiler-builtins/libm/configure.rs rename to library/compiler-builtins/libm/libm/configure.rs diff --git a/library/compiler-builtins/libm/src/lib.rs b/library/compiler-builtins/libm/libm/src/lib.rs similarity index 100% rename from library/compiler-builtins/libm/src/lib.rs rename to library/compiler-builtins/libm/libm/src/lib.rs diff --git a/library/compiler-builtins/libm/src/libm_helper.rs b/library/compiler-builtins/libm/libm/src/libm_helper.rs similarity index 100% rename from library/compiler-builtins/libm/src/libm_helper.rs rename to library/compiler-builtins/libm/libm/src/libm_helper.rs diff --git a/library/compiler-builtins/libm/src/math/acos.rs b/library/compiler-builtins/libm/libm/src/math/acos.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/acos.rs rename to library/compiler-builtins/libm/libm/src/math/acos.rs diff --git a/library/compiler-builtins/libm/src/math/acosf.rs b/library/compiler-builtins/libm/libm/src/math/acosf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/acosf.rs rename to library/compiler-builtins/libm/libm/src/math/acosf.rs diff --git a/library/compiler-builtins/libm/src/math/acosh.rs b/library/compiler-builtins/libm/libm/src/math/acosh.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/acosh.rs rename to library/compiler-builtins/libm/libm/src/math/acosh.rs diff --git a/library/compiler-builtins/libm/src/math/acoshf.rs b/library/compiler-builtins/libm/libm/src/math/acoshf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/acoshf.rs rename to library/compiler-builtins/libm/libm/src/math/acoshf.rs diff --git a/library/compiler-builtins/libm/src/math/arch/aarch64.rs b/library/compiler-builtins/libm/libm/src/math/arch/aarch64.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/arch/aarch64.rs rename to library/compiler-builtins/libm/libm/src/math/arch/aarch64.rs diff --git a/library/compiler-builtins/libm/src/math/arch/i586.rs b/library/compiler-builtins/libm/libm/src/math/arch/i586.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/arch/i586.rs rename to library/compiler-builtins/libm/libm/src/math/arch/i586.rs diff --git a/library/compiler-builtins/libm/src/math/arch/i686.rs b/library/compiler-builtins/libm/libm/src/math/arch/i686.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/arch/i686.rs rename to library/compiler-builtins/libm/libm/src/math/arch/i686.rs diff --git a/library/compiler-builtins/libm/src/math/arch/mod.rs b/library/compiler-builtins/libm/libm/src/math/arch/mod.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/arch/mod.rs rename to library/compiler-builtins/libm/libm/src/math/arch/mod.rs diff --git a/library/compiler-builtins/libm/src/math/arch/wasm32.rs b/library/compiler-builtins/libm/libm/src/math/arch/wasm32.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/arch/wasm32.rs rename to library/compiler-builtins/libm/libm/src/math/arch/wasm32.rs diff --git a/library/compiler-builtins/libm/src/math/asin.rs b/library/compiler-builtins/libm/libm/src/math/asin.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/asin.rs rename to library/compiler-builtins/libm/libm/src/math/asin.rs diff --git a/library/compiler-builtins/libm/src/math/asinf.rs b/library/compiler-builtins/libm/libm/src/math/asinf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/asinf.rs rename to library/compiler-builtins/libm/libm/src/math/asinf.rs diff --git a/library/compiler-builtins/libm/src/math/asinh.rs b/library/compiler-builtins/libm/libm/src/math/asinh.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/asinh.rs rename to library/compiler-builtins/libm/libm/src/math/asinh.rs diff --git a/library/compiler-builtins/libm/src/math/asinhf.rs b/library/compiler-builtins/libm/libm/src/math/asinhf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/asinhf.rs rename to library/compiler-builtins/libm/libm/src/math/asinhf.rs diff --git a/library/compiler-builtins/libm/src/math/atan.rs b/library/compiler-builtins/libm/libm/src/math/atan.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/atan.rs rename to library/compiler-builtins/libm/libm/src/math/atan.rs diff --git a/library/compiler-builtins/libm/src/math/atan2.rs b/library/compiler-builtins/libm/libm/src/math/atan2.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/atan2.rs rename to library/compiler-builtins/libm/libm/src/math/atan2.rs diff --git a/library/compiler-builtins/libm/src/math/atan2f.rs b/library/compiler-builtins/libm/libm/src/math/atan2f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/atan2f.rs rename to library/compiler-builtins/libm/libm/src/math/atan2f.rs diff --git a/library/compiler-builtins/libm/src/math/atanf.rs b/library/compiler-builtins/libm/libm/src/math/atanf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/atanf.rs rename to library/compiler-builtins/libm/libm/src/math/atanf.rs diff --git a/library/compiler-builtins/libm/src/math/atanh.rs b/library/compiler-builtins/libm/libm/src/math/atanh.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/atanh.rs rename to library/compiler-builtins/libm/libm/src/math/atanh.rs diff --git a/library/compiler-builtins/libm/src/math/atanhf.rs b/library/compiler-builtins/libm/libm/src/math/atanhf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/atanhf.rs rename to library/compiler-builtins/libm/libm/src/math/atanhf.rs diff --git a/library/compiler-builtins/libm/src/math/cbrt.rs b/library/compiler-builtins/libm/libm/src/math/cbrt.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/cbrt.rs rename to library/compiler-builtins/libm/libm/src/math/cbrt.rs diff --git a/library/compiler-builtins/libm/src/math/cbrtf.rs b/library/compiler-builtins/libm/libm/src/math/cbrtf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/cbrtf.rs rename to library/compiler-builtins/libm/libm/src/math/cbrtf.rs diff --git a/library/compiler-builtins/libm/src/math/ceil.rs b/library/compiler-builtins/libm/libm/src/math/ceil.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/ceil.rs rename to library/compiler-builtins/libm/libm/src/math/ceil.rs diff --git a/library/compiler-builtins/libm/src/math/copysign.rs b/library/compiler-builtins/libm/libm/src/math/copysign.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/copysign.rs rename to library/compiler-builtins/libm/libm/src/math/copysign.rs diff --git a/library/compiler-builtins/libm/libm/src/math/copysignf.rs b/library/compiler-builtins/libm/libm/src/math/copysignf.rs new file mode 100644 index 000000000000..8b9bed4c0c42 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/copysignf128.rs b/library/compiler-builtins/libm/libm/src/math/copysignf128.rs new file mode 100644 index 000000000000..7bd81d42b2e9 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/copysignf16.rs b/library/compiler-builtins/libm/libm/src/math/copysignf16.rs new file mode 100644 index 000000000000..820658686010 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/cos.rs b/library/compiler-builtins/libm/libm/src/math/cos.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/cos.rs rename to library/compiler-builtins/libm/libm/src/math/cos.rs diff --git a/library/compiler-builtins/libm/src/math/cosf.rs b/library/compiler-builtins/libm/libm/src/math/cosf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/cosf.rs rename to library/compiler-builtins/libm/libm/src/math/cosf.rs diff --git a/library/compiler-builtins/libm/src/math/cosh.rs b/library/compiler-builtins/libm/libm/src/math/cosh.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/cosh.rs rename to library/compiler-builtins/libm/libm/src/math/cosh.rs diff --git a/library/compiler-builtins/libm/src/math/coshf.rs b/library/compiler-builtins/libm/libm/src/math/coshf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/coshf.rs rename to library/compiler-builtins/libm/libm/src/math/coshf.rs diff --git a/library/compiler-builtins/libm/src/math/erf.rs b/library/compiler-builtins/libm/libm/src/math/erf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/erf.rs rename to library/compiler-builtins/libm/libm/src/math/erf.rs diff --git a/library/compiler-builtins/libm/src/math/erff.rs b/library/compiler-builtins/libm/libm/src/math/erff.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/erff.rs rename to library/compiler-builtins/libm/libm/src/math/erff.rs diff --git a/library/compiler-builtins/libm/src/math/exp.rs b/library/compiler-builtins/libm/libm/src/math/exp.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/exp.rs rename to library/compiler-builtins/libm/libm/src/math/exp.rs diff --git a/library/compiler-builtins/libm/src/math/exp10.rs b/library/compiler-builtins/libm/libm/src/math/exp10.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/exp10.rs rename to library/compiler-builtins/libm/libm/src/math/exp10.rs diff --git a/library/compiler-builtins/libm/src/math/exp10f.rs b/library/compiler-builtins/libm/libm/src/math/exp10f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/exp10f.rs rename to library/compiler-builtins/libm/libm/src/math/exp10f.rs diff --git a/library/compiler-builtins/libm/src/math/exp2.rs b/library/compiler-builtins/libm/libm/src/math/exp2.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/exp2.rs rename to library/compiler-builtins/libm/libm/src/math/exp2.rs diff --git a/library/compiler-builtins/libm/src/math/exp2f.rs b/library/compiler-builtins/libm/libm/src/math/exp2f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/exp2f.rs rename to library/compiler-builtins/libm/libm/src/math/exp2f.rs diff --git a/library/compiler-builtins/libm/src/math/expf.rs b/library/compiler-builtins/libm/libm/src/math/expf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/expf.rs rename to library/compiler-builtins/libm/libm/src/math/expf.rs diff --git a/library/compiler-builtins/libm/src/math/expm1.rs b/library/compiler-builtins/libm/libm/src/math/expm1.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/expm1.rs rename to library/compiler-builtins/libm/libm/src/math/expm1.rs diff --git a/library/compiler-builtins/libm/src/math/expm1f.rs b/library/compiler-builtins/libm/libm/src/math/expm1f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/expm1f.rs rename to library/compiler-builtins/libm/libm/src/math/expm1f.rs diff --git a/library/compiler-builtins/libm/src/math/expo2.rs b/library/compiler-builtins/libm/libm/src/math/expo2.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/expo2.rs rename to library/compiler-builtins/libm/libm/src/math/expo2.rs diff --git a/library/compiler-builtins/libm/src/math/fabs.rs b/library/compiler-builtins/libm/libm/src/math/fabs.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fabs.rs rename to library/compiler-builtins/libm/libm/src/math/fabs.rs diff --git a/library/compiler-builtins/libm/libm/src/math/fabsf.rs b/library/compiler-builtins/libm/libm/src/math/fabsf.rs new file mode 100644 index 000000000000..e5820a26c523 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/fabsf128.rs b/library/compiler-builtins/libm/libm/src/math/fabsf128.rs new file mode 100644 index 000000000000..46429ca49403 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/fabsf16.rs b/library/compiler-builtins/libm/libm/src/math/fabsf16.rs new file mode 100644 index 000000000000..eee42ac6a3c6 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/fdim.rs b/library/compiler-builtins/libm/libm/src/math/fdim.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fdim.rs rename to library/compiler-builtins/libm/libm/src/math/fdim.rs diff --git a/library/compiler-builtins/libm/libm/src/math/fdimf.rs b/library/compiler-builtins/libm/libm/src/math/fdimf.rs new file mode 100644 index 000000000000..367ef517c63b --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/fdimf128.rs b/library/compiler-builtins/libm/libm/src/math/fdimf128.rs new file mode 100644 index 000000000000..6f3d1d0ff1d5 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/fdimf16.rs b/library/compiler-builtins/libm/libm/src/math/fdimf16.rs new file mode 100644 index 000000000000..37bd68858179 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/floor.rs b/library/compiler-builtins/libm/libm/src/math/floor.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/floor.rs rename to library/compiler-builtins/libm/libm/src/math/floor.rs diff --git a/library/compiler-builtins/libm/libm/src/math/floorf.rs b/library/compiler-builtins/libm/libm/src/math/floorf.rs new file mode 100644 index 000000000000..16957b7f3557 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/floorf128.rs b/library/compiler-builtins/libm/libm/src/math/floorf128.rs new file mode 100644 index 000000000000..9a9fe4151152 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/floorf16.rs b/library/compiler-builtins/libm/libm/src/math/floorf16.rs new file mode 100644 index 000000000000..f9b868e04109 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/fma.rs b/library/compiler-builtins/libm/libm/src/math/fma.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fma.rs rename to library/compiler-builtins/libm/libm/src/math/fma.rs diff --git a/library/compiler-builtins/libm/src/math/fma_wide.rs b/library/compiler-builtins/libm/libm/src/math/fma_wide.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fma_wide.rs rename to library/compiler-builtins/libm/libm/src/math/fma_wide.rs diff --git a/library/compiler-builtins/libm/src/math/fmin_fmax.rs b/library/compiler-builtins/libm/libm/src/math/fmin_fmax.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fmin_fmax.rs rename to library/compiler-builtins/libm/libm/src/math/fmin_fmax.rs diff --git a/library/compiler-builtins/libm/src/math/fminimum_fmaximum.rs b/library/compiler-builtins/libm/libm/src/math/fminimum_fmaximum.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fminimum_fmaximum.rs rename to library/compiler-builtins/libm/libm/src/math/fminimum_fmaximum.rs diff --git a/library/compiler-builtins/libm/src/math/fminimum_fmaximum_num.rs b/library/compiler-builtins/libm/libm/src/math/fminimum_fmaximum_num.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fminimum_fmaximum_num.rs rename to library/compiler-builtins/libm/libm/src/math/fminimum_fmaximum_num.rs diff --git a/library/compiler-builtins/libm/src/math/fmod.rs b/library/compiler-builtins/libm/libm/src/math/fmod.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/fmod.rs rename to library/compiler-builtins/libm/libm/src/math/fmod.rs diff --git a/library/compiler-builtins/libm/libm/src/math/fmodf.rs b/library/compiler-builtins/libm/libm/src/math/fmodf.rs new file mode 100644 index 000000000000..4e95696e20d6 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/fmodf128.rs b/library/compiler-builtins/libm/libm/src/math/fmodf128.rs new file mode 100644 index 000000000000..ff0e0493e26b --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/fmodf16.rs b/library/compiler-builtins/libm/libm/src/math/fmodf16.rs new file mode 100644 index 000000000000..11972a7de4ff --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/frexp.rs b/library/compiler-builtins/libm/libm/src/math/frexp.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/frexp.rs rename to library/compiler-builtins/libm/libm/src/math/frexp.rs diff --git a/library/compiler-builtins/libm/src/math/frexpf.rs b/library/compiler-builtins/libm/libm/src/math/frexpf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/frexpf.rs rename to library/compiler-builtins/libm/libm/src/math/frexpf.rs diff --git a/library/compiler-builtins/libm/src/math/generic/ceil.rs b/library/compiler-builtins/libm/libm/src/math/generic/ceil.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/ceil.rs rename to library/compiler-builtins/libm/libm/src/math/generic/ceil.rs diff --git a/library/compiler-builtins/libm/src/math/generic/copysign.rs b/library/compiler-builtins/libm/libm/src/math/generic/copysign.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/copysign.rs rename to library/compiler-builtins/libm/libm/src/math/generic/copysign.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fabs.rs b/library/compiler-builtins/libm/libm/src/math/generic/fabs.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fabs.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fabs.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fdim.rs b/library/compiler-builtins/libm/libm/src/math/generic/fdim.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fdim.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fdim.rs diff --git a/library/compiler-builtins/libm/src/math/generic/floor.rs b/library/compiler-builtins/libm/libm/src/math/generic/floor.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/floor.rs rename to library/compiler-builtins/libm/libm/src/math/generic/floor.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fmax.rs b/library/compiler-builtins/libm/libm/src/math/generic/fmax.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fmax.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fmax.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fmaximum.rs b/library/compiler-builtins/libm/libm/src/math/generic/fmaximum.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fmaximum.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fmaximum.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fmaximum_num.rs b/library/compiler-builtins/libm/libm/src/math/generic/fmaximum_num.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fmaximum_num.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fmaximum_num.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fmin.rs b/library/compiler-builtins/libm/libm/src/math/generic/fmin.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fmin.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fmin.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fminimum.rs b/library/compiler-builtins/libm/libm/src/math/generic/fminimum.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fminimum.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fminimum.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fminimum_num.rs b/library/compiler-builtins/libm/libm/src/math/generic/fminimum_num.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fminimum_num.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fminimum_num.rs diff --git a/library/compiler-builtins/libm/src/math/generic/fmod.rs b/library/compiler-builtins/libm/libm/src/math/generic/fmod.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/fmod.rs rename to library/compiler-builtins/libm/libm/src/math/generic/fmod.rs diff --git a/library/compiler-builtins/libm/src/math/generic/mod.rs b/library/compiler-builtins/libm/libm/src/math/generic/mod.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/mod.rs rename to library/compiler-builtins/libm/libm/src/math/generic/mod.rs diff --git a/library/compiler-builtins/libm/src/math/generic/rint.rs b/library/compiler-builtins/libm/libm/src/math/generic/rint.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/rint.rs rename to library/compiler-builtins/libm/libm/src/math/generic/rint.rs diff --git a/library/compiler-builtins/libm/src/math/generic/round.rs b/library/compiler-builtins/libm/libm/src/math/generic/round.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/round.rs rename to library/compiler-builtins/libm/libm/src/math/generic/round.rs diff --git a/library/compiler-builtins/libm/src/math/generic/scalbn.rs b/library/compiler-builtins/libm/libm/src/math/generic/scalbn.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/scalbn.rs rename to library/compiler-builtins/libm/libm/src/math/generic/scalbn.rs diff --git a/library/compiler-builtins/libm/src/math/generic/sqrt.rs b/library/compiler-builtins/libm/libm/src/math/generic/sqrt.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/sqrt.rs rename to library/compiler-builtins/libm/libm/src/math/generic/sqrt.rs diff --git a/library/compiler-builtins/libm/src/math/generic/trunc.rs b/library/compiler-builtins/libm/libm/src/math/generic/trunc.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/generic/trunc.rs rename to library/compiler-builtins/libm/libm/src/math/generic/trunc.rs diff --git a/library/compiler-builtins/libm/src/math/hypot.rs b/library/compiler-builtins/libm/libm/src/math/hypot.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/hypot.rs rename to library/compiler-builtins/libm/libm/src/math/hypot.rs diff --git a/library/compiler-builtins/libm/src/math/hypotf.rs b/library/compiler-builtins/libm/libm/src/math/hypotf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/hypotf.rs rename to library/compiler-builtins/libm/libm/src/math/hypotf.rs diff --git a/library/compiler-builtins/libm/src/math/ilogb.rs b/library/compiler-builtins/libm/libm/src/math/ilogb.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/ilogb.rs rename to library/compiler-builtins/libm/libm/src/math/ilogb.rs diff --git a/library/compiler-builtins/libm/src/math/ilogbf.rs b/library/compiler-builtins/libm/libm/src/math/ilogbf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/ilogbf.rs rename to library/compiler-builtins/libm/libm/src/math/ilogbf.rs diff --git a/library/compiler-builtins/libm/src/math/j0.rs b/library/compiler-builtins/libm/libm/src/math/j0.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/j0.rs rename to library/compiler-builtins/libm/libm/src/math/j0.rs diff --git a/library/compiler-builtins/libm/src/math/j0f.rs b/library/compiler-builtins/libm/libm/src/math/j0f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/j0f.rs rename to library/compiler-builtins/libm/libm/src/math/j0f.rs diff --git a/library/compiler-builtins/libm/src/math/j1.rs b/library/compiler-builtins/libm/libm/src/math/j1.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/j1.rs rename to library/compiler-builtins/libm/libm/src/math/j1.rs diff --git a/library/compiler-builtins/libm/src/math/j1f.rs b/library/compiler-builtins/libm/libm/src/math/j1f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/j1f.rs rename to library/compiler-builtins/libm/libm/src/math/j1f.rs diff --git a/library/compiler-builtins/libm/src/math/jn.rs b/library/compiler-builtins/libm/libm/src/math/jn.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/jn.rs rename to library/compiler-builtins/libm/libm/src/math/jn.rs diff --git a/library/compiler-builtins/libm/src/math/jnf.rs b/library/compiler-builtins/libm/libm/src/math/jnf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/jnf.rs rename to library/compiler-builtins/libm/libm/src/math/jnf.rs diff --git a/library/compiler-builtins/libm/src/math/k_cos.rs b/library/compiler-builtins/libm/libm/src/math/k_cos.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_cos.rs rename to library/compiler-builtins/libm/libm/src/math/k_cos.rs diff --git a/library/compiler-builtins/libm/src/math/k_cosf.rs b/library/compiler-builtins/libm/libm/src/math/k_cosf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_cosf.rs rename to library/compiler-builtins/libm/libm/src/math/k_cosf.rs diff --git a/library/compiler-builtins/libm/src/math/k_expo2.rs b/library/compiler-builtins/libm/libm/src/math/k_expo2.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_expo2.rs rename to library/compiler-builtins/libm/libm/src/math/k_expo2.rs diff --git a/library/compiler-builtins/libm/src/math/k_expo2f.rs b/library/compiler-builtins/libm/libm/src/math/k_expo2f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_expo2f.rs rename to library/compiler-builtins/libm/libm/src/math/k_expo2f.rs diff --git a/library/compiler-builtins/libm/src/math/k_sin.rs b/library/compiler-builtins/libm/libm/src/math/k_sin.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_sin.rs rename to library/compiler-builtins/libm/libm/src/math/k_sin.rs diff --git a/library/compiler-builtins/libm/src/math/k_sinf.rs b/library/compiler-builtins/libm/libm/src/math/k_sinf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_sinf.rs rename to library/compiler-builtins/libm/libm/src/math/k_sinf.rs diff --git a/library/compiler-builtins/libm/src/math/k_tan.rs b/library/compiler-builtins/libm/libm/src/math/k_tan.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_tan.rs rename to library/compiler-builtins/libm/libm/src/math/k_tan.rs diff --git a/library/compiler-builtins/libm/src/math/k_tanf.rs b/library/compiler-builtins/libm/libm/src/math/k_tanf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/k_tanf.rs rename to library/compiler-builtins/libm/libm/src/math/k_tanf.rs diff --git a/library/compiler-builtins/libm/src/math/ldexp.rs b/library/compiler-builtins/libm/libm/src/math/ldexp.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/ldexp.rs rename to library/compiler-builtins/libm/libm/src/math/ldexp.rs diff --git a/library/compiler-builtins/libm/libm/src/math/ldexpf.rs b/library/compiler-builtins/libm/libm/src/math/ldexpf.rs new file mode 100644 index 000000000000..95b27fc49d28 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/ldexpf128.rs b/library/compiler-builtins/libm/libm/src/math/ldexpf128.rs new file mode 100644 index 000000000000..b35277d15fba --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/ldexpf16.rs b/library/compiler-builtins/libm/libm/src/math/ldexpf16.rs new file mode 100644 index 000000000000..8de6cffd6998 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/lgamma.rs b/library/compiler-builtins/libm/libm/src/math/lgamma.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/lgamma.rs rename to library/compiler-builtins/libm/libm/src/math/lgamma.rs diff --git a/library/compiler-builtins/libm/src/math/lgamma_r.rs b/library/compiler-builtins/libm/libm/src/math/lgamma_r.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/lgamma_r.rs rename to library/compiler-builtins/libm/libm/src/math/lgamma_r.rs diff --git a/library/compiler-builtins/libm/src/math/lgammaf.rs b/library/compiler-builtins/libm/libm/src/math/lgammaf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/lgammaf.rs rename to library/compiler-builtins/libm/libm/src/math/lgammaf.rs diff --git a/library/compiler-builtins/libm/src/math/lgammaf_r.rs b/library/compiler-builtins/libm/libm/src/math/lgammaf_r.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/lgammaf_r.rs rename to library/compiler-builtins/libm/libm/src/math/lgammaf_r.rs diff --git a/library/compiler-builtins/libm/src/math/log.rs b/library/compiler-builtins/libm/libm/src/math/log.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/log.rs rename to library/compiler-builtins/libm/libm/src/math/log.rs diff --git a/library/compiler-builtins/libm/src/math/log10.rs b/library/compiler-builtins/libm/libm/src/math/log10.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/log10.rs rename to library/compiler-builtins/libm/libm/src/math/log10.rs diff --git a/library/compiler-builtins/libm/src/math/log10f.rs b/library/compiler-builtins/libm/libm/src/math/log10f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/log10f.rs rename to library/compiler-builtins/libm/libm/src/math/log10f.rs diff --git a/library/compiler-builtins/libm/src/math/log1p.rs b/library/compiler-builtins/libm/libm/src/math/log1p.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/log1p.rs rename to library/compiler-builtins/libm/libm/src/math/log1p.rs diff --git a/library/compiler-builtins/libm/src/math/log1pf.rs b/library/compiler-builtins/libm/libm/src/math/log1pf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/log1pf.rs rename to library/compiler-builtins/libm/libm/src/math/log1pf.rs diff --git a/library/compiler-builtins/libm/src/math/log2.rs b/library/compiler-builtins/libm/libm/src/math/log2.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/log2.rs rename to library/compiler-builtins/libm/libm/src/math/log2.rs diff --git a/library/compiler-builtins/libm/src/math/log2f.rs b/library/compiler-builtins/libm/libm/src/math/log2f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/log2f.rs rename to library/compiler-builtins/libm/libm/src/math/log2f.rs diff --git a/library/compiler-builtins/libm/src/math/logf.rs b/library/compiler-builtins/libm/libm/src/math/logf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/logf.rs rename to library/compiler-builtins/libm/libm/src/math/logf.rs diff --git a/library/compiler-builtins/libm/src/math/mod.rs b/library/compiler-builtins/libm/libm/src/math/mod.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/mod.rs rename to library/compiler-builtins/libm/libm/src/math/mod.rs diff --git a/library/compiler-builtins/libm/src/math/modf.rs b/library/compiler-builtins/libm/libm/src/math/modf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/modf.rs rename to library/compiler-builtins/libm/libm/src/math/modf.rs diff --git a/library/compiler-builtins/libm/src/math/modff.rs b/library/compiler-builtins/libm/libm/src/math/modff.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/modff.rs rename to library/compiler-builtins/libm/libm/src/math/modff.rs diff --git a/library/compiler-builtins/libm/src/math/nextafter.rs b/library/compiler-builtins/libm/libm/src/math/nextafter.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/nextafter.rs rename to library/compiler-builtins/libm/libm/src/math/nextafter.rs diff --git a/library/compiler-builtins/libm/src/math/nextafterf.rs b/library/compiler-builtins/libm/libm/src/math/nextafterf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/nextafterf.rs rename to library/compiler-builtins/libm/libm/src/math/nextafterf.rs diff --git a/library/compiler-builtins/libm/src/math/pow.rs b/library/compiler-builtins/libm/libm/src/math/pow.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/pow.rs rename to library/compiler-builtins/libm/libm/src/math/pow.rs diff --git a/library/compiler-builtins/libm/src/math/powf.rs b/library/compiler-builtins/libm/libm/src/math/powf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/powf.rs rename to library/compiler-builtins/libm/libm/src/math/powf.rs diff --git a/library/compiler-builtins/libm/src/math/rem_pio2.rs b/library/compiler-builtins/libm/libm/src/math/rem_pio2.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/rem_pio2.rs rename to library/compiler-builtins/libm/libm/src/math/rem_pio2.rs diff --git a/library/compiler-builtins/libm/src/math/rem_pio2_large.rs b/library/compiler-builtins/libm/libm/src/math/rem_pio2_large.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/rem_pio2_large.rs rename to library/compiler-builtins/libm/libm/src/math/rem_pio2_large.rs diff --git a/library/compiler-builtins/libm/src/math/rem_pio2f.rs b/library/compiler-builtins/libm/libm/src/math/rem_pio2f.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/rem_pio2f.rs rename to library/compiler-builtins/libm/libm/src/math/rem_pio2f.rs diff --git a/library/compiler-builtins/libm/src/math/remainder.rs b/library/compiler-builtins/libm/libm/src/math/remainder.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/remainder.rs rename to library/compiler-builtins/libm/libm/src/math/remainder.rs diff --git a/library/compiler-builtins/libm/src/math/remainderf.rs b/library/compiler-builtins/libm/libm/src/math/remainderf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/remainderf.rs rename to library/compiler-builtins/libm/libm/src/math/remainderf.rs diff --git a/library/compiler-builtins/libm/src/math/remquo.rs b/library/compiler-builtins/libm/libm/src/math/remquo.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/remquo.rs rename to library/compiler-builtins/libm/libm/src/math/remquo.rs diff --git a/library/compiler-builtins/libm/src/math/remquof.rs b/library/compiler-builtins/libm/libm/src/math/remquof.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/remquof.rs rename to library/compiler-builtins/libm/libm/src/math/remquof.rs diff --git a/library/compiler-builtins/libm/src/math/rint.rs b/library/compiler-builtins/libm/libm/src/math/rint.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/rint.rs rename to library/compiler-builtins/libm/libm/src/math/rint.rs diff --git a/library/compiler-builtins/libm/src/math/round.rs b/library/compiler-builtins/libm/libm/src/math/round.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/round.rs rename to library/compiler-builtins/libm/libm/src/math/round.rs diff --git a/library/compiler-builtins/libm/src/math/roundeven.rs b/library/compiler-builtins/libm/libm/src/math/roundeven.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/roundeven.rs rename to library/compiler-builtins/libm/libm/src/math/roundeven.rs diff --git a/library/compiler-builtins/libm/libm/src/math/roundf.rs b/library/compiler-builtins/libm/libm/src/math/roundf.rs new file mode 100644 index 000000000000..b5d7c9d693e7 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/roundf128.rs b/library/compiler-builtins/libm/libm/src/math/roundf128.rs new file mode 100644 index 000000000000..fc3164929fe4 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/roundf16.rs b/library/compiler-builtins/libm/libm/src/math/roundf16.rs new file mode 100644 index 000000000000..8b356eaabeec --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/scalbn.rs b/library/compiler-builtins/libm/libm/src/math/scalbn.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/scalbn.rs rename to library/compiler-builtins/libm/libm/src/math/scalbn.rs diff --git a/library/compiler-builtins/libm/libm/src/math/scalbnf.rs b/library/compiler-builtins/libm/libm/src/math/scalbnf.rs new file mode 100644 index 000000000000..57e7ba76f60b --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/scalbnf128.rs b/library/compiler-builtins/libm/libm/src/math/scalbnf128.rs new file mode 100644 index 000000000000..c1d2b4855856 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/scalbnf16.rs b/library/compiler-builtins/libm/libm/src/math/scalbnf16.rs new file mode 100644 index 000000000000..2209e1a17956 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/sin.rs b/library/compiler-builtins/libm/libm/src/math/sin.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/sin.rs rename to library/compiler-builtins/libm/libm/src/math/sin.rs diff --git a/library/compiler-builtins/libm/src/math/sincos.rs b/library/compiler-builtins/libm/libm/src/math/sincos.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/sincos.rs rename to library/compiler-builtins/libm/libm/src/math/sincos.rs diff --git a/library/compiler-builtins/libm/src/math/sincosf.rs b/library/compiler-builtins/libm/libm/src/math/sincosf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/sincosf.rs rename to library/compiler-builtins/libm/libm/src/math/sincosf.rs diff --git a/library/compiler-builtins/libm/src/math/sinf.rs b/library/compiler-builtins/libm/libm/src/math/sinf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/sinf.rs rename to library/compiler-builtins/libm/libm/src/math/sinf.rs diff --git a/library/compiler-builtins/libm/src/math/sinh.rs b/library/compiler-builtins/libm/libm/src/math/sinh.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/sinh.rs rename to library/compiler-builtins/libm/libm/src/math/sinh.rs diff --git a/library/compiler-builtins/libm/src/math/sinhf.rs b/library/compiler-builtins/libm/libm/src/math/sinhf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/sinhf.rs rename to library/compiler-builtins/libm/libm/src/math/sinhf.rs diff --git a/library/compiler-builtins/libm/src/math/sqrt.rs b/library/compiler-builtins/libm/libm/src/math/sqrt.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/sqrt.rs rename to library/compiler-builtins/libm/libm/src/math/sqrt.rs diff --git a/library/compiler-builtins/libm/libm/src/math/sqrtf.rs b/library/compiler-builtins/libm/libm/src/math/sqrtf.rs new file mode 100644 index 000000000000..c28a705e378e --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/sqrtf128.rs b/library/compiler-builtins/libm/libm/src/math/sqrtf128.rs new file mode 100644 index 000000000000..eaef6ae0c1c8 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/sqrtf16.rs b/library/compiler-builtins/libm/libm/src/math/sqrtf16.rs new file mode 100644 index 000000000000..7bedb7f8bbb6 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/src/math/support/big.rs b/library/compiler-builtins/libm/libm/src/math/support/big.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/big.rs rename to library/compiler-builtins/libm/libm/src/math/support/big.rs diff --git a/library/compiler-builtins/libm/src/math/support/big/tests.rs b/library/compiler-builtins/libm/libm/src/math/support/big/tests.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/big/tests.rs rename to library/compiler-builtins/libm/libm/src/math/support/big/tests.rs diff --git a/library/compiler-builtins/libm/src/math/support/env.rs b/library/compiler-builtins/libm/libm/src/math/support/env.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/env.rs rename to library/compiler-builtins/libm/libm/src/math/support/env.rs diff --git a/library/compiler-builtins/libm/src/math/support/float_traits.rs b/library/compiler-builtins/libm/libm/src/math/support/float_traits.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/float_traits.rs rename to library/compiler-builtins/libm/libm/src/math/support/float_traits.rs diff --git a/library/compiler-builtins/libm/src/math/support/hex_float.rs b/library/compiler-builtins/libm/libm/src/math/support/hex_float.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/hex_float.rs rename to library/compiler-builtins/libm/libm/src/math/support/hex_float.rs diff --git a/library/compiler-builtins/libm/src/math/support/int_traits.rs b/library/compiler-builtins/libm/libm/src/math/support/int_traits.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/int_traits.rs rename to library/compiler-builtins/libm/libm/src/math/support/int_traits.rs diff --git a/library/compiler-builtins/libm/src/math/support/macros.rs b/library/compiler-builtins/libm/libm/src/math/support/macros.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/macros.rs rename to library/compiler-builtins/libm/libm/src/math/support/macros.rs diff --git a/library/compiler-builtins/libm/src/math/support/mod.rs b/library/compiler-builtins/libm/libm/src/math/support/mod.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/support/mod.rs rename to library/compiler-builtins/libm/libm/src/math/support/mod.rs diff --git a/library/compiler-builtins/libm/src/math/tan.rs b/library/compiler-builtins/libm/libm/src/math/tan.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/tan.rs rename to library/compiler-builtins/libm/libm/src/math/tan.rs diff --git a/library/compiler-builtins/libm/src/math/tanf.rs b/library/compiler-builtins/libm/libm/src/math/tanf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/tanf.rs rename to library/compiler-builtins/libm/libm/src/math/tanf.rs diff --git a/library/compiler-builtins/libm/src/math/tanh.rs b/library/compiler-builtins/libm/libm/src/math/tanh.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/tanh.rs rename to library/compiler-builtins/libm/libm/src/math/tanh.rs diff --git a/library/compiler-builtins/libm/src/math/tanhf.rs b/library/compiler-builtins/libm/libm/src/math/tanhf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/tanhf.rs rename to library/compiler-builtins/libm/libm/src/math/tanhf.rs diff --git a/library/compiler-builtins/libm/src/math/tgamma.rs b/library/compiler-builtins/libm/libm/src/math/tgamma.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/tgamma.rs rename to library/compiler-builtins/libm/libm/src/math/tgamma.rs diff --git a/library/compiler-builtins/libm/src/math/tgammaf.rs b/library/compiler-builtins/libm/libm/src/math/tgammaf.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/tgammaf.rs rename to library/compiler-builtins/libm/libm/src/math/tgammaf.rs diff --git a/library/compiler-builtins/libm/src/math/trunc.rs b/library/compiler-builtins/libm/libm/src/math/trunc.rs similarity index 100% rename from library/compiler-builtins/libm/src/math/trunc.rs rename to library/compiler-builtins/libm/libm/src/math/trunc.rs diff --git a/library/compiler-builtins/libm/libm/src/math/truncf.rs b/library/compiler-builtins/libm/libm/src/math/truncf.rs new file mode 100644 index 000000000000..14533a267063 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/truncf128.rs b/library/compiler-builtins/libm/libm/src/math/truncf128.rs new file mode 100644 index 000000000000..9dccc0d0e9d7 --- /dev/null +++ b/library/compiler-builtins/libm/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/library/compiler-builtins/libm/libm/src/math/truncf16.rs b/library/compiler-builtins/libm/libm/src/math/truncf16.rs new file mode 100644 index 000000000000..d7c3d225cf9b --- /dev/null +++ b/library/compiler-builtins/libm/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) +}