Skip to content

Commit

Permalink
Merge pull request rust-lang#95 from rust-lang/intrinsic-fabs
Browse files Browse the repository at this point in the history
Use fabs intrinsic
  • Loading branch information
calebzulawski authored Apr 19, 2021
2 parents e73985f + 9acc112 commit b2e25bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions crates/core_simd/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ extern "platform-intrinsic" {
#[cfg(feature = "std")]
pub(crate) fn simd_ceil<T>(x: T) -> T;

/// fabs
pub(crate) fn simd_fabs<T>(x: T) -> T;

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_lt<T, U>(x: T, y: T) -> U;
Expand Down
3 changes: 1 addition & 2 deletions crates/core_simd/src/vector/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ macro_rules! impl_float_vector {
/// equivalently-indexed lane in `self`.
#[inline]
pub fn abs(self) -> Self {
let no_sign = crate::$bits_ty::splat(!0 >> 1);
Self::from_bits(self.to_bits() & no_sign)
unsafe { crate::intrinsics::simd_fabs(self) }
}
}

Expand Down

0 comments on commit b2e25bc

Please sign in to comment.