Skip to content

Commit c5a0d98

Browse files
committed
Attempt to avoid LLVM error
1 parent 2f062b8 commit c5a0d98

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/std_float/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,14 @@ where
188188
fn fract(self) -> Self {
189189
self - self.trunc()
190190
}
191+
192+
// https://github.com/llvm/llvm-project/issues/83729
193+
#[cfg(target_arch = "aarch64")]
194+
fn ln(self) -> Self {
195+
if N == 1 {
196+
Self::splat(self[0].ln())
197+
} else {
198+
unsafe { intrinsics::simd_flog(self) }
199+
}
200+
}
191201
}

crates/std_float/tests/float.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,19 @@ macro_rules! impl_tests {
5353
mod $scalar {
5454
use std_float::StdFloat;
5555

56-
unary_test! { $scalar, sqrt, sin, cos, exp, exp2, ln, log2, log10, ceil, floor, round, trunc, fract }
56+
unary_test! { $scalar, sqrt, sin, cos, exp, exp2, ln, log2, log10, ceil, floor, round, trunc }
5757
binary_test! { $scalar, log }
5858
ternary_test! { $scalar, mul_add }
59+
60+
test_helpers::test_lanes! {
61+
fn fract<const LANES: usize>() {
62+
test_helpers::test_unary_elementwise_flush_subnormals(
63+
&core_simd::simd::Simd::<$scalar, LANES>::fract,
64+
&$scalar::fract,
65+
&|_| true,
66+
)
67+
}
68+
}
5969
}
6070
}
6171
}

0 commit comments

Comments
 (0)