diff --git a/Cargo.lock b/Cargo.lock index 1ede15ff002..1584c704fb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -178,6 +178,8 @@ version = "0.1.0" dependencies = [ "core_simd", "test_helpers", + "wasm-bindgen", + "wasm-bindgen-test", ] [[package]] diff --git a/crates/std_float/src/lib.rs b/crates/std_float/src/lib.rs index 44bbcba412f..c9c4345adad 100644 --- a/crates/std_float/src/lib.rs +++ b/crates/std_float/src/lib.rs @@ -1,4 +1,3 @@ -#![cfg_attr(feature = "as_crate", no_std)] // We are std! #![cfg_attr( feature = "as_crate", feature(core_intrinsics), @@ -188,4 +187,14 @@ where fn fract(self) -> Self { self - self.trunc() } + + // https://github.com/llvm/llvm-project/issues/83729 + #[cfg(target_arch = "aarch64")] + fn ln(self) -> Self { + let mut ln = Self::splat(0f64); + for i in 0..N { + ln[i] = self[i].ln() + } + ln + } } diff --git a/crates/std_float/tests/float.rs b/crates/std_float/tests/float.rs index 60bdf00fba8..c66c968f8c6 100644 --- a/crates/std_float/tests/float.rs +++ b/crates/std_float/tests/float.rs @@ -53,9 +53,19 @@ macro_rules! impl_tests { mod $scalar { use std_float::StdFloat; - unary_test! { $scalar, sqrt, sin, cos, exp, exp2, ln, log2, log10, ceil, floor, round, trunc, fract } + unary_test! { $scalar, sqrt, sin, cos, exp, exp2, ln, log2, log10, ceil, floor, round, trunc } binary_test! { $scalar, log } ternary_test! { $scalar, mul_add } + + test_helpers::test_lanes! { + fn fract() { + test_helpers::test_unary_elementwise_flush_subnormals( + &core_simd::simd::Simd::<$scalar, LANES>::fract, + &$scalar::fract, + &|_| true, + ) + } + } } } }