Skip to content

Commit a0c30f3

Browse files
authored
Move vector combine intrisics to arm/neon.rs (rust-lang#1363)
1 parent c3b6820 commit a0c30f3

File tree

3 files changed

+209
-177
lines changed

3 files changed

+209
-177
lines changed

crates/core_arch/src/aarch64/neon/mod.rs

-166
Original file line numberDiff line numberDiff line change
@@ -1964,94 +1964,6 @@ pub unsafe fn vext_f64<const N: i32>(a: float64x1_t, _b: float64x1_t) -> float64
19641964
static_assert!(N : i32 where N == 0);
19651965
a
19661966
}
1967-
/// Vector combine
1968-
#[inline]
1969-
#[target_feature(enable = "neon")]
1970-
#[cfg_attr(test, assert_instr(mov))]
1971-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
1972-
pub unsafe fn vcombine_s8(low: int8x8_t, high: int8x8_t) -> int8x16_t {
1973-
simd_shuffle16!(
1974-
low,
1975-
high,
1976-
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
1977-
)
1978-
}
1979-
1980-
/// Vector combine
1981-
#[inline]
1982-
#[target_feature(enable = "neon")]
1983-
#[cfg_attr(test, assert_instr(mov))]
1984-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
1985-
pub unsafe fn vcombine_s16(low: int16x4_t, high: int16x4_t) -> int16x8_t {
1986-
simd_shuffle8!(low, high, [0, 1, 2, 3, 4, 5, 6, 7])
1987-
}
1988-
1989-
/// Vector combine
1990-
#[inline]
1991-
#[target_feature(enable = "neon")]
1992-
#[cfg_attr(test, assert_instr(mov))]
1993-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
1994-
pub unsafe fn vcombine_s32(low: int32x2_t, high: int32x2_t) -> int32x4_t {
1995-
simd_shuffle4!(low, high, [0, 1, 2, 3])
1996-
}
1997-
1998-
/// Vector combine
1999-
#[inline]
2000-
#[target_feature(enable = "neon")]
2001-
#[cfg_attr(test, assert_instr(mov))]
2002-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2003-
pub unsafe fn vcombine_s64(low: int64x1_t, high: int64x1_t) -> int64x2_t {
2004-
simd_shuffle2!(low, high, [0, 1])
2005-
}
2006-
2007-
/// Vector combine
2008-
#[inline]
2009-
#[target_feature(enable = "neon")]
2010-
#[cfg_attr(test, assert_instr(mov))]
2011-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2012-
pub unsafe fn vcombine_u8(low: uint8x8_t, high: uint8x8_t) -> uint8x16_t {
2013-
simd_shuffle16!(
2014-
low,
2015-
high,
2016-
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
2017-
)
2018-
}
2019-
2020-
/// Vector combine
2021-
#[inline]
2022-
#[target_feature(enable = "neon")]
2023-
#[cfg_attr(test, assert_instr(mov))]
2024-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2025-
pub unsafe fn vcombine_u16(low: uint16x4_t, high: uint16x4_t) -> uint16x8_t {
2026-
simd_shuffle8!(low, high, [0, 1, 2, 3, 4, 5, 6, 7])
2027-
}
2028-
2029-
/// Vector combine
2030-
#[inline]
2031-
#[target_feature(enable = "neon")]
2032-
#[cfg_attr(test, assert_instr(mov))]
2033-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2034-
pub unsafe fn vcombine_u32(low: uint32x2_t, high: uint32x2_t) -> uint32x4_t {
2035-
simd_shuffle4!(low, high, [0, 1, 2, 3])
2036-
}
2037-
2038-
/// Vector combine
2039-
#[inline]
2040-
#[target_feature(enable = "neon")]
2041-
#[cfg_attr(test, assert_instr(mov))]
2042-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2043-
pub unsafe fn vcombine_u64(low: uint64x1_t, high: uint64x1_t) -> uint64x2_t {
2044-
simd_shuffle2!(low, high, [0, 1])
2045-
}
2046-
2047-
/// Vector combine
2048-
#[inline]
2049-
#[target_feature(enable = "neon")]
2050-
#[cfg_attr(test, assert_instr(mov))]
2051-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2052-
pub unsafe fn vcombine_p64(low: poly64x1_t, high: poly64x1_t) -> poly64x2_t {
2053-
simd_shuffle2!(low, high, [0, 1])
2054-
}
20551967

20561968
/// Duplicate vector element to vector or scalar
20571969
#[inline]
@@ -2183,47 +2095,6 @@ pub unsafe fn vgetq_lane_f64<const IMM5: i32>(v: float64x2_t) -> f64 {
21832095
simd_extract(v, IMM5 as u32)
21842096
}
21852097

2186-
/* FIXME: 16-bit float
2187-
/// Vector combine
2188-
#[inline]
2189-
#[target_feature(enable = "neon")]
2190-
#[cfg_attr(test, assert_instr(mov))]
2191-
pub unsafe fn vcombine_f16 ( low: float16x4_t, high: float16x4_t) -> float16x8_t {
2192-
simd_shuffle8!(low, high, [0, 1, 2, 3, 4, 5, 6, 7])
2193-
}
2194-
*/
2195-
2196-
/// Vector combine
2197-
#[inline]
2198-
#[target_feature(enable = "neon")]
2199-
#[cfg_attr(test, assert_instr(mov))]
2200-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2201-
pub unsafe fn vcombine_f32(low: float32x2_t, high: float32x2_t) -> float32x4_t {
2202-
simd_shuffle4!(low, high, [0, 1, 2, 3])
2203-
}
2204-
2205-
/// Vector combine
2206-
#[inline]
2207-
#[target_feature(enable = "neon")]
2208-
#[cfg_attr(test, assert_instr(mov))]
2209-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2210-
pub unsafe fn vcombine_p8(low: poly8x8_t, high: poly8x8_t) -> poly8x16_t {
2211-
simd_shuffle16!(
2212-
low,
2213-
high,
2214-
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
2215-
)
2216-
}
2217-
2218-
/// Vector combine
2219-
#[inline]
2220-
#[target_feature(enable = "neon")]
2221-
#[cfg_attr(test, assert_instr(mov))]
2222-
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
2223-
pub unsafe fn vcombine_p16(low: poly16x4_t, high: poly16x4_t) -> poly16x8_t {
2224-
simd_shuffle8!(low, high, [0, 1, 2, 3, 4, 5, 6, 7])
2225-
}
2226-
22272098
/// Vector combine
22282099
#[inline]
22292100
#[target_feature(enable = "neon")]
@@ -4478,43 +4349,6 @@ mod tests {
44784349
assert_eq!(r, e);
44794350
}
44804351

4481-
macro_rules! test_vcombine {
4482-
($test_id:ident => $fn_id:ident ([$($a:expr),*], [$($b:expr),*])) => {
4483-
#[allow(unused_assignments)]
4484-
#[simd_test(enable = "neon")]
4485-
unsafe fn $test_id() {
4486-
let a = [$($a),*];
4487-
let b = [$($b),*];
4488-
let e = [$($a),* $(, $b)*];
4489-
let c = $fn_id(transmute(a), transmute(b));
4490-
let mut d = e;
4491-
d = transmute(c);
4492-
assert_eq!(d, e);
4493-
}
4494-
}
4495-
}
4496-
4497-
test_vcombine!(test_vcombine_s8 => vcombine_s8([3_i8, -4, 5, -6, 7, 8, 9, 10], [13_i8, -14, 15, -16, 17, 18, 19, 110]));
4498-
test_vcombine!(test_vcombine_u8 => vcombine_u8([3_u8, 4, 5, 6, 7, 8, 9, 10], [13_u8, 14, 15, 16, 17, 18, 19, 110]));
4499-
test_vcombine!(test_vcombine_p8 => vcombine_p8([3_u8, 4, 5, 6, 7, 8, 9, 10], [13_u8, 14, 15, 16, 17, 18, 19, 110]));
4500-
4501-
test_vcombine!(test_vcombine_s16 => vcombine_s16([3_i16, -4, 5, -6], [13_i16, -14, 15, -16]));
4502-
test_vcombine!(test_vcombine_u16 => vcombine_u16([3_u16, 4, 5, 6], [13_u16, 14, 15, 16]));
4503-
test_vcombine!(test_vcombine_p16 => vcombine_p16([3_u16, 4, 5, 6], [13_u16, 14, 15, 16]));
4504-
// FIXME: 16-bit floats
4505-
// test_vcombine!(test_vcombine_f16 => vcombine_f16([3_f16, 4., 5., 6.],
4506-
// [13_f16, 14., 15., 16.]));
4507-
4508-
test_vcombine!(test_vcombine_s32 => vcombine_s32([3_i32, -4], [13_i32, -14]));
4509-
test_vcombine!(test_vcombine_u32 => vcombine_u32([3_u32, 4], [13_u32, 14]));
4510-
// note: poly32x4 does not exist, and neither does vcombine_p32
4511-
test_vcombine!(test_vcombine_f32 => vcombine_f32([3_f32, -4.], [13_f32, -14.]));
4512-
4513-
test_vcombine!(test_vcombine_s64 => vcombine_s64([-3_i64], [13_i64]));
4514-
test_vcombine!(test_vcombine_u64 => vcombine_u64([3_u64], [13_u64]));
4515-
test_vcombine!(test_vcombine_p64 => vcombine_p64([3_u64], [13_u64]));
4516-
test_vcombine!(test_vcombine_f64 => vcombine_f64([-3_f64], [13_f64]));
4517-
45184352
#[simd_test(enable = "neon")]
45194353
unsafe fn test_vdup_n_f64() {
45204354
let a: f64 = 3.3;

0 commit comments

Comments
 (0)