Skip to content

Commit

Permalink
fix vrsqrt on arm neon (rust-lang#423)
Browse files Browse the repository at this point in the history
Closes rust-lang#383 .
  • Loading branch information
gnzlbg authored and alexcrichton committed Apr 11, 2018
1 parent 829272d commit 4d554b4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions coresimd/arm/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ impl_from_bits_!(

#[allow(improper_ctypes)]
extern "C" {
#[cfg(target_arch = "aarch64")]
#[link_name = "llvm.aarch64.neon.frsqrte.v2f32"]
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.frsqrte.v2f32")]
#[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vrsqrte.v2f32")]
fn frsqrte_v2f32(a: float32x2_t) -> float32x2_t;
}

Expand Down Expand Up @@ -724,11 +724,10 @@ pub unsafe fn vmovl_u32(a: uint32x2_t) -> uint64x2_t {
}

/// Reciprocal square-root estimate.
#[cfg(target_arch = "aarch64")]
// FIXME (https://github.com/rust-lang-nursery/stdsimd/issues/383)
#[inline]
#[target_feature(enable = "neon")]
#[cfg_attr(test, assert_instr(frsqrte))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(frsqrte))]
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vrsqrte))]
pub unsafe fn vrsqrte_f32(a: float32x2_t) -> float32x2_t {
frsqrte_v2f32(a)
}
Expand Down Expand Up @@ -1022,7 +1021,6 @@ mod tests {
assert_eq!(r, e);
}

#[cfg(target_arch = "aarch64")]
#[simd_test = "neon"]
unsafe fn test_vrsqrt_f32() {
let a = f32x2::new(1.0, 2.0);
Expand Down

0 comments on commit 4d554b4

Please sign in to comment.