Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions crates/core_arch/src/aarch64/neon/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,34 @@ pub unsafe fn vcvtpq_u64_f64(a: float64x2_t) -> uint64x2_t {
vcvtpq_u64_f64_(a)
}

/// Extract vector from pair of vectors
#[inline]
#[target_feature(enable = "neon")]
#[cfg_attr(test, assert_instr(ext, N = 1))]
#[rustc_legacy_const_generics(2)]
pub unsafe fn vextq_p64<const N: i32>(a: poly64x2_t, b: poly64x2_t) -> poly64x2_t {
static_assert_imm1!(N);
match N & 0b1 {
0 => simd_shuffle2(a, b, [0, 1]),
1 => simd_shuffle2(a, b, [1, 2]),
_ => unreachable_unchecked(),
}
}

/// Extract vector from pair of vectors
#[inline]
#[target_feature(enable = "neon")]
#[cfg_attr(test, assert_instr(ext, N = 1))]
#[rustc_legacy_const_generics(2)]
pub unsafe fn vextq_f64<const N: i32>(a: float64x2_t, b: float64x2_t) -> float64x2_t {
static_assert_imm1!(N);
match N & 0b1 {
0 => simd_shuffle2(a, b, [0, 1]),
1 => simd_shuffle2(a, b, [1, 2]),
_ => unreachable_unchecked(),
}
}

/// Floating-point multiply-add to accumulator
#[inline]
#[target_feature(enable = "neon")]
Expand Down Expand Up @@ -5614,6 +5642,24 @@ mod test {
assert_eq!(r, e);
}

#[simd_test(enable = "neon")]
unsafe fn test_vextq_p64() {
let a: i64x2 = i64x2::new(0, 8);
let b: i64x2 = i64x2::new(9, 11);
let e: i64x2 = i64x2::new(8, 9);
let r: i64x2 = transmute(vextq_p64::<1>(transmute(a), transmute(b)));
assert_eq!(r, e);
}

#[simd_test(enable = "neon")]
unsafe fn test_vextq_f64() {
let a: f64x2 = f64x2::new(0., 2.);
let b: f64x2 = f64x2::new(3., 4.);
let e: f64x2 = f64x2::new(2., 3.);
let r: f64x2 = transmute(vextq_f64::<1>(transmute(a), transmute(b)));
assert_eq!(r, e);
}

#[simd_test(enable = "neon")]
unsafe fn test_vmla_f64() {
let a: f64 = 0.;
Expand Down
42 changes: 42 additions & 0 deletions crates/core_arch/src/aarch64/neon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::{
};
#[cfg(test)]
use stdarch_test::assert_instr;
use core::hint::unreachable_unchecked;

types! {
/// ARM-specific 64-bit wide vector of one packed `f64`.
Expand Down Expand Up @@ -1427,6 +1428,29 @@ pub unsafe fn vpmaxq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t {
vpmaxq_f64_(a, b)
}

/// Extract vector from pair of vectors
#[inline]
#[target_feature(enable = "neon")]
#[cfg_attr(test, assert_instr(str, N = 0))]
#[rustc_legacy_const_generics(2)]
pub unsafe fn vext_p64<const N: i32>(a: poly64x1_t, _b: poly64x1_t) -> poly64x1_t {
if N != 0 {
unreachable_unchecked()
}
a
}

/// Extract vector from pair of vectors
#[inline]
#[target_feature(enable = "neon")]
#[cfg_attr(test, assert_instr(str, N = 0))]
#[rustc_legacy_const_generics(2)]
pub unsafe fn vext_f64<const N: i32>(a: float64x1_t, _b: float64x1_t) -> float64x1_t {
if N != 0 {
unreachable_unchecked()
}
a
}
/// Vector combine
#[inline]
#[target_feature(enable = "neon")]
Expand Down Expand Up @@ -3470,6 +3494,24 @@ mod tests {
assert_eq!(r, e);
}

#[simd_test(enable = "neon")]
unsafe fn test_vext_p64() {
let a: i64x1 = i64x1::new(0);
let b: i64x1 = i64x1::new(1);
let e: i64x1 = i64x1::new(0);
let r: i64x1 = transmute(vext_p64::<0>(transmute(a), transmute(b)));
assert_eq!(r, e);
}

#[simd_test(enable = "neon")]
unsafe fn test_vext_f64() {
let a: f64x1 = f64x1::new(0.);
let b: f64x1 = f64x1::new(1.);
let e: f64x1 = f64x1::new(0.);
let r: f64x1 = transmute(vext_f64::<0>(transmute(a), transmute(b)));
assert_eq!(r, e);
}

macro_rules! test_vcombine {
($test_id:ident => $fn_id:ident ([$($a:expr),*], [$($b:expr),*])) => {
#[allow(unused_assignments)]
Expand Down
Loading