Skip to content

Commit

Permalink
Attempt to avoid LLVM error
Browse files Browse the repository at this point in the history
  • Loading branch information
calebzulawski committed Mar 3, 2024
1 parent 2f062b8 commit f6691f3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion crates/std_float/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg_attr(feature = "as_crate", no_std)] // We are std!
#![cfg_attr(
feature = "as_crate",
feature(core_intrinsics),
Expand Down Expand Up @@ -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
}
}
12 changes: 11 additions & 1 deletion crates/std_float/tests/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<const LANES: usize>() {
test_helpers::test_unary_elementwise_flush_subnormals(
&core_simd::simd::Simd::<$scalar, LANES>::fract,
&$scalar::fract,
&|_| true,
)
}
}
}
}
}
Expand Down

0 comments on commit f6691f3

Please sign in to comment.