Skip to content

Commit 71a3515

Browse files
committed
add vst1q_u8
1 parent 8fb12a4 commit 71a3515

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

crates/core_arch/src/arm/neon.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ pub unsafe fn vld1q_s8(addr: *const i8) -> int8x16_t {
15481548
*(addr as *const int8x16_t)
15491549
}
15501550

1551-
// int8x16_t vld1q_s8 (int8_t const * ptr)
1551+
/// int8x16_t vld1q_s8 (int8_t const * ptr)
15521552
#[inline]
15531553
#[target_feature(enable = "neon")]
15541554
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
@@ -1557,6 +1557,15 @@ pub unsafe fn vld1q_u8(addr: *const u8) -> uint8x16_t {
15571557
*(addr as *const uint8x16_t)
15581558
}
15591559

1560+
/// void vst1q_u8 (uint8_t * ptr, uint8x16_t val)
1561+
#[inline]
1562+
#[target_feature(enable = "neon")]
1563+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
1564+
#[cfg_attr(test, assert_instr(st1))]
1565+
pub unsafe fn vst1q_u8(addr: *mut u8, val: uint8x16_t) {
1566+
ptr::write(addr as *mut uint8x16_t, val);
1567+
}
1568+
15601569
macro_rules! arm_reinterpret {
15611570
($name:ident, $from:ty, $to:ty) => {
15621571
// Vector reinterpret cast operation
@@ -1767,6 +1776,15 @@ mod tests {
17671776
assert_eq!(r, e);
17681777
}
17691778

1779+
#[simd_test(enable = "neon")]
1780+
unsafe fn test_vst1q_u8() {
1781+
let a = u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1782+
let e = a;
1783+
let mut r = u8x16::new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1784+
vst1q_u8(transmute(&mut r), transmute(a));
1785+
assert_eq!(r, e);
1786+
}
1787+
17701788
#[simd_test(enable = "neon")]
17711789
unsafe fn test_vreinterpret_u64_u32() {
17721790
let v: i8 = 42;

0 commit comments

Comments
 (0)