Skip to content

Commit f6691f3

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

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg_attr(feature = "as_crate", no_std)] // We are std!
21
#![cfg_attr(
32
feature = "as_crate",
43
feature(core_intrinsics),
@@ -188,4 +187,14 @@ where
188187
fn fract(self) -> Self {
189188
self - self.trunc()
190189
}
190+
191+
// https://github.com/llvm/llvm-project/issues/83729
192+
#[cfg(target_arch = "aarch64")]
193+
fn ln(self) -> Self {
194+
let mut ln = Self::splat(0f64);
195+
for i in 0..N {
196+
ln[i] = self[i].ln()
197+
}
198+
ln
199+
}
191200
}

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)