Skip to content

Commit 8cb42c9

Browse files
jmaibaumgnzlbg
authored andcommitted
Add ARM Neon vmnv_p8/vmvnq_p8 bw not intrinsics
1 parent 11fb4c3 commit 8cb42c9

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

crates/core_arch/src/arm/neon.rs

+42
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,30 @@ pub unsafe fn vmvnq_u32(a: uint32x4_t) -> uint32x4_t {
674674
simd_xor(a, b)
675675
}
676676

677+
/// Vector bitwise not.
678+
#[inline]
679+
#[target_feature(enable = "neon")]
680+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
681+
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
682+
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
683+
pub unsafe fn vmvn_p8(a: poly8x8_t) -> poly8x8_t {
684+
let b = poly8x8_t(255, 255, 255, 255, 255, 255, 255, 255);
685+
simd_xor(a, b)
686+
}
687+
688+
/// Vector bitwise not.
689+
#[inline]
690+
#[target_feature(enable = "neon")]
691+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
692+
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
693+
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
694+
pub unsafe fn vmvnq_p8(a: poly8x16_t) -> poly8x16_t {
695+
let b = poly8x16_t(
696+
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
697+
);
698+
simd_xor(a, b)
699+
}
700+
677701
/// Folding minimum of adjacent pairs
678702
#[inline]
679703
#[target_feature(enable = "neon")]
@@ -1406,6 +1430,24 @@ mod tests {
14061430
assert_eq!(r, e);
14071431
}
14081432

1433+
#[simd_test(enable = "neon")]
1434+
unsafe fn test_vmvn_p8() {
1435+
let a = u8x8::new(0, 1, 2, 3, 4, 5, 6, 7);
1436+
let e = u8x8::new(255, 254, 253, 252, 251, 250, 249, 248);
1437+
let r: u8x8 = transmute(vmvn_p8(transmute(a)));
1438+
assert_eq!(r, e);
1439+
}
1440+
1441+
#[simd_test(enable = "neon")]
1442+
unsafe fn test_vmvnq_p8() {
1443+
let a = u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
1444+
let e = u8x16::new(
1445+
255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240,
1446+
);
1447+
let r: u8x16 = transmute(vmvnq_p8(transmute(a)));
1448+
assert_eq!(r, e);
1449+
}
1450+
14091451
#[simd_test(enable = "neon")]
14101452
unsafe fn test_vmovn_s16() {
14111453
let a = i16x8::new(1, 2, 3, 4, 5, 6, 7, 8);

0 commit comments

Comments
 (0)