diskann_wide/arch/aarch64/
u16x8_.rs1use crate::{
7 Emulated,
8 constant::Const,
9 helpers,
10 traits::{SIMDMask, SIMDMulAdd, SIMDPartialEq, SIMDPartialOrd, SIMDVector},
11};
12
13use super::{
15 Neon, internal,
16 macros::{self, AArchLoadStore, AArchSplat},
17 masks::mask16x8,
18};
19
20use std::arch::aarch64::*;
22
23macros::aarch64_define_register!(u16x8, uint16x8_t, mask16x8, u16, 8, Neon);
28macros::aarch64_define_splat!(u16x8, vmovq_n_u16);
29macros::aarch64_define_loadstore!(u16x8, vld1q_u16, internal::load_first::u16x8, vst1q_u16, 8);
30
31helpers::unsafe_map_binary_op!(u16x8, std::ops::Add, add, vaddq_u16, "neon");
32helpers::unsafe_map_binary_op!(u16x8, std::ops::Sub, sub, vsubq_u16, "neon");
33helpers::unsafe_map_binary_op!(u16x8, std::ops::Mul, mul, vmulq_u16, "neon");
34macros::aarch64_define_fma!(u16x8, vmlaq_u16);
35
36macros::aarch64_define_cmp!(
37 u16x8,
38 vceqq_u16,
39 (vmvnq_u16),
40 vcltq_u16,
41 vcleq_u16,
42 vcgtq_u16,
43 vcgeq_u16
44);
45macros::aarch64_define_bitops!(
46 u16x8,
47 vmvnq_u16,
48 vandq_u16,
49 vorrq_u16,
50 veorq_u16,
51 (
52 vshlq_u16,
53 16,
54 vnegq_s16,
55 vminq_u16,
56 vreinterpretq_s16_u16,
57 std::convert::identity
58 ),
59 (u16, i16, vmovq_n_s16),
60);
61
62#[cfg(test)]
67mod tests {
68 use super::*;
69 use crate::{arch::aarch64::test_neon, reference::ReferenceScalarOps, test_utils};
70
71 #[test]
72 fn miri_test_load() {
73 if let Some(arch) = test_neon() {
74 test_utils::test_load_simd::<u16, 8, u16x8>(arch);
75 }
76 }
77
78 #[test]
79 fn miri_test_store() {
80 if let Some(arch) = test_neon() {
81 test_utils::test_store_simd::<u16, 8, u16x8>(arch);
82 }
83 }
84
85 #[test]
87 fn test_constructors() {
88 if let Some(arch) = test_neon() {
89 test_utils::ops::test_splat::<u16, 8, u16x8>(arch);
90 }
91 }
92
93 test_utils::ops::test_add!(u16x8, 0x3017fd73c99cc633, test_neon());
95 test_utils::ops::test_sub!(u16x8, 0xfc627f10b5f8db8a, test_neon());
96 test_utils::ops::test_mul!(u16x8, 0x0f4caa80eceaa523, test_neon());
97 test_utils::ops::test_fma!(u16x8, 0xb8f702ba85375041, test_neon());
98
99 test_utils::ops::test_cmp!(u16x8, 0x941757bd5cc641a1, test_neon());
100
101 test_utils::ops::test_bitops!(u16x8, 0xd62d8de09f82ed4e, test_neon());
103}