Merge pull request #120 from miguelraz/simd_fsqrt
add simd_fsqrt intrinsic
This commit is contained in:
commit
20c3b8e13f
@ -45,6 +45,9 @@ extern "platform-intrinsic" {
|
|||||||
|
|
||||||
/// fabs
|
/// fabs
|
||||||
pub(crate) fn simd_fabs<T>(x: T) -> T;
|
pub(crate) fn simd_fabs<T>(x: T) -> T;
|
||||||
|
|
||||||
|
/// fsqrt
|
||||||
|
pub(crate) fn simd_fsqrt<T>(x: T) -> T;
|
||||||
|
|
||||||
pub(crate) fn simd_eq<T, U>(x: T, y: T) -> U;
|
pub(crate) fn simd_eq<T, U>(x: T, y: T) -> U;
|
||||||
pub(crate) fn simd_ne<T, U>(x: T, y: T) -> U;
|
pub(crate) fn simd_ne<T, U>(x: T, y: T) -> U;
|
||||||
|
@ -35,6 +35,14 @@ macro_rules! impl_float_vector {
|
|||||||
pub fn abs(self) -> Self {
|
pub fn abs(self) -> Self {
|
||||||
unsafe { crate::intrinsics::simd_fabs(self) }
|
unsafe { crate::intrinsics::simd_fabs(self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Produces a vector where every lane has the square root value
|
||||||
|
/// of the equivalently-indexed lane in `self`
|
||||||
|
#[inline]
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
pub fn sqrt(self) -> Self {
|
||||||
|
unsafe { crate::intrinsics::simd_fsqrt(self) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const LANES: usize> $name<LANES>
|
impl<const LANES: usize> $name<LANES>
|
||||||
|
@ -426,6 +426,13 @@ macro_rules! impl_float_tests {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sqrt<const LANES: usize>() {
|
||||||
|
test_helpers::test_unary_elementwise(
|
||||||
|
&Vector::<LANES>::sqrt,
|
||||||
|
&Scalar::sqrt,
|
||||||
|
&|_| true,
|
||||||
|
)
|
||||||
|
}
|
||||||
fn horizontal_sum<const LANES: usize>() {
|
fn horizontal_sum<const LANES: usize>() {
|
||||||
test_helpers::test_1(&|x| {
|
test_helpers::test_1(&|x| {
|
||||||
test_helpers::prop_assert_biteq! (
|
test_helpers::prop_assert_biteq! (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user