1include!(concat!(env!("OUT_DIR"), "/backend.rs"));
5macro_rules! select_impl { (scalar {$($scalar:item)*} avx2 {$($avx2:item)*}) => { $(#[cfg(any(miri, not(all(target_arch="x86_64", all(target_feature = "aes", target_feature = "avx", target_feature = "avx2", target_feature = "pclmulqdq", target_feature = "sse2", target_feature = "sse4.1", target_feature = "sse4.2", target_feature = "ssse3")))))] $scalar)* $(#[cfg(all(not(miri), all(target_arch="x86_64", all(target_feature = "aes", target_feature = "avx", target_feature = "avx2", target_feature = "pclmulqdq", target_feature = "sse2", target_feature = "sse4.1", target_feature = "sse4.2", target_feature = "ssse3"))))] $avx2)* }; }
6macro_rules! select_impl_block { (scalar $scalar:block avx2 $avx2:block) => { #[cfg(any(miri, not(all(target_arch="x86_64", all(target_feature = "aes", target_feature = "avx", target_feature = "avx2", target_feature = "pclmulqdq", target_feature = "sse2", target_feature = "sse4.1", target_feature = "sse4.2", target_feature = "ssse3")))))] $scalar #[cfg(all(not(miri), all(target_arch="x86_64", all(target_feature = "aes", target_feature = "avx", target_feature = "avx2", target_feature = "pclmulqdq", target_feature = "sse2", target_feature = "sse4.1", target_feature = "sse4.2", target_feature = "ssse3"))))] $avx2 }; }
7use crate::array_utils::*;
8use crate::SimdBase;
9use std::ops::*;
10#[doc = "We need to use a macro to explicitly match every possible immediate value, and then dispatch to\na block which has a const generic value for the intrinsic immediate. The inputs to our\nfunctions need to be manipulated before they passed to the raw intrinsic.\nIt used to be possible to directly manipulate the const before passing it to the intrinsic.\nHowever, https://git.io/JsukV broke compatibility with stable, so we need to do this instead."]
11#[allow(unused_macros)]
12macro_rules! constify_imm { ($func:path => ( $($normal_args:expr,)* @@ [0..256] $imm_arg:expr )) => { match $imm_arg { 0 => $func($($normal_args,)* 0), 1 => $func($($normal_args,)* 1), 2 => $func($($normal_args,)* 2), 3 => $func($($normal_args,)* 3), 4 => $func($($normal_args,)* 4), 5 => $func($($normal_args,)* 5), 6 => $func($($normal_args,)* 6), 7 => $func($($normal_args,)* 7), 8 => $func($($normal_args,)* 8), 9 => $func($($normal_args,)* 9), 10 => $func($($normal_args,)* 10), 11 => $func($($normal_args,)* 11), 12 => $func($($normal_args,)* 12), 13 => $func($($normal_args,)* 13), 14 => $func($($normal_args,)* 14), 15 => $func($($normal_args,)* 15), 16 => $func($($normal_args,)* 16), 17 => $func($($normal_args,)* 17), 18 => $func($($normal_args,)* 18), 19 => $func($($normal_args,)* 19), 20 => $func($($normal_args,)* 20), 21 => $func($($normal_args,)* 21), 22 => $func($($normal_args,)* 22), 23 => $func($($normal_args,)* 23), 24 => $func($($normal_args,)* 24), 25 => $func($($normal_args,)* 25), 26 => $func($($normal_args,)* 26), 27 => $func($($normal_args,)* 27), 28 => $func($($normal_args,)* 28), 29 => $func($($normal_args,)* 29), 30 => $func($($normal_args,)* 30), 31 => $func($($normal_args,)* 31), 32 => $func($($normal_args,)* 32), 33 => $func($($normal_args,)* 33), 34 => $func($($normal_args,)* 34), 35 => $func($($normal_args,)* 35), 36 => $func($($normal_args,)* 36), 37 => $func($($normal_args,)* 37), 38 => $func($($normal_args,)* 38), 39 => $func($($normal_args,)* 39), 40 => $func($($normal_args,)* 40), 41 => $func($($normal_args,)* 41), 42 => $func($($normal_args,)* 42), 43 => $func($($normal_args,)* 43), 44 => $func($($normal_args,)* 44), 45 => $func($($normal_args,)* 45), 46 => $func($($normal_args,)* 46), 47 => $func($($normal_args,)* 47), 48 => $func($($normal_args,)* 48), 49 => $func($($normal_args,)* 49), 50 => $func($($normal_args,)* 50), 51 => $func($($normal_args,)* 51), 52 => $func($($normal_args,)* 52), 53 => $func($($normal_args,)* 53), 54 => $func($($normal_args,)* 54), 55 => $func($($normal_args,)* 55), 56 => $func($($normal_args,)* 56), 57 => $func($($normal_args,)* 57), 58 => $func($($normal_args,)* 58), 59 => $func($($normal_args,)* 59), 60 => $func($($normal_args,)* 60), 61 => $func($($normal_args,)* 61), 62 => $func($($normal_args,)* 62), 63 => $func($($normal_args,)* 63), 64 => $func($($normal_args,)* 64), 65 => $func($($normal_args,)* 65), 66 => $func($($normal_args,)* 66), 67 => $func($($normal_args,)* 67), 68 => $func($($normal_args,)* 68), 69 => $func($($normal_args,)* 69), 70 => $func($($normal_args,)* 70), 71 => $func($($normal_args,)* 71), 72 => $func($($normal_args,)* 72), 73 => $func($($normal_args,)* 73), 74 => $func($($normal_args,)* 74), 75 => $func($($normal_args,)* 75), 76 => $func($($normal_args,)* 76), 77 => $func($($normal_args,)* 77), 78 => $func($($normal_args,)* 78), 79 => $func($($normal_args,)* 79), 80 => $func($($normal_args,)* 80), 81 => $func($($normal_args,)* 81), 82 => $func($($normal_args,)* 82), 83 => $func($($normal_args,)* 83), 84 => $func($($normal_args,)* 84), 85 => $func($($normal_args,)* 85), 86 => $func($($normal_args,)* 86), 87 => $func($($normal_args,)* 87), 88 => $func($($normal_args,)* 88), 89 => $func($($normal_args,)* 89), 90 => $func($($normal_args,)* 90), 91 => $func($($normal_args,)* 91), 92 => $func($($normal_args,)* 92), 93 => $func($($normal_args,)* 93), 94 => $func($($normal_args,)* 94), 95 => $func($($normal_args,)* 95), 96 => $func($($normal_args,)* 96), 97 => $func($($normal_args,)* 97), 98 => $func($($normal_args,)* 98), 99 => $func($($normal_args,)* 99), 100 => $func($($normal_args,)* 100), 101 => $func($($normal_args,)* 101), 102 => $func($($normal_args,)* 102), 103 => $func($($normal_args,)* 103), 104 => $func($($normal_args,)* 104), 105 => $func($($normal_args,)* 105), 106 => $func($($normal_args,)* 106), 107 => $func($($normal_args,)* 107), 108 => $func($($normal_args,)* 108), 109 => $func($($normal_args,)* 109), 110 => $func($($normal_args,)* 110), 111 => $func($($normal_args,)* 111), 112 => $func($($normal_args,)* 112), 113 => $func($($normal_args,)* 113), 114 => $func($($normal_args,)* 114), 115 => $func($($normal_args,)* 115), 116 => $func($($normal_args,)* 116), 117 => $func($($normal_args,)* 117), 118 => $func($($normal_args,)* 118), 119 => $func($($normal_args,)* 119), 120 => $func($($normal_args,)* 120), 121 => $func($($normal_args,)* 121), 122 => $func($($normal_args,)* 122), 123 => $func($($normal_args,)* 123), 124 => $func($($normal_args,)* 124), 125 => $func($($normal_args,)* 125), 126 => $func($($normal_args,)* 126), 127 => $func($($normal_args,)* 127), 128 => $func($($normal_args,)* 128), 129 => $func($($normal_args,)* 129), 130 => $func($($normal_args,)* 130), 131 => $func($($normal_args,)* 131), 132 => $func($($normal_args,)* 132), 133 => $func($($normal_args,)* 133), 134 => $func($($normal_args,)* 134), 135 => $func($($normal_args,)* 135), 136 => $func($($normal_args,)* 136), 137 => $func($($normal_args,)* 137), 138 => $func($($normal_args,)* 138), 139 => $func($($normal_args,)* 139), 140 => $func($($normal_args,)* 140), 141 => $func($($normal_args,)* 141), 142 => $func($($normal_args,)* 142), 143 => $func($($normal_args,)* 143), 144 => $func($($normal_args,)* 144), 145 => $func($($normal_args,)* 145), 146 => $func($($normal_args,)* 146), 147 => $func($($normal_args,)* 147), 148 => $func($($normal_args,)* 148), 149 => $func($($normal_args,)* 149), 150 => $func($($normal_args,)* 150), 151 => $func($($normal_args,)* 151), 152 => $func($($normal_args,)* 152), 153 => $func($($normal_args,)* 153), 154 => $func($($normal_args,)* 154), 155 => $func($($normal_args,)* 155), 156 => $func($($normal_args,)* 156), 157 => $func($($normal_args,)* 157), 158 => $func($($normal_args,)* 158), 159 => $func($($normal_args,)* 159), 160 => $func($($normal_args,)* 160), 161 => $func($($normal_args,)* 161), 162 => $func($($normal_args,)* 162), 163 => $func($($normal_args,)* 163), 164 => $func($($normal_args,)* 164), 165 => $func($($normal_args,)* 165), 166 => $func($($normal_args,)* 166), 167 => $func($($normal_args,)* 167), 168 => $func($($normal_args,)* 168), 169 => $func($($normal_args,)* 169), 170 => $func($($normal_args,)* 170), 171 => $func($($normal_args,)* 171), 172 => $func($($normal_args,)* 172), 173 => $func($($normal_args,)* 173), 174 => $func($($normal_args,)* 174), 175 => $func($($normal_args,)* 175), 176 => $func($($normal_args,)* 176), 177 => $func($($normal_args,)* 177), 178 => $func($($normal_args,)* 178), 179 => $func($($normal_args,)* 179), 180 => $func($($normal_args,)* 180), 181 => $func($($normal_args,)* 181), 182 => $func($($normal_args,)* 182), 183 => $func($($normal_args,)* 183), 184 => $func($($normal_args,)* 184), 185 => $func($($normal_args,)* 185), 186 => $func($($normal_args,)* 186), 187 => $func($($normal_args,)* 187), 188 => $func($($normal_args,)* 188), 189 => $func($($normal_args,)* 189), 190 => $func($($normal_args,)* 190), 191 => $func($($normal_args,)* 191), 192 => $func($($normal_args,)* 192), 193 => $func($($normal_args,)* 193), 194 => $func($($normal_args,)* 194), 195 => $func($($normal_args,)* 195), 196 => $func($($normal_args,)* 196), 197 => $func($($normal_args,)* 197), 198 => $func($($normal_args,)* 198), 199 => $func($($normal_args,)* 199), 200 => $func($($normal_args,)* 200), 201 => $func($($normal_args,)* 201), 202 => $func($($normal_args,)* 202), 203 => $func($($normal_args,)* 203), 204 => $func($($normal_args,)* 204), 205 => $func($($normal_args,)* 205), 206 => $func($($normal_args,)* 206), 207 => $func($($normal_args,)* 207), 208 => $func($($normal_args,)* 208), 209 => $func($($normal_args,)* 209), 210 => $func($($normal_args,)* 210), 211 => $func($($normal_args,)* 211), 212 => $func($($normal_args,)* 212), 213 => $func($($normal_args,)* 213), 214 => $func($($normal_args,)* 214), 215 => $func($($normal_args,)* 215), 216 => $func($($normal_args,)* 216), 217 => $func($($normal_args,)* 217), 218 => $func($($normal_args,)* 218), 219 => $func($($normal_args,)* 219), 220 => $func($($normal_args,)* 220), 221 => $func($($normal_args,)* 221), 222 => $func($($normal_args,)* 222), 223 => $func($($normal_args,)* 223), 224 => $func($($normal_args,)* 224), 225 => $func($($normal_args,)* 225), 226 => $func($($normal_args,)* 226), 227 => $func($($normal_args,)* 227), 228 => $func($($normal_args,)* 228), 229 => $func($($normal_args,)* 229), 230 => $func($($normal_args,)* 230), 231 => $func($($normal_args,)* 231), 232 => $func($($normal_args,)* 232), 233 => $func($($normal_args,)* 233), 234 => $func($($normal_args,)* 234), 235 => $func($($normal_args,)* 235), 236 => $func($($normal_args,)* 236), 237 => $func($($normal_args,)* 237), 238 => $func($($normal_args,)* 238), 239 => $func($($normal_args,)* 239), 240 => $func($($normal_args,)* 240), 241 => $func($($normal_args,)* 241), 242 => $func($($normal_args,)* 242), 243 => $func($($normal_args,)* 243), 244 => $func($($normal_args,)* 244), 245 => $func($($normal_args,)* 245), 246 => $func($($normal_args,)* 246), 247 => $func($($normal_args,)* 247), 248 => $func($($normal_args,)* 248), 249 => $func($($normal_args,)* 249), 250 => $func($($normal_args,)* 250), 251 => $func($($normal_args,)* 251), 252 => $func($($normal_args,)* 252), 253 => $func($($normal_args,)* 253), 254 => $func($($normal_args,)* 254), 255 => $func($($normal_args,)* 255), _ => panic!("Invalid immediate: {}. Expected immediate to satisfy: 0..256", $imm_arg), } }; ($func:path => ( $($normal_args:expr,)* @@ [0..32] $imm_arg:expr )) => { match $imm_arg { 0 => $func($($normal_args,)* 0), 1 => $func($($normal_args,)* 1), 2 => $func($($normal_args,)* 2), 3 => $func($($normal_args,)* 3), 4 => $func($($normal_args,)* 4), 5 => $func($($normal_args,)* 5), 6 => $func($($normal_args,)* 6), 7 => $func($($normal_args,)* 7), 8 => $func($($normal_args,)* 8), 9 => $func($($normal_args,)* 9), 10 => $func($($normal_args,)* 10), 11 => $func($($normal_args,)* 11), 12 => $func($($normal_args,)* 12), 13 => $func($($normal_args,)* 13), 14 => $func($($normal_args,)* 14), 15 => $func($($normal_args,)* 15), 16 => $func($($normal_args,)* 16), 17 => $func($($normal_args,)* 17), 18 => $func($($normal_args,)* 18), 19 => $func($($normal_args,)* 19), 20 => $func($($normal_args,)* 20), 21 => $func($($normal_args,)* 21), 22 => $func($($normal_args,)* 22), 23 => $func($($normal_args,)* 23), 24 => $func($($normal_args,)* 24), 25 => $func($($normal_args,)* 25), 26 => $func($($normal_args,)* 26), 27 => $func($($normal_args,)* 27), 28 => $func($($normal_args,)* 28), 29 => $func($($normal_args,)* 29), 30 => $func($($normal_args,)* 30), 31 => $func($($normal_args,)* 31), _ => panic!("Invalid immediate: {}. Expected immediate to satisfy: 0..32", $imm_arg), } }; ($func:path => ( $($normal_args:expr,)* @@ [0..16] $imm_arg:expr )) => { match $imm_arg { 0 => $func($($normal_args,)* 0), 1 => $func($($normal_args,)* 1), 2 => $func($($normal_args,)* 2), 3 => $func($($normal_args,)* 3), 4 => $func($($normal_args,)* 4), 5 => $func($($normal_args,)* 5), 6 => $func($($normal_args,)* 6), 7 => $func($($normal_args,)* 7), 8 => $func($($normal_args,)* 8), 9 => $func($($normal_args,)* 9), 10 => $func($($normal_args,)* 10), 11 => $func($($normal_args,)* 11), 12 => $func($($normal_args,)* 12), 13 => $func($($normal_args,)* 13), 14 => $func($($normal_args,)* 14), 15 => $func($($normal_args,)* 15), _ => panic!("Invalid immediate: {}. Expected immediate to satisfy: 0..16", $imm_arg), } }; ($func:path => ( $($normal_args:expr,)* @@ [0..8] $imm_arg:expr )) => { match $imm_arg { 0 => $func($($normal_args,)* 0), 1 => $func($($normal_args,)* 1), 2 => $func($($normal_args,)* 2), 3 => $func($($normal_args,)* 3), 4 => $func($($normal_args,)* 4), 5 => $func($($normal_args,)* 5), 6 => $func($($normal_args,)* 6), 7 => $func($($normal_args,)* 7), _ => panic!("Invalid immediate: {}. Expected immediate to satisfy: 0..8", $imm_arg), } }; ($func:path => ( $($normal_args:expr,)* @@ [0..4] $imm_arg:expr )) => { match $imm_arg { 0 => $func($($normal_args,)* 0), 1 => $func($($normal_args,)* 1), 2 => $func($($normal_args,)* 2), 3 => $func($($normal_args,)* 3), _ => panic!("Invalid immediate: {}. Expected immediate to satisfy: 0..4", $imm_arg), } }; ($func:path => ( $($normal_args:expr,)* @@ [0..2] $imm_arg:expr )) => { match $imm_arg { 0 => $func($($normal_args,)* 0), 1 => $func($($normal_args,)* 1), _ => panic!("Invalid immediate: {}. Expected immediate to satisfy: 0..2", $imm_arg), } }; ($func:path => ( $($normal_args:expr,)* @@ [[1, 2, 4, 8]] $imm_arg:expr )) => { match $imm_arg { 1 => $func($($normal_args,)* 1), 2 => $func($($normal_args,)* 2), 4 => $func($($normal_args,)* 4), 8 => $func($($normal_args,)* 8), _ => panic!("Invalid immediate: {}. Expected immediate to satisfy: [1, 2, 4, 8]", $imm_arg), } }; }
20#[doc = "`[i8; 16]` as a vector."]
21#[repr(transparent)]
22#[derive(Clone, Copy)]
23pub struct I8x16(I8x16Internal);
24unsafe impl bytemuck::Pod for I8x16 {}
25unsafe impl bytemuck::Zeroable for I8x16 {}
26impl PartialEq for I8x16 {
27 #[inline(always)]
28 fn eq(&self, other: &Self) -> bool {
29 ((*self) ^ (*other)).is_zero()
30 }
31}
32impl Eq for I8x16 {}
33impl Default for I8x16 {
34 #[doc = "The zero vector."]
35 #[inline(always)]
36 fn default() -> Self {
37 Self::ZERO
38 }
39}
40impl std::hash::Hash for I8x16 {
41 #[inline]
42 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
43 bytemuck::bytes_of(self).hash(state);
44 }
45}
46impl std::fmt::Debug for I8x16 {
47 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
48 write!(f, "I8x16({:?})", <[i8; 16]>::from(*self))
49 }
50}
51impl subtle::ConstantTimeEq for I8x16 {
52 fn ct_eq(&self, other: &Self) -> subtle::Choice {
53 self.as_array().ct_eq(&other.as_array())
54 }
55}
56impl subtle::ConditionallySelectable for I8x16 {
57 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
58 let mut out = [0; 16];
59 for (out, (a, b)) in out
60 .iter_mut()
61 .zip(a.as_array().iter().zip(b.as_array().iter()))
62 {
63 *out = <i8 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
64 }
65 Self::from(out)
66 }
67}
68impl rand::distributions::Distribution<I8x16> for rand::distributions::Standard {
69 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I8x16 {
70 let mut out = I8x16::ZERO;
71 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
72 out
73 }
74}
75impl AsRef<[i8]> for I8x16 {
76 fn as_ref(&self) -> &[i8] {
77 let arr: &[i8; 16] = bytemuck::cast_ref(self);
78 arr
79 }
80}
81impl AsMut<[i8]> for I8x16 {
82 fn as_mut(&mut self) -> &mut [i8] {
83 let arr: &mut [i8; 16] = bytemuck::cast_mut(self);
84 arr
85 }
86}
87impl From<I16x8> for I8x16 {
88 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x8\nas little endian bits of I8x16."]
89 #[inline(always)]
90 fn from(x: I16x8) -> I8x16 {
91 Self({
92 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
94 })
95 }
96}
97impl From<I32x4> for I8x16 {
98 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x4\nas little endian bits of I8x16."]
99 #[inline(always)]
100 fn from(x: I32x4) -> I8x16 {
101 Self({
102 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
104 })
105 }
106}
107impl From<I64x2> for I8x16 {
108 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x2\nas little endian bits of I8x16."]
109 #[inline(always)]
110 fn from(x: I64x2) -> I8x16 {
111 Self({
112 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
114 })
115 }
116}
117impl From<U8x16> for I8x16 {
118 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x16\nas little endian bits of I8x16."]
119 #[inline(always)]
120 fn from(x: U8x16) -> I8x16 {
121 Self({
122 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
124 })
125 }
126}
127impl From<U16x8> for I8x16 {
128 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x8\nas little endian bits of I8x16."]
129 #[inline(always)]
130 fn from(x: U16x8) -> I8x16 {
131 Self({
132 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
134 })
135 }
136}
137impl From<U32x4> for I8x16 {
138 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x4\nas little endian bits of I8x16."]
139 #[inline(always)]
140 fn from(x: U32x4) -> I8x16 {
141 Self({
142 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
144 })
145 }
146}
147impl From<U64x2> for I8x16 {
148 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x2\nas little endian bits of I8x16."]
149 #[inline(always)]
150 fn from(x: U64x2) -> I8x16 {
151 Self({
152 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
154 })
155 }
156}
157impl crate::SimdSaturatingArithmetic for I8x16 {
158 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_adds_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_adds_epi8)\n\n\n * `PADDSB xmm, xmm`\n </li>\n </ul>"]
159 #[inline(always)]
160 fn saturating_add(&self, other: I8x16) -> I8x16 {
161 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm_adds_epi8 (self.0, other.0)) } }
162 }
163 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_subs_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_subs_epi8)\n\n\n * `PSUBSB xmm, xmm`\n </li>\n </ul>"]
164 #[inline(always)]
165 fn saturating_sub(&self, other: I8x16) -> I8x16 {
166 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm_subs_epi8 (self.0, other.0)) } }
167 }
168} impl ShlAssign<u64> for I8x16 {
170 #[inline(always)]
171 fn shl_assign(&mut self, amount: u64) {
172 *self = (*self) << amount;
173 }
174}
175impl Shl<u64> for I8x16 {
176 type Output = Self;
177 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x16\n # {\n if amount >= 8 {\n I8x16::ZERO\n } else {\n I8x16::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n self.as_array()[8] << amount,\n self.as_array()[9] << amount,\n self.as_array()[10] << amount,\n self.as_array()[11] << amount,\n self.as_array()[12] << amount,\n self.as_array()[13] << amount,\n self.as_array()[14] << amount,\n self.as_array()[15] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
178 #[inline(always)]
179 fn shl(self, amount: u64) -> I8x16 {
180 select_impl_block! { scalar { if amount >= 8 { I8x16::ZERO } else { I8x16::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, ]) } } avx2 { if amount >= 8 { I8x16::ZERO } else { I8x16::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, ]) } } }
181 }
182} impl ShlAssign<I8x16> for I8x16 {
184 #[inline(always)]
185 fn shl_assign(&mut self, amount: I8x16) {
186 *self = (*self) << amount;
187 }
188}
189impl Shl<I8x16> for I8x16 {
190 type Output = Self;
191 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x16 ,\n # ) -> I8x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
192 #[inline(always)]
193 fn shl(self, amount: I8x16) -> I8x16 {
194 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } I8x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } I8x16::from(out) } }
195 }
196} impl ShrAssign<u64> for I8x16 {
198 #[inline(always)]
199 fn shr_assign(&mut self, amount: u64) {
200 *self = (*self) >> amount;
201 }
202}
203impl Shr<u64> for I8x16 {
204 type Output = Self;
205 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x16\n # {\n if amount >= 8 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I8x16::from(out)\n } else {\n I8x16::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n self.as_array()[8] >> amount,\n self.as_array()[9] >> amount,\n self.as_array()[10] >> amount,\n self.as_array()[11] >> amount,\n self.as_array()[12] >> amount,\n self.as_array()[13] >> amount,\n self.as_array()[14] >> amount,\n self.as_array()[15] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
206 #[inline(always)]
207 fn shr(self, amount: u64) -> I8x16 {
208 select_impl_block! { scalar { if amount >= 8 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I8x16::from(out) } else { I8x16::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, ]) } } avx2 { if amount >= 8 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I8x16::from(out) } else { I8x16::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, ]) } } }
209 }
210} impl ShrAssign<I8x16> for I8x16 {
212 #[inline(always)]
213 fn shr_assign(&mut self, amount: I8x16) {
214 *self = (*self) >> amount;
215 }
216}
217impl Shr<I8x16> for I8x16 {
218 type Output = Self;
219 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x16 ,\n # ) -> I8x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
220 #[inline(always)]
221 fn shr(self, amount: I8x16) -> I8x16 {
222 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I8x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I8x16::from(out) } }
223 }
224}
225impl SimdBase for I8x16 {
226 type Scalar = i8;
227 type Array = [i8; 16];
228 type Signed = I8x16;
229 type Unsigned = U8x16;
230 const LANES: usize = 16;
231 const ZERO: Self = Self::from_array([0; 16]);
232 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
233 #[inline(always)]
234 fn is_zero(&self) -> bool {
235 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
236 }
237 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i8 ,\n # ) -> I8x16\n # {\n let mut out = [0; 16];\n out[0] = scalar;\n I8x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
238 #[inline(always)]
239 fn set_lo(scalar: i8) -> I8x16 {
240 select_impl_block! { scalar { let mut out = [0; 16]; out[0] = scalar; I8x16::from(out) } avx2 { Self( avx2::_mm_set_epi8 ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, scalar as i8, )) } }
241 }
242 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i8\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i8\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi8)\n\n\n * `PEXTRB r32, xmm, imm8`\n </li>\n </ul>"]
243 #[inline(always)]
244 fn extract<const I: usize>(&self) -> i8 {
245 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi8 ::<I>(self.0) as i8 } }
246 }
247 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i8 ,\n # ) -> I8x16\n # {\n I8x16::from([scalar; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
248 #[inline(always)]
249 fn broadcast(scalar: i8) -> I8x16 {
250 select_impl_block! { scalar { I8x16::from([scalar; 16]) } avx2 { Self( avx2::_mm_set1_epi8 (scalar as i8)) } }
251 }
252 type BroadcastLoInput = I8x16;
253 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([vector.as_array()[0]; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastb_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastb_epi8)\n\n\n * `VPBROADCASTB xmm, xmm`\n </li>\n </ul>"]
254 #[inline(always)]
255 fn broadcast_lo(vector: I8x16) -> I8x16 {
256 select_impl_block! { scalar { I8x16::from([vector.as_array()[0]; 16]) } avx2 { Self( avx2::_mm_broadcastb_epi8 (vector.0)) } }
257 }
258 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 },\n if self.as_array()[8] == other.as_array()[8] { -1 } else { 0 },\n if self.as_array()[9] == other.as_array()[9] { -1 } else { 0 },\n if self.as_array()[10] == other.as_array()[10] { -1 } else { 0 },\n if self.as_array()[11] == other.as_array()[11] { -1 } else { 0 },\n if self.as_array()[12] == other.as_array()[12] { -1 } else { 0 },\n if self.as_array()[13] == other.as_array()[13] { -1 } else { 0 },\n if self.as_array()[14] == other.as_array()[14] { -1 } else { 0 },\n if self.as_array()[15] == other.as_array()[15] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi8)\n\n\n * `PCMPEQB xmm, xmm`\n </li>\n </ul>"]
259 #[inline(always)]
260 fn cmp_eq(&self, other: I8x16) -> I8x16 {
261 select_impl_block! { scalar { I8x16::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 }, if self.as_array()[8] == other.as_array()[8] { -1 } else { 0 }, if self.as_array()[9] == other.as_array()[9] { -1 } else { 0 }, if self.as_array()[10] == other.as_array()[10] { -1 } else { 0 }, if self.as_array()[11] == other.as_array()[11] { -1 } else { 0 }, if self.as_array()[12] == other.as_array()[12] { -1 } else { 0 }, if self.as_array()[13] == other.as_array()[13] { -1 } else { 0 }, if self.as_array()[14] == other.as_array()[14] { -1 } else { 0 }, if self.as_array()[15] == other.as_array()[15] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi8 (self.0, other.0)) } }
262 }
263 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n self.as_array()[8] & (!other.as_array()[8]),\n self.as_array()[9] & (!other.as_array()[9]),\n self.as_array()[10] & (!other.as_array()[10]),\n self.as_array()[11] & (!other.as_array()[11]),\n self.as_array()[12] & (!other.as_array()[12]),\n self.as_array()[13] & (!other.as_array()[13]),\n self.as_array()[14] & (!other.as_array()[14]),\n self.as_array()[15] & (!other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
264 #[inline(always)]
265 fn and_not(&self, other: I8x16) -> I8x16 {
266 select_impl_block! { scalar { I8x16::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), self.as_array()[8] & (!other.as_array()[8]), self.as_array()[9] & (!other.as_array()[9]), self.as_array()[10] & (!other.as_array()[10]), self.as_array()[11] & (!other.as_array()[11]), self.as_array()[12] & (!other.as_array()[12]), self.as_array()[13] & (!other.as_array()[13]), self.as_array()[14] & (!other.as_array()[14]), self.as_array()[15] & (!other.as_array()[15]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
267 }
268 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 },\n if self.as_array()[8] > other.as_array()[8] { -1 } else { 0 },\n if self.as_array()[9] > other.as_array()[9] { -1 } else { 0 },\n if self.as_array()[10] > other.as_array()[10] { -1 } else { 0 },\n if self.as_array()[11] > other.as_array()[11] { -1 } else { 0 },\n if self.as_array()[12] > other.as_array()[12] { -1 } else { 0 },\n if self.as_array()[13] > other.as_array()[13] { -1 } else { 0 },\n if self.as_array()[14] > other.as_array()[14] { -1 } else { 0 },\n if self.as_array()[15] > other.as_array()[15] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpgt_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpgt_epi8)\n\n\n * `PCMPGTB xmm, xmm`\n </li>\n </ul>"]
269 #[inline(always)]
270 fn cmp_gt(&self, other: I8x16) -> I8x16 {
271 select_impl_block! { scalar { I8x16::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 }, if self.as_array()[8] > other.as_array()[8] { -1 } else { 0 }, if self.as_array()[9] > other.as_array()[9] { -1 } else { 0 }, if self.as_array()[10] > other.as_array()[10] { -1 } else { 0 }, if self.as_array()[11] > other.as_array()[11] { -1 } else { 0 }, if self.as_array()[12] > other.as_array()[12] { -1 } else { 0 }, if self.as_array()[13] > other.as_array()[13] { -1 } else { 0 }, if self.as_array()[14] > other.as_array()[14] { -1 } else { 0 }, if self.as_array()[15] > other.as_array()[15] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpgt_epi8 (self.0, other.0)) } }
272 }
273 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
274 #[inline(always)]
275 fn shift_left<const BITS: usize>(&self) -> I8x16 {
276 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I8x16::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I8x16::from(out) } }
277 }
278 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
279 #[inline(always)]
280 fn shift_right<const BITS: usize>(&self) -> I8x16 {
281 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I8x16::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I8x16::from(out) } }
282 }
283 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi8)\n\n\n * `PUNPCKLBW xmm, xmm`\n </li>\n </ul>"]
284 #[inline(always)]
285 fn unpack_lo(&self, other: I8x16) -> I8x16 {
286 select_impl_block! { scalar { I8x16::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], ]) } avx2 { Self( avx2::_mm_unpacklo_epi8 (self.0, other.0)) } }
288 }
289 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([\n // Lane# 0\n self.as_array()[8],\n other.as_array()[8],\n self.as_array()[9],\n other.as_array()[9],\n self.as_array()[10],\n other.as_array()[10],\n self.as_array()[11],\n other.as_array()[11],\n self.as_array()[12],\n other.as_array()[12],\n self.as_array()[13],\n other.as_array()[13],\n self.as_array()[14],\n other.as_array()[14],\n self.as_array()[15],\n other.as_array()[15],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi8)\n\n\n * `PUNPCKHBW xmm, xmm`\n </li>\n </ul>"]
290 #[inline(always)]
291 fn unpack_hi(&self, other: I8x16) -> I8x16 {
292 select_impl_block! { scalar { I8x16::from([ self.as_array()[8], other.as_array()[8], self.as_array()[9], other.as_array()[9], self.as_array()[10], other.as_array()[10], self.as_array()[11], other.as_array()[11], self.as_array()[12], other.as_array()[12], self.as_array()[13], other.as_array()[13], self.as_array()[14], other.as_array()[14], self.as_array()[15], other.as_array()[15], ]) } avx2 { Self( avx2::_mm_unpackhi_epi8 (self.0, other.0)) } }
294 }
295 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n self.as_array()[8].max(other.as_array()[8]),\n self.as_array()[9].max(other.as_array()[9]),\n self.as_array()[10].max(other.as_array()[10]),\n self.as_array()[11].max(other.as_array()[11]),\n self.as_array()[12].max(other.as_array()[12]),\n self.as_array()[13].max(other.as_array()[13]),\n self.as_array()[14].max(other.as_array()[14]),\n self.as_array()[15].max(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_max_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epi8)\n\n\n * `PMAXSB xmm, xmm`\n </li>\n </ul>"]
296 #[inline(always)]
297 fn max(&self, other: I8x16) -> I8x16 {
298 select_impl_block! { scalar { I8x16::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), self.as_array()[8].max(other.as_array()[8]), self.as_array()[9].max(other.as_array()[9]), self.as_array()[10].max(other.as_array()[10]), self.as_array()[11].max(other.as_array()[11]), self.as_array()[12].max(other.as_array()[12]), self.as_array()[13].max(other.as_array()[13]), self.as_array()[14].max(other.as_array()[14]), self.as_array()[15].max(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm_max_epi8 (self.0, other.0)) } }
299 }
300 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x16 ,\n # ) -> I8x16\n # {\n I8x16::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n self.as_array()[8].min(other.as_array()[8]),\n self.as_array()[9].min(other.as_array()[9]),\n self.as_array()[10].min(other.as_array()[10]),\n self.as_array()[11].min(other.as_array()[11]),\n self.as_array()[12].min(other.as_array()[12]),\n self.as_array()[13].min(other.as_array()[13]),\n self.as_array()[14].min(other.as_array()[14]),\n self.as_array()[15].min(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_min_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epi8)\n\n\n * `PMINSB xmm, xmm`\n </li>\n </ul>"]
301 #[inline(always)]
302 fn min(&self, other: I8x16) -> I8x16 {
303 select_impl_block! { scalar { I8x16::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), self.as_array()[8].min(other.as_array()[8]), self.as_array()[9].min(other.as_array()[9]), self.as_array()[10].min(other.as_array()[10]), self.as_array()[11].min(other.as_array()[11]), self.as_array()[12].min(other.as_array()[12]), self.as_array()[13].min(other.as_array()[13]), self.as_array()[14].min(other.as_array()[14]), self.as_array()[15].min(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm_min_epi8 (self.0, other.0)) } }
304 }
305}
306impl crate::SimdBase8 for I8x16 {
307 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # {\n let mut out = [0; 16];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]);\n }\n I8x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_si128)\n\n\n * `PSLLDQ xmm, imm8`\n </li>\n </ul>"]
308 #[inline(always)]
309 fn shift_bytes_left<const AMOUNT: usize>(&self) -> I8x16 {
310 select_impl_block! { scalar { let mut out = [0; 16]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]); } I8x16::from(out) } avx2 { Self( avx2::_mm_slli_si128 ::<AMOUNT>(self.0)) } }
311 }
312 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x16\n # {\n let mut out = [0; 16];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]);\n }\n I8x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srli_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_si128)\n\n\n * `PSRLDQ xmm, imm8`\n </li>\n </ul>"]
313 #[inline(always)]
314 fn shift_bytes_right<const AMOUNT: usize>(&self) -> I8x16 {
315 select_impl_block! { scalar { let mut out = [0; 16]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]); } I8x16::from(out) } avx2 { Self( avx2::_mm_srli_si128 ::<AMOUNT>(self.0)) } }
316 }
317 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # {\n let mut out: u32 = 0;\n for (i, value) in self.as_array().iter().copied().enumerate() {\n out |= u32::from((value as u8) >> 7) << i;\n }\n out\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_movemask_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movemask_epi8)\n\n\n * `PMOVMSKB r32, xmm`\n </li>\n </ul>"]
318 #[inline(always)]
319 fn most_significant_bits(&self) -> u32 {
320 select_impl_block! { scalar { let mut out: u32 = 0; for (i, value) in self.as_array().iter().copied().enumerate() { out |= u32::from((value as u8) >> 7) << i; } out } avx2 { avx2::_mm_movemask_epi8 (self.0) as u32 } }
321 }
322}
323impl I8x16 {
324 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x16 ,\n # ) -> I8x16\n # ;}\n # impl SomeTraitForDoc for I8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x16 ,\n # ) -> I8x16\n # {\n let mut arr = [0; 16];\n for (lane_dst, (lane_src, order)) in\n arr.chunks_exact_mut(16).zip(\n self.as_array().chunks_exact(16)\n .zip(order.as_array().chunks_exact(16))\n )\n {\n for (dst, idx) in lane_dst.iter_mut().zip(order) {\n let idx = *idx;\n *dst = if (idx >> 7) == 1 {\n 0\n } else {\n lane_src[(idx as usize) % 16]\n };\n }\n }\n arr.into()\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shuffle_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_epi8)\n\n\n * `PSHUFB xmm, xmm`\n </li>\n </ul>"]
325 #[inline(always)]
326 pub fn shuffle(&self, order: U8x16) -> I8x16 {
327 select_impl_block! { scalar { let mut arr = [0; 16]; for (lane_dst, (lane_src, order)) in arr.chunks_exact_mut(16).zip( self.as_array().chunks_exact(16) .zip(order.as_array().chunks_exact(16)) ) { for (dst, idx) in lane_dst.iter_mut().zip(order) { let idx = *idx; *dst = if (idx >> 7) == 1 { 0 } else { lane_src[(idx as usize) % 16] }; } } arr.into() } avx2 { Self( avx2::_mm_shuffle_epi8 (self.0, order.0)) } }
328 }
329}
330#[doc = "`[i8; 32]` as a vector."]
331#[repr(transparent)]
332#[derive(Clone, Copy)]
333pub struct I8x32(I8x32Internal);
334unsafe impl bytemuck::Pod for I8x32 {}
335unsafe impl bytemuck::Zeroable for I8x32 {}
336impl PartialEq for I8x32 {
337 #[inline(always)]
338 fn eq(&self, other: &Self) -> bool {
339 ((*self) ^ (*other)).is_zero()
340 }
341}
342impl Eq for I8x32 {}
343impl Default for I8x32 {
344 #[doc = "The zero vector."]
345 #[inline(always)]
346 fn default() -> Self {
347 Self::ZERO
348 }
349}
350impl std::hash::Hash for I8x32 {
351 #[inline]
352 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
353 bytemuck::bytes_of(self).hash(state);
354 }
355}
356impl std::fmt::Debug for I8x32 {
357 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
358 write!(f, "I8x32({:?})", <[i8; 32]>::from(*self))
359 }
360}
361impl subtle::ConstantTimeEq for I8x32 {
362 fn ct_eq(&self, other: &Self) -> subtle::Choice {
363 self.as_array().ct_eq(&other.as_array())
364 }
365}
366impl subtle::ConditionallySelectable for I8x32 {
367 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
368 let mut out = [0; 32];
369 for (out, (a, b)) in out
370 .iter_mut()
371 .zip(a.as_array().iter().zip(b.as_array().iter()))
372 {
373 *out = <i8 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
374 }
375 Self::from(out)
376 }
377}
378impl rand::distributions::Distribution<I8x32> for rand::distributions::Standard {
379 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I8x32 {
380 let mut out = I8x32::ZERO;
381 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
382 out
383 }
384}
385impl AsRef<[i8]> for I8x32 {
386 fn as_ref(&self) -> &[i8] {
387 let arr: &[i8; 32] = bytemuck::cast_ref(self);
388 arr
389 }
390}
391impl AsMut<[i8]> for I8x32 {
392 fn as_mut(&mut self) -> &mut [i8] {
393 let arr: &mut [i8; 32] = bytemuck::cast_mut(self);
394 arr
395 }
396}
397impl From<I16x16> for I8x32 {
398 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x16\nas little endian bits of I8x32."]
399 #[inline(always)]
400 fn from(x: I16x16) -> I8x32 {
401 Self({
402 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
404 })
405 }
406}
407impl From<I32x8> for I8x32 {
408 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x8\nas little endian bits of I8x32."]
409 #[inline(always)]
410 fn from(x: I32x8) -> I8x32 {
411 Self({
412 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
414 })
415 }
416}
417impl From<I64x4> for I8x32 {
418 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x4\nas little endian bits of I8x32."]
419 #[inline(always)]
420 fn from(x: I64x4) -> I8x32 {
421 Self({
422 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
424 })
425 }
426}
427impl From<U8x32> for I8x32 {
428 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x32\nas little endian bits of I8x32."]
429 #[inline(always)]
430 fn from(x: U8x32) -> I8x32 {
431 Self({
432 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
434 })
435 }
436}
437impl From<U16x16> for I8x32 {
438 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x16\nas little endian bits of I8x32."]
439 #[inline(always)]
440 fn from(x: U16x16) -> I8x32 {
441 Self({
442 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
444 })
445 }
446}
447impl From<U32x8> for I8x32 {
448 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x8\nas little endian bits of I8x32."]
449 #[inline(always)]
450 fn from(x: U32x8) -> I8x32 {
451 Self({
452 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
454 })
455 }
456}
457impl From<U64x4> for I8x32 {
458 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x4\nas little endian bits of I8x32."]
459 #[inline(always)]
460 fn from(x: U64x4) -> I8x32 {
461 Self({
462 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
464 })
465 }
466}
467impl From<I8x16> for I8x32 {
468 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I8x32\n # {\n let mut out = [0; 32];\n out[0..16].copy_from_slice(&vector.as_array());\n I8x32::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
469 #[inline(always)]
470 fn from(vector: I8x16) -> I8x32 {
471 select_impl_block! { scalar { let mut out = [0; 32]; out[0..16].copy_from_slice(&vector.as_array()); I8x32::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
472 }
473}
474impl From<[I8x16; 2]> for I8x32 {
475 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [I8x16; 2] ,\n # ) -> I8x32\n # {\n let mut out = [0; 32];\n out[0..16].copy_from_slice(&vectors[0].as_array());\n out[16..].copy_from_slice(&vectors[1].as_array());\n I8x32::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
476 #[inline(always)]
477 fn from(vectors: [I8x16; 2]) -> I8x32 {
478 select_impl_block! { scalar { let mut out = [0; 32]; out[0..16].copy_from_slice(&vectors[0].as_array()); out[16..].copy_from_slice(&vectors[1].as_array()); I8x32::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
479 }
480} impl From<I8x32> for [I8x16; 2] {
482 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x32 ,\n # ) -> [I8x16; 2]\n # {\n let mut lo = [0; 16];\n let mut hi = [0; 16];\n lo.copy_from_slice(&vector.as_array()[0..16]);\n hi.copy_from_slice(&vector.as_array()[16..]);\n [I8x16::from(lo), I8x16::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
483 #[inline(always)]
484 fn from(vector: I8x32) -> [I8x16; 2] {
485 select_impl_block! { scalar { let mut lo = [0; 16]; let mut hi = [0; 16]; lo.copy_from_slice(&vector.as_array()[0..16]); hi.copy_from_slice(&vector.as_array()[16..]); [I8x16::from(lo), I8x16::from(hi)] } avx2 { [ I8x16( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), I8x16( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
486 }
487}
488impl crate::SimdSaturatingArithmetic for I8x32 {
489 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_adds_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_adds_epi8)\n\n\n * `VPADDSB ymm, ymm, ymm`\n </li>\n </ul>"]
490 #[inline(always)]
491 fn saturating_add(&self, other: I8x32) -> I8x32 {
492 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_adds_epi8 (self.0, other.0)) } }
493 }
494 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_subs_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_subs_epi8)\n\n\n * `VPSUBSB ymm, ymm, ymm`\n </li>\n </ul>"]
495 #[inline(always)]
496 fn saturating_sub(&self, other: I8x32) -> I8x32 {
497 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_subs_epi8 (self.0, other.0)) } }
498 }
499} impl ShlAssign<u64> for I8x32 {
501 #[inline(always)]
502 fn shl_assign(&mut self, amount: u64) {
503 *self = (*self) << amount;
504 }
505}
506impl Shl<u64> for I8x32 {
507 type Output = Self;
508 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x32\n # {\n if amount >= 8 {\n I8x32::ZERO\n } else {\n I8x32::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n self.as_array()[8] << amount,\n self.as_array()[9] << amount,\n self.as_array()[10] << amount,\n self.as_array()[11] << amount,\n self.as_array()[12] << amount,\n self.as_array()[13] << amount,\n self.as_array()[14] << amount,\n self.as_array()[15] << amount,\n self.as_array()[16] << amount,\n self.as_array()[17] << amount,\n self.as_array()[18] << amount,\n self.as_array()[19] << amount,\n self.as_array()[20] << amount,\n self.as_array()[21] << amount,\n self.as_array()[22] << amount,\n self.as_array()[23] << amount,\n self.as_array()[24] << amount,\n self.as_array()[25] << amount,\n self.as_array()[26] << amount,\n self.as_array()[27] << amount,\n self.as_array()[28] << amount,\n self.as_array()[29] << amount,\n self.as_array()[30] << amount,\n self.as_array()[31] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
509 #[inline(always)]
510 fn shl(self, amount: u64) -> I8x32 {
511 select_impl_block! { scalar { if amount >= 8 { I8x32::ZERO } else { I8x32::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, self.as_array()[16] << amount, self.as_array()[17] << amount, self.as_array()[18] << amount, self.as_array()[19] << amount, self.as_array()[20] << amount, self.as_array()[21] << amount, self.as_array()[22] << amount, self.as_array()[23] << amount, self.as_array()[24] << amount, self.as_array()[25] << amount, self.as_array()[26] << amount, self.as_array()[27] << amount, self.as_array()[28] << amount, self.as_array()[29] << amount, self.as_array()[30] << amount, self.as_array()[31] << amount, ]) } } avx2 { if amount >= 8 { I8x32::ZERO } else { I8x32::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, self.as_array()[16] << amount, self.as_array()[17] << amount, self.as_array()[18] << amount, self.as_array()[19] << amount, self.as_array()[20] << amount, self.as_array()[21] << amount, self.as_array()[22] << amount, self.as_array()[23] << amount, self.as_array()[24] << amount, self.as_array()[25] << amount, self.as_array()[26] << amount, self.as_array()[27] << amount, self.as_array()[28] << amount, self.as_array()[29] << amount, self.as_array()[30] << amount, self.as_array()[31] << amount, ]) } } }
512 }
513} impl ShlAssign<I8x32> for I8x32 {
515 #[inline(always)]
516 fn shl_assign(&mut self, amount: I8x32) {
517 *self = (*self) << amount;
518 }
519}
520impl Shl<I8x32> for I8x32 {
521 type Output = Self;
522 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x32 ,\n # ) -> I8x32\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
523 #[inline(always)]
524 fn shl(self, amount: I8x32) -> I8x32 {
525 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } I8x32::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } I8x32::from(out) } }
526 }
527} impl ShrAssign<u64> for I8x32 {
529 #[inline(always)]
530 fn shr_assign(&mut self, amount: u64) {
531 *self = (*self) >> amount;
532 }
533}
534impl Shr<u64> for I8x32 {
535 type Output = Self;
536 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I8x32\n # {\n if amount >= 8 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I8x32::from(out)\n } else {\n I8x32::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n self.as_array()[8] >> amount,\n self.as_array()[9] >> amount,\n self.as_array()[10] >> amount,\n self.as_array()[11] >> amount,\n self.as_array()[12] >> amount,\n self.as_array()[13] >> amount,\n self.as_array()[14] >> amount,\n self.as_array()[15] >> amount,\n self.as_array()[16] >> amount,\n self.as_array()[17] >> amount,\n self.as_array()[18] >> amount,\n self.as_array()[19] >> amount,\n self.as_array()[20] >> amount,\n self.as_array()[21] >> amount,\n self.as_array()[22] >> amount,\n self.as_array()[23] >> amount,\n self.as_array()[24] >> amount,\n self.as_array()[25] >> amount,\n self.as_array()[26] >> amount,\n self.as_array()[27] >> amount,\n self.as_array()[28] >> amount,\n self.as_array()[29] >> amount,\n self.as_array()[30] >> amount,\n self.as_array()[31] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
537 #[inline(always)]
538 fn shr(self, amount: u64) -> I8x32 {
539 select_impl_block! { scalar { if amount >= 8 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I8x32::from(out) } else { I8x32::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, self.as_array()[16] >> amount, self.as_array()[17] >> amount, self.as_array()[18] >> amount, self.as_array()[19] >> amount, self.as_array()[20] >> amount, self.as_array()[21] >> amount, self.as_array()[22] >> amount, self.as_array()[23] >> amount, self.as_array()[24] >> amount, self.as_array()[25] >> amount, self.as_array()[26] >> amount, self.as_array()[27] >> amount, self.as_array()[28] >> amount, self.as_array()[29] >> amount, self.as_array()[30] >> amount, self.as_array()[31] >> amount, ]) } } avx2 { if amount >= 8 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I8x32::from(out) } else { I8x32::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, self.as_array()[16] >> amount, self.as_array()[17] >> amount, self.as_array()[18] >> amount, self.as_array()[19] >> amount, self.as_array()[20] >> amount, self.as_array()[21] >> amount, self.as_array()[22] >> amount, self.as_array()[23] >> amount, self.as_array()[24] >> amount, self.as_array()[25] >> amount, self.as_array()[26] >> amount, self.as_array()[27] >> amount, self.as_array()[28] >> amount, self.as_array()[29] >> amount, self.as_array()[30] >> amount, self.as_array()[31] >> amount, ]) } } }
540 }
541} impl ShrAssign<I8x32> for I8x32 {
543 #[inline(always)]
544 fn shr_assign(&mut self, amount: I8x32) {
545 *self = (*self) >> amount;
546 }
547}
548impl Shr<I8x32> for I8x32 {
549 type Output = Self;
550 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I8x32 ,\n # ) -> I8x32\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
551 #[inline(always)]
552 fn shr(self, amount: I8x32) -> I8x32 {
553 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I8x32::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I8x32::from(out) } }
554 }
555}
556impl SimdBase for I8x32 {
557 type Scalar = i8;
558 type Array = [i8; 32];
559 type Signed = I8x32;
560 type Unsigned = U8x32;
561 const LANES: usize = 32;
562 const ZERO: Self = Self::from_array([0; 32]);
563 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
564 #[inline(always)]
565 fn is_zero(&self) -> bool {
566 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
567 }
568 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i8 ,\n # ) -> I8x32\n # {\n let mut out = [0; 32];\n out[0] = scalar;\n I8x32::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
569 #[inline(always)]
570 fn set_lo(scalar: i8) -> I8x32 {
571 select_impl_block! { scalar { let mut out = [0; 32]; out[0] = scalar; I8x32::from(out) } avx2 { Self( avx2::_mm256_set_epi8 ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, scalar as i8, )) } }
572 }
573 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i8\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i8\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
574 #[inline(always)]
575 fn extract<const I: usize>(&self) -> i8 {
576 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi8 ::<I>(self.0) as i8 } }
577 }
578 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i8 ,\n # ) -> I8x32\n # {\n I8x32::from([scalar; 32])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
579 #[inline(always)]
580 fn broadcast(scalar: i8) -> I8x32 {
581 select_impl_block! { scalar { I8x32::from([scalar; 32]) } avx2 { Self( avx2::_mm256_set1_epi8 (scalar as i8)) } }
582 }
583 type BroadcastLoInput = I8x16;
584 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I8x32\n # {\n I8x32::from([vector.as_array()[0]; 32])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastb_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastb_epi8)\n\n\n * `VPBROADCASTB ymm, xmm`\n </li>\n </ul>"]
585 #[inline(always)]
586 fn broadcast_lo(vector: I8x16) -> I8x32 {
587 select_impl_block! { scalar { I8x32::from([vector.as_array()[0]; 32]) } avx2 { Self( avx2::_mm256_broadcastb_epi8 (vector.0)) } }
588 }
589 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n I8x32::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 },\n if self.as_array()[8] == other.as_array()[8] { -1 } else { 0 },\n if self.as_array()[9] == other.as_array()[9] { -1 } else { 0 },\n if self.as_array()[10] == other.as_array()[10] { -1 } else { 0 },\n if self.as_array()[11] == other.as_array()[11] { -1 } else { 0 },\n if self.as_array()[12] == other.as_array()[12] { -1 } else { 0 },\n if self.as_array()[13] == other.as_array()[13] { -1 } else { 0 },\n if self.as_array()[14] == other.as_array()[14] { -1 } else { 0 },\n if self.as_array()[15] == other.as_array()[15] { -1 } else { 0 },\n if self.as_array()[16] == other.as_array()[16] { -1 } else { 0 },\n if self.as_array()[17] == other.as_array()[17] { -1 } else { 0 },\n if self.as_array()[18] == other.as_array()[18] { -1 } else { 0 },\n if self.as_array()[19] == other.as_array()[19] { -1 } else { 0 },\n if self.as_array()[20] == other.as_array()[20] { -1 } else { 0 },\n if self.as_array()[21] == other.as_array()[21] { -1 } else { 0 },\n if self.as_array()[22] == other.as_array()[22] { -1 } else { 0 },\n if self.as_array()[23] == other.as_array()[23] { -1 } else { 0 },\n if self.as_array()[24] == other.as_array()[24] { -1 } else { 0 },\n if self.as_array()[25] == other.as_array()[25] { -1 } else { 0 },\n if self.as_array()[26] == other.as_array()[26] { -1 } else { 0 },\n if self.as_array()[27] == other.as_array()[27] { -1 } else { 0 },\n if self.as_array()[28] == other.as_array()[28] { -1 } else { 0 },\n if self.as_array()[29] == other.as_array()[29] { -1 } else { 0 },\n if self.as_array()[30] == other.as_array()[30] { -1 } else { 0 },\n if self.as_array()[31] == other.as_array()[31] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi8)\n\n\n * `VPCMPEQB ymm, ymm, ymm`\n </li>\n </ul>"]
590 #[inline(always)]
591 fn cmp_eq(&self, other: I8x32) -> I8x32 {
592 select_impl_block! { scalar { I8x32::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 }, if self.as_array()[8] == other.as_array()[8] { -1 } else { 0 }, if self.as_array()[9] == other.as_array()[9] { -1 } else { 0 }, if self.as_array()[10] == other.as_array()[10] { -1 } else { 0 }, if self.as_array()[11] == other.as_array()[11] { -1 } else { 0 }, if self.as_array()[12] == other.as_array()[12] { -1 } else { 0 }, if self.as_array()[13] == other.as_array()[13] { -1 } else { 0 }, if self.as_array()[14] == other.as_array()[14] { -1 } else { 0 }, if self.as_array()[15] == other.as_array()[15] { -1 } else { 0 }, if self.as_array()[16] == other.as_array()[16] { -1 } else { 0 }, if self.as_array()[17] == other.as_array()[17] { -1 } else { 0 }, if self.as_array()[18] == other.as_array()[18] { -1 } else { 0 }, if self.as_array()[19] == other.as_array()[19] { -1 } else { 0 }, if self.as_array()[20] == other.as_array()[20] { -1 } else { 0 }, if self.as_array()[21] == other.as_array()[21] { -1 } else { 0 }, if self.as_array()[22] == other.as_array()[22] { -1 } else { 0 }, if self.as_array()[23] == other.as_array()[23] { -1 } else { 0 }, if self.as_array()[24] == other.as_array()[24] { -1 } else { 0 }, if self.as_array()[25] == other.as_array()[25] { -1 } else { 0 }, if self.as_array()[26] == other.as_array()[26] { -1 } else { 0 }, if self.as_array()[27] == other.as_array()[27] { -1 } else { 0 }, if self.as_array()[28] == other.as_array()[28] { -1 } else { 0 }, if self.as_array()[29] == other.as_array()[29] { -1 } else { 0 }, if self.as_array()[30] == other.as_array()[30] { -1 } else { 0 }, if self.as_array()[31] == other.as_array()[31] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi8 (self.0, other.0)) } }
593 }
594 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n I8x32::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n self.as_array()[8] & (!other.as_array()[8]),\n self.as_array()[9] & (!other.as_array()[9]),\n self.as_array()[10] & (!other.as_array()[10]),\n self.as_array()[11] & (!other.as_array()[11]),\n self.as_array()[12] & (!other.as_array()[12]),\n self.as_array()[13] & (!other.as_array()[13]),\n self.as_array()[14] & (!other.as_array()[14]),\n self.as_array()[15] & (!other.as_array()[15]),\n self.as_array()[16] & (!other.as_array()[16]),\n self.as_array()[17] & (!other.as_array()[17]),\n self.as_array()[18] & (!other.as_array()[18]),\n self.as_array()[19] & (!other.as_array()[19]),\n self.as_array()[20] & (!other.as_array()[20]),\n self.as_array()[21] & (!other.as_array()[21]),\n self.as_array()[22] & (!other.as_array()[22]),\n self.as_array()[23] & (!other.as_array()[23]),\n self.as_array()[24] & (!other.as_array()[24]),\n self.as_array()[25] & (!other.as_array()[25]),\n self.as_array()[26] & (!other.as_array()[26]),\n self.as_array()[27] & (!other.as_array()[27]),\n self.as_array()[28] & (!other.as_array()[28]),\n self.as_array()[29] & (!other.as_array()[29]),\n self.as_array()[30] & (!other.as_array()[30]),\n self.as_array()[31] & (!other.as_array()[31]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
595 #[inline(always)]
596 fn and_not(&self, other: I8x32) -> I8x32 {
597 select_impl_block! { scalar { I8x32::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), self.as_array()[8] & (!other.as_array()[8]), self.as_array()[9] & (!other.as_array()[9]), self.as_array()[10] & (!other.as_array()[10]), self.as_array()[11] & (!other.as_array()[11]), self.as_array()[12] & (!other.as_array()[12]), self.as_array()[13] & (!other.as_array()[13]), self.as_array()[14] & (!other.as_array()[14]), self.as_array()[15] & (!other.as_array()[15]), self.as_array()[16] & (!other.as_array()[16]), self.as_array()[17] & (!other.as_array()[17]), self.as_array()[18] & (!other.as_array()[18]), self.as_array()[19] & (!other.as_array()[19]), self.as_array()[20] & (!other.as_array()[20]), self.as_array()[21] & (!other.as_array()[21]), self.as_array()[22] & (!other.as_array()[22]), self.as_array()[23] & (!other.as_array()[23]), self.as_array()[24] & (!other.as_array()[24]), self.as_array()[25] & (!other.as_array()[25]), self.as_array()[26] & (!other.as_array()[26]), self.as_array()[27] & (!other.as_array()[27]), self.as_array()[28] & (!other.as_array()[28]), self.as_array()[29] & (!other.as_array()[29]), self.as_array()[30] & (!other.as_array()[30]), self.as_array()[31] & (!other.as_array()[31]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
598 }
599 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n I8x32::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 },\n if self.as_array()[8] > other.as_array()[8] { -1 } else { 0 },\n if self.as_array()[9] > other.as_array()[9] { -1 } else { 0 },\n if self.as_array()[10] > other.as_array()[10] { -1 } else { 0 },\n if self.as_array()[11] > other.as_array()[11] { -1 } else { 0 },\n if self.as_array()[12] > other.as_array()[12] { -1 } else { 0 },\n if self.as_array()[13] > other.as_array()[13] { -1 } else { 0 },\n if self.as_array()[14] > other.as_array()[14] { -1 } else { 0 },\n if self.as_array()[15] > other.as_array()[15] { -1 } else { 0 },\n if self.as_array()[16] > other.as_array()[16] { -1 } else { 0 },\n if self.as_array()[17] > other.as_array()[17] { -1 } else { 0 },\n if self.as_array()[18] > other.as_array()[18] { -1 } else { 0 },\n if self.as_array()[19] > other.as_array()[19] { -1 } else { 0 },\n if self.as_array()[20] > other.as_array()[20] { -1 } else { 0 },\n if self.as_array()[21] > other.as_array()[21] { -1 } else { 0 },\n if self.as_array()[22] > other.as_array()[22] { -1 } else { 0 },\n if self.as_array()[23] > other.as_array()[23] { -1 } else { 0 },\n if self.as_array()[24] > other.as_array()[24] { -1 } else { 0 },\n if self.as_array()[25] > other.as_array()[25] { -1 } else { 0 },\n if self.as_array()[26] > other.as_array()[26] { -1 } else { 0 },\n if self.as_array()[27] > other.as_array()[27] { -1 } else { 0 },\n if self.as_array()[28] > other.as_array()[28] { -1 } else { 0 },\n if self.as_array()[29] > other.as_array()[29] { -1 } else { 0 },\n if self.as_array()[30] > other.as_array()[30] { -1 } else { 0 },\n if self.as_array()[31] > other.as_array()[31] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpgt_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpgt_epi8)\n\n\n * `VPCMPGTB ymm, ymm, ymm`\n </li>\n </ul>"]
600 #[inline(always)]
601 fn cmp_gt(&self, other: I8x32) -> I8x32 {
602 select_impl_block! { scalar { I8x32::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 }, if self.as_array()[8] > other.as_array()[8] { -1 } else { 0 }, if self.as_array()[9] > other.as_array()[9] { -1 } else { 0 }, if self.as_array()[10] > other.as_array()[10] { -1 } else { 0 }, if self.as_array()[11] > other.as_array()[11] { -1 } else { 0 }, if self.as_array()[12] > other.as_array()[12] { -1 } else { 0 }, if self.as_array()[13] > other.as_array()[13] { -1 } else { 0 }, if self.as_array()[14] > other.as_array()[14] { -1 } else { 0 }, if self.as_array()[15] > other.as_array()[15] { -1 } else { 0 }, if self.as_array()[16] > other.as_array()[16] { -1 } else { 0 }, if self.as_array()[17] > other.as_array()[17] { -1 } else { 0 }, if self.as_array()[18] > other.as_array()[18] { -1 } else { 0 }, if self.as_array()[19] > other.as_array()[19] { -1 } else { 0 }, if self.as_array()[20] > other.as_array()[20] { -1 } else { 0 }, if self.as_array()[21] > other.as_array()[21] { -1 } else { 0 }, if self.as_array()[22] > other.as_array()[22] { -1 } else { 0 }, if self.as_array()[23] > other.as_array()[23] { -1 } else { 0 }, if self.as_array()[24] > other.as_array()[24] { -1 } else { 0 }, if self.as_array()[25] > other.as_array()[25] { -1 } else { 0 }, if self.as_array()[26] > other.as_array()[26] { -1 } else { 0 }, if self.as_array()[27] > other.as_array()[27] { -1 } else { 0 }, if self.as_array()[28] > other.as_array()[28] { -1 } else { 0 }, if self.as_array()[29] > other.as_array()[29] { -1 } else { 0 }, if self.as_array()[30] > other.as_array()[30] { -1 } else { 0 }, if self.as_array()[31] > other.as_array()[31] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpgt_epi8 (self.0, other.0)) } }
603 }
604 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
605 #[inline(always)]
606 fn shift_left<const BITS: usize>(&self) -> I8x32 {
607 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I8x32::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I8x32::from(out) } }
608 }
609 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
610 #[inline(always)]
611 fn shift_right<const BITS: usize>(&self) -> I8x32 {
612 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I8x32::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I8x32::from(out) } }
613 }
614 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n I8x32::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n // Lane# 1\n self.as_array()[16],\n other.as_array()[16],\n self.as_array()[17],\n other.as_array()[17],\n self.as_array()[18],\n other.as_array()[18],\n self.as_array()[19],\n other.as_array()[19],\n self.as_array()[20],\n other.as_array()[20],\n self.as_array()[21],\n other.as_array()[21],\n self.as_array()[22],\n other.as_array()[22],\n self.as_array()[23],\n other.as_array()[23],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi8)\n\n\n * `VPUNPCKLBW ymm, ymm, ymm`\n </li>\n </ul>"]
615 #[inline(always)]
616 fn unpack_lo(&self, other: I8x32) -> I8x32 {
617 select_impl_block! { scalar { I8x32::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], self.as_array()[16], other.as_array()[16], self.as_array()[17], other.as_array()[17], self.as_array()[18], other.as_array()[18], self.as_array()[19], other.as_array()[19], self.as_array()[20], other.as_array()[20], self.as_array()[21], other.as_array()[21], self.as_array()[22], other.as_array()[22], self.as_array()[23], other.as_array()[23], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi8 (self.0, other.0)) } }
620 }
621 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n I8x32::from([\n // Lane# 0\n self.as_array()[8],\n other.as_array()[8],\n self.as_array()[9],\n other.as_array()[9],\n self.as_array()[10],\n other.as_array()[10],\n self.as_array()[11],\n other.as_array()[11],\n self.as_array()[12],\n other.as_array()[12],\n self.as_array()[13],\n other.as_array()[13],\n self.as_array()[14],\n other.as_array()[14],\n self.as_array()[15],\n other.as_array()[15],\n // Lane# 1\n self.as_array()[24],\n other.as_array()[24],\n self.as_array()[25],\n other.as_array()[25],\n self.as_array()[26],\n other.as_array()[26],\n self.as_array()[27],\n other.as_array()[27],\n self.as_array()[28],\n other.as_array()[28],\n self.as_array()[29],\n other.as_array()[29],\n self.as_array()[30],\n other.as_array()[30],\n self.as_array()[31],\n other.as_array()[31],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi8)\n\n\n * `VPUNPCKHBW ymm, ymm, ymm`\n </li>\n </ul>"]
622 #[inline(always)]
623 fn unpack_hi(&self, other: I8x32) -> I8x32 {
624 select_impl_block! { scalar { I8x32::from([ self.as_array()[8], other.as_array()[8], self.as_array()[9], other.as_array()[9], self.as_array()[10], other.as_array()[10], self.as_array()[11], other.as_array()[11], self.as_array()[12], other.as_array()[12], self.as_array()[13], other.as_array()[13], self.as_array()[14], other.as_array()[14], self.as_array()[15], other.as_array()[15], self.as_array()[24], other.as_array()[24], self.as_array()[25], other.as_array()[25], self.as_array()[26], other.as_array()[26], self.as_array()[27], other.as_array()[27], self.as_array()[28], other.as_array()[28], self.as_array()[29], other.as_array()[29], self.as_array()[30], other.as_array()[30], self.as_array()[31], other.as_array()[31], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi8 (self.0, other.0)) } }
627 }
628 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n I8x32::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n self.as_array()[8].max(other.as_array()[8]),\n self.as_array()[9].max(other.as_array()[9]),\n self.as_array()[10].max(other.as_array()[10]),\n self.as_array()[11].max(other.as_array()[11]),\n self.as_array()[12].max(other.as_array()[12]),\n self.as_array()[13].max(other.as_array()[13]),\n self.as_array()[14].max(other.as_array()[14]),\n self.as_array()[15].max(other.as_array()[15]),\n self.as_array()[16].max(other.as_array()[16]),\n self.as_array()[17].max(other.as_array()[17]),\n self.as_array()[18].max(other.as_array()[18]),\n self.as_array()[19].max(other.as_array()[19]),\n self.as_array()[20].max(other.as_array()[20]),\n self.as_array()[21].max(other.as_array()[21]),\n self.as_array()[22].max(other.as_array()[22]),\n self.as_array()[23].max(other.as_array()[23]),\n self.as_array()[24].max(other.as_array()[24]),\n self.as_array()[25].max(other.as_array()[25]),\n self.as_array()[26].max(other.as_array()[26]),\n self.as_array()[27].max(other.as_array()[27]),\n self.as_array()[28].max(other.as_array()[28]),\n self.as_array()[29].max(other.as_array()[29]),\n self.as_array()[30].max(other.as_array()[30]),\n self.as_array()[31].max(other.as_array()[31]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_max_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_max_epi8)\n\n\n * `VPMAXSB ymm, ymm, ymm`\n </li>\n </ul>"]
629 #[inline(always)]
630 fn max(&self, other: I8x32) -> I8x32 {
631 select_impl_block! { scalar { I8x32::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), self.as_array()[8].max(other.as_array()[8]), self.as_array()[9].max(other.as_array()[9]), self.as_array()[10].max(other.as_array()[10]), self.as_array()[11].max(other.as_array()[11]), self.as_array()[12].max(other.as_array()[12]), self.as_array()[13].max(other.as_array()[13]), self.as_array()[14].max(other.as_array()[14]), self.as_array()[15].max(other.as_array()[15]), self.as_array()[16].max(other.as_array()[16]), self.as_array()[17].max(other.as_array()[17]), self.as_array()[18].max(other.as_array()[18]), self.as_array()[19].max(other.as_array()[19]), self.as_array()[20].max(other.as_array()[20]), self.as_array()[21].max(other.as_array()[21]), self.as_array()[22].max(other.as_array()[22]), self.as_array()[23].max(other.as_array()[23]), self.as_array()[24].max(other.as_array()[24]), self.as_array()[25].max(other.as_array()[25]), self.as_array()[26].max(other.as_array()[26]), self.as_array()[27].max(other.as_array()[27]), self.as_array()[28].max(other.as_array()[28]), self.as_array()[29].max(other.as_array()[29]), self.as_array()[30].max(other.as_array()[30]), self.as_array()[31].max(other.as_array()[31]), ]) } avx2 { Self( avx2::_mm256_max_epi8 (self.0, other.0)) } }
632 }
633 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I8x32 ,\n # ) -> I8x32\n # {\n I8x32::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n self.as_array()[8].min(other.as_array()[8]),\n self.as_array()[9].min(other.as_array()[9]),\n self.as_array()[10].min(other.as_array()[10]),\n self.as_array()[11].min(other.as_array()[11]),\n self.as_array()[12].min(other.as_array()[12]),\n self.as_array()[13].min(other.as_array()[13]),\n self.as_array()[14].min(other.as_array()[14]),\n self.as_array()[15].min(other.as_array()[15]),\n self.as_array()[16].min(other.as_array()[16]),\n self.as_array()[17].min(other.as_array()[17]),\n self.as_array()[18].min(other.as_array()[18]),\n self.as_array()[19].min(other.as_array()[19]),\n self.as_array()[20].min(other.as_array()[20]),\n self.as_array()[21].min(other.as_array()[21]),\n self.as_array()[22].min(other.as_array()[22]),\n self.as_array()[23].min(other.as_array()[23]),\n self.as_array()[24].min(other.as_array()[24]),\n self.as_array()[25].min(other.as_array()[25]),\n self.as_array()[26].min(other.as_array()[26]),\n self.as_array()[27].min(other.as_array()[27]),\n self.as_array()[28].min(other.as_array()[28]),\n self.as_array()[29].min(other.as_array()[29]),\n self.as_array()[30].min(other.as_array()[30]),\n self.as_array()[31].min(other.as_array()[31]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_min_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_min_epi8)\n\n\n * `VPMINSB ymm, ymm, ymm`\n </li>\n </ul>"]
634 #[inline(always)]
635 fn min(&self, other: I8x32) -> I8x32 {
636 select_impl_block! { scalar { I8x32::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), self.as_array()[8].min(other.as_array()[8]), self.as_array()[9].min(other.as_array()[9]), self.as_array()[10].min(other.as_array()[10]), self.as_array()[11].min(other.as_array()[11]), self.as_array()[12].min(other.as_array()[12]), self.as_array()[13].min(other.as_array()[13]), self.as_array()[14].min(other.as_array()[14]), self.as_array()[15].min(other.as_array()[15]), self.as_array()[16].min(other.as_array()[16]), self.as_array()[17].min(other.as_array()[17]), self.as_array()[18].min(other.as_array()[18]), self.as_array()[19].min(other.as_array()[19]), self.as_array()[20].min(other.as_array()[20]), self.as_array()[21].min(other.as_array()[21]), self.as_array()[22].min(other.as_array()[22]), self.as_array()[23].min(other.as_array()[23]), self.as_array()[24].min(other.as_array()[24]), self.as_array()[25].min(other.as_array()[25]), self.as_array()[26].min(other.as_array()[26]), self.as_array()[27].min(other.as_array()[27]), self.as_array()[28].min(other.as_array()[28]), self.as_array()[29].min(other.as_array()[29]), self.as_array()[30].min(other.as_array()[30]), self.as_array()[31].min(other.as_array()[31]), ]) } avx2 { Self( avx2::_mm256_min_epi8 (self.0, other.0)) } }
637 }
638}
639impl crate::SimdBase8 for I8x32 {
640 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # {\n let mut out = [0; 32];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]);\n }\n I8x32::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_si256)\n\n\n * `VPSLLDQ ymm, ymm, imm8`\n </li>\n </ul>"]
641 #[inline(always)]
642 fn shift_bytes_left<const AMOUNT: usize>(&self) -> I8x32 {
643 select_impl_block! { scalar { let mut out = [0; 32]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]); } I8x32::from(out) } avx2 { Self( avx2::_mm256_slli_si256 ::<AMOUNT>(self.0)) } }
644 }
645 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> I8x32\n # {\n let mut out = [0; 32];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]);\n }\n I8x32::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srli_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srli_si256)\n\n\n * `VPSRLDQ ymm, ymm, imm8`\n </li>\n </ul>"]
646 #[inline(always)]
647 fn shift_bytes_right<const AMOUNT: usize>(&self) -> I8x32 {
648 select_impl_block! { scalar { let mut out = [0; 32]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]); } I8x32::from(out) } avx2 { Self( avx2::_mm256_srli_si256 ::<AMOUNT>(self.0)) } }
649 }
650 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # {\n let mut out: u32 = 0;\n for (i, value) in self.as_array().iter().copied().enumerate() {\n out |= u32::from((value as u8) >> 7) << i;\n }\n out\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_movemask_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_movemask_epi8)\n\n\n * `VPMOVMSKB r32, ymm`\n </li>\n </ul>"]
651 #[inline(always)]
652 fn most_significant_bits(&self) -> u32 {
653 select_impl_block! { scalar { let mut out: u32 = 0; for (i, value) in self.as_array().iter().copied().enumerate() { out |= u32::from((value as u8) >> 7) << i; } out } avx2 { avx2::_mm256_movemask_epi8 (self.0) as u32 } }
654 }
655}
656impl I8x32 {
657 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x32 ,\n # ) -> I8x32\n # ;}\n # impl SomeTraitForDoc for I8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x32 ,\n # ) -> I8x32\n # {\n let mut arr = [0; 32];\n for (lane_dst, (lane_src, order)) in\n arr.chunks_exact_mut(16).zip(\n self.as_array().chunks_exact(16)\n .zip(order.as_array().chunks_exact(16))\n )\n {\n for (dst, idx) in lane_dst.iter_mut().zip(order) {\n let idx = *idx;\n *dst = if (idx >> 7) == 1 {\n 0\n } else {\n lane_src[(idx as usize) % 16]\n };\n }\n }\n arr.into()\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shuffle_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shuffle_epi8)\n\n\n * `VPSHUFB ymm, ymm, ymm`\n </li>\n </ul>"]
658 #[inline(always)]
659 pub fn shuffle(&self, order: U8x32) -> I8x32 {
660 select_impl_block! { scalar { let mut arr = [0; 32]; for (lane_dst, (lane_src, order)) in arr.chunks_exact_mut(16).zip( self.as_array().chunks_exact(16) .zip(order.as_array().chunks_exact(16)) ) { for (dst, idx) in lane_dst.iter_mut().zip(order) { let idx = *idx; *dst = if (idx >> 7) == 1 { 0 } else { lane_src[(idx as usize) % 16] }; } } arr.into() } avx2 { Self( avx2::_mm256_shuffle_epi8 (self.0, order.0)) } }
661 }
662}
663#[doc = "`[i16; 8]` as a vector."]
664#[repr(transparent)]
665#[derive(Clone, Copy)]
666pub struct I16x8(I16x8Internal);
667unsafe impl bytemuck::Pod for I16x8 {}
668unsafe impl bytemuck::Zeroable for I16x8 {}
669impl PartialEq for I16x8 {
670 #[inline(always)]
671 fn eq(&self, other: &Self) -> bool {
672 ((*self) ^ (*other)).is_zero()
673 }
674}
675impl Eq for I16x8 {}
676impl Default for I16x8 {
677 #[doc = "The zero vector."]
678 #[inline(always)]
679 fn default() -> Self {
680 Self::ZERO
681 }
682}
683impl std::hash::Hash for I16x8 {
684 #[inline]
685 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
686 bytemuck::bytes_of(self).hash(state);
687 }
688}
689impl std::fmt::Debug for I16x8 {
690 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
691 write!(f, "I16x8({:?})", <[i16; 8]>::from(*self))
692 }
693}
694impl subtle::ConstantTimeEq for I16x8 {
695 fn ct_eq(&self, other: &Self) -> subtle::Choice {
696 self.as_array().ct_eq(&other.as_array())
697 }
698}
699impl subtle::ConditionallySelectable for I16x8 {
700 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
701 let mut out = [0; 8];
702 for (out, (a, b)) in out
703 .iter_mut()
704 .zip(a.as_array().iter().zip(b.as_array().iter()))
705 {
706 *out = <i16 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
707 }
708 Self::from(out)
709 }
710}
711impl rand::distributions::Distribution<I16x8> for rand::distributions::Standard {
712 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I16x8 {
713 let mut out = I16x8::ZERO;
714 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
715 out
716 }
717}
718impl AsRef<[i16]> for I16x8 {
719 fn as_ref(&self) -> &[i16] {
720 let arr: &[i16; 8] = bytemuck::cast_ref(self);
721 arr
722 }
723}
724impl AsMut<[i16]> for I16x8 {
725 fn as_mut(&mut self) -> &mut [i16] {
726 let arr: &mut [i16; 8] = bytemuck::cast_mut(self);
727 arr
728 }
729}
730impl From<I8x16> for I16x8 {
731 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x16\nas little endian bits of I16x8."]
732 #[inline(always)]
733 fn from(x: I8x16) -> I16x8 {
734 Self({
735 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
737 })
738 }
739}
740impl From<I32x4> for I16x8 {
741 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x4\nas little endian bits of I16x8."]
742 #[inline(always)]
743 fn from(x: I32x4) -> I16x8 {
744 Self({
745 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
747 })
748 }
749}
750impl From<I64x2> for I16x8 {
751 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x2\nas little endian bits of I16x8."]
752 #[inline(always)]
753 fn from(x: I64x2) -> I16x8 {
754 Self({
755 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
757 })
758 }
759}
760impl From<U8x16> for I16x8 {
761 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x16\nas little endian bits of I16x8."]
762 #[inline(always)]
763 fn from(x: U8x16) -> I16x8 {
764 Self({
765 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
767 })
768 }
769}
770impl From<U16x8> for I16x8 {
771 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x8\nas little endian bits of I16x8."]
772 #[inline(always)]
773 fn from(x: U16x8) -> I16x8 {
774 Self({
775 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
777 })
778 }
779}
780impl From<U32x4> for I16x8 {
781 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x4\nas little endian bits of I16x8."]
782 #[inline(always)]
783 fn from(x: U32x4) -> I16x8 {
784 Self({
785 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
787 })
788 }
789}
790impl From<U64x2> for I16x8 {
791 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x2\nas little endian bits of I16x8."]
792 #[inline(always)]
793 fn from(x: U64x2) -> I16x8 {
794 Self({
795 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
797 })
798 }
799}
800impl crate::ExtendingCast<I8x16> for I16x8 {
801 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I16x8\n # {\n I16x8::from([\n i16::from(vector.as_array()[0]),\n i16::from(vector.as_array()[1]),\n i16::from(vector.as_array()[2]),\n i16::from(vector.as_array()[3]),\n i16::from(vector.as_array()[4]),\n i16::from(vector.as_array()[5]),\n i16::from(vector.as_array()[6]),\n i16::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepi8_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepi8_epi16)\n\n\n * `PMOVSXBW xmm, xmm`\n </li>\n </ul>"]
802 #[inline(always)]
803 fn extending_cast_from(vector: I8x16) -> I16x8 {
804 select_impl_block! { scalar { I16x8::from([ i16::from(vector.as_array()[0]), i16::from(vector.as_array()[1]), i16::from(vector.as_array()[2]), i16::from(vector.as_array()[3]), i16::from(vector.as_array()[4]), i16::from(vector.as_array()[5]), i16::from(vector.as_array()[6]), i16::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm_cvtepi8_epi16 (vector.0)) } }
805 }
806}
807impl crate::SimdSaturatingArithmetic for I16x8 {
808 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_adds_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_adds_epi16)\n\n\n * `PADDSW xmm, xmm`\n </li>\n </ul>"]
809 #[inline(always)]
810 fn saturating_add(&self, other: I16x8) -> I16x8 {
811 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm_adds_epi16 (self.0, other.0)) } }
812 }
813 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_subs_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_subs_epi16)\n\n\n * `PSUBSW xmm, xmm`\n </li>\n </ul>"]
814 #[inline(always)]
815 fn saturating_sub(&self, other: I16x8) -> I16x8 {
816 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm_subs_epi16 (self.0, other.0)) } }
817 }
818} impl ShlAssign<u64> for I16x8 {
820 #[inline(always)]
821 fn shl_assign(&mut self, amount: u64) {
822 *self = (*self) << amount;
823 }
824}
825impl Shl<u64> for I16x8 {
826 type Output = Self;
827 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x8\n # {\n if amount >= 16 {\n I16x8::ZERO\n } else {\n I16x8::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_sll_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi16)\n\n\n * `PSLLW xmm, xmm`\n </li>\n </ul>"]
828 #[inline(always)]
829 fn shl(self, amount: u64) -> I16x8 {
830 select_impl_block! { scalar { if amount >= 16 { I16x8::ZERO } else { I16x8::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_sll_epi16 (self.0, amount)) } }
831 }
832} impl ShlAssign<I16x8> for I16x8 {
834 #[inline(always)]
835 fn shl_assign(&mut self, amount: I16x8) {
836 *self = (*self) << amount;
837 }
838}
839impl Shl<I16x8> for I16x8 {
840 type Output = Self;
841 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x8 ,\n # ) -> I16x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I16x8::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
842 #[inline(always)]
843 fn shl(self, amount: I16x8) -> I16x8 {
844 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } I16x8::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } I16x8::from(out) } }
845 }
846} impl ShrAssign<u64> for I16x8 {
848 #[inline(always)]
849 fn shr_assign(&mut self, amount: u64) {
850 *self = (*self) >> amount;
851 }
852}
853impl Shr<u64> for I16x8 {
854 type Output = Self;
855 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x8\n # {\n if amount >= 16 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I16x8::from(out)\n } else {\n I16x8::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_sra_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sra_epi16)\n\n\n * `PSRAW xmm, xmm`\n </li>\n </ul>"]
856 #[inline(always)]
857 fn shr(self, amount: u64) -> I16x8 {
858 select_impl_block! { scalar { if amount >= 16 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I16x8::from(out) } else { I16x8::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_sra_epi16 (self.0, amount)) } }
859 }
860} impl ShrAssign<I16x8> for I16x8 {
862 #[inline(always)]
863 fn shr_assign(&mut self, amount: I16x8) {
864 *self = (*self) >> amount;
865 }
866}
867impl Shr<I16x8> for I16x8 {
868 type Output = Self;
869 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x8 ,\n # ) -> I16x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I16x8::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
870 #[inline(always)]
871 fn shr(self, amount: I16x8) -> I16x8 {
872 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I16x8::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I16x8::from(out) } }
873 }
874}
875impl SimdBase for I16x8 {
876 type Scalar = i16;
877 type Array = [i16; 8];
878 type Signed = I16x8;
879 type Unsigned = U16x8;
880 const LANES: usize = 8;
881 const ZERO: Self = Self::from_array([0; 8]);
882 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
883 #[inline(always)]
884 fn is_zero(&self) -> bool {
885 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
886 }
887 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i16 ,\n # ) -> I16x8\n # {\n let mut out = [0; 8];\n out[0] = scalar;\n I16x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
888 #[inline(always)]
889 fn set_lo(scalar: i16) -> I16x8 {
890 select_impl_block! { scalar { let mut out = [0; 8]; out[0] = scalar; I16x8::from(out) } avx2 { Self( avx2::_mm_set_epi16 ( 0, 0, 0, 0, 0, 0, 0, scalar as i16, )) } }
891 }
892 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i16\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i16\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi16)\n\n\n * `PEXTRW r32, xmm, imm8`\n </li>\n </ul>"]
893 #[inline(always)]
894 fn extract<const I: usize>(&self) -> i16 {
895 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi16 ::<I>(self.0) as i16 } }
896 }
897 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i16 ,\n # ) -> I16x8\n # {\n I16x8::from([scalar; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
898 #[inline(always)]
899 fn broadcast(scalar: i16) -> I16x8 {
900 select_impl_block! { scalar { I16x8::from([scalar; 8]) } avx2 { Self( avx2::_mm_set1_epi16 (scalar as i16)) } }
901 }
902 type BroadcastLoInput = I16x8;
903 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([vector.as_array()[0]; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastw_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastw_epi16)\n\n\n * `VPBROADCASTW xmm, xmm`\n </li>\n </ul>"]
904 #[inline(always)]
905 fn broadcast_lo(vector: I16x8) -> I16x8 {
906 select_impl_block! { scalar { I16x8::from([vector.as_array()[0]; 8]) } avx2 { Self( avx2::_mm_broadcastw_epi16 (vector.0)) } }
907 }
908 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi16)\n\n\n * `PCMPEQW xmm, xmm`\n </li>\n </ul>"]
909 #[inline(always)]
910 fn cmp_eq(&self, other: I16x8) -> I16x8 {
911 select_impl_block! { scalar { I16x8::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi16 (self.0, other.0)) } }
912 }
913 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
914 #[inline(always)]
915 fn and_not(&self, other: I16x8) -> I16x8 {
916 select_impl_block! { scalar { I16x8::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
917 }
918 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpgt_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpgt_epi16)\n\n\n * `PCMPGTW xmm, xmm`\n </li>\n </ul>"]
919 #[inline(always)]
920 fn cmp_gt(&self, other: I16x8) -> I16x8 {
921 select_impl_block! { scalar { I16x8::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpgt_epi16 (self.0, other.0)) } }
922 }
923 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I16x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi16)\n\n\n * `PSLLW xmm, imm8`\n </li>\n </ul>"]
924 #[inline(always)]
925 fn shift_left<const BITS: usize>(&self) -> I16x8 {
926 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I16x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_slli_epi16 ::<BITS>(self.0)) } }
927 }
928 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I16x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srai_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srai_epi16)\n\n\n * `PSRAW xmm, imm8`\n </li>\n </ul>"]
929 #[inline(always)]
930 fn shift_right<const BITS: usize>(&self) -> I16x8 {
931 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I16x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_srai_epi16 ::<BITS>(self.0)) } }
932 }
933 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi16)\n\n\n * `PUNPCKLWD xmm, xmm`\n </li>\n </ul>"]
934 #[inline(always)]
935 fn unpack_lo(&self, other: I16x8) -> I16x8 {
936 select_impl_block! { scalar { I16x8::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], ]) } avx2 { Self( avx2::_mm_unpacklo_epi16 (self.0, other.0)) } }
938 }
939 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n // Lane# 0\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi16)\n\n\n * `PUNPCKHWD xmm, xmm`\n </li>\n </ul>"]
940 #[inline(always)]
941 fn unpack_hi(&self, other: I16x8) -> I16x8 {
942 select_impl_block! { scalar { I16x8::from([ self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], ]) } avx2 { Self( avx2::_mm_unpackhi_epi16 (self.0, other.0)) } }
944 }
945 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_max_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epi16)\n\n\n * `PMAXSW xmm, xmm`\n </li>\n </ul>"]
946 #[inline(always)]
947 fn max(&self, other: I16x8) -> I16x8 {
948 select_impl_block! { scalar { I16x8::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm_max_epi16 (self.0, other.0)) } }
949 }
950 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_min_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epi16)\n\n\n * `PMINSW xmm, xmm`\n </li>\n </ul>"]
951 #[inline(always)]
952 fn min(&self, other: I16x8) -> I16x8 {
953 select_impl_block! { scalar { I16x8::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm_min_epi16 (self.0, other.0)) } }
954 }
955}
956impl crate::SimdBase16 for I16x8 {
957 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # {\n I16x8::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 8],\n self.as_array()[I1 + 0 * 8],\n self.as_array()[I2 + 0 * 8],\n self.as_array()[I3 + 0 * 8],\n self.as_array()[4 + 0 * 8],\n self.as_array()[5 + 0 * 8],\n self.as_array()[6 + 0 * 8],\n self.as_array()[7 + 0 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shufflelo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shufflelo_epi16)\n\n\n * `PSHUFLW xmm, xmm, imm8`\n </li>\n </ul>"]
958 #[inline(always)]
959 fn shuffle_lo<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
960 &self,
961 ) -> I16x8 {
962 select_impl_block! { scalar { I16x8::from([ self.as_array()[I0 + 0 * 8], self.as_array()[I1 + 0 * 8], self.as_array()[I2 + 0 * 8], self.as_array()[I3 + 0 * 8], self.as_array()[4 + 0 * 8], self.as_array()[5 + 0 * 8], self.as_array()[6 + 0 * 8], self.as_array()[7 + 0 * 8], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm_shufflelo_epi16 ::<I3, I2, I1, I0>(self.0)) } }
964 }
965 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x8\n # {\n I16x8::from([\n // 128-bit Lane #0\n self.as_array()[0 + 0 * 8],\n self.as_array()[1 + 0 * 8],\n self.as_array()[2 + 0 * 8],\n self.as_array()[3 + 0 * 8],\n self.as_array()[I0 + 4 + 0 * 8],\n self.as_array()[I1 + 4 + 0 * 8],\n self.as_array()[I2 + 4 + 0 * 8],\n self.as_array()[I3 + 4 + 0 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shufflehi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shufflehi_epi16)\n\n\n * `PSHUFHW xmm, xmm, imm8`\n </li>\n </ul>"]
966 #[inline(always)]
967 fn shuffle_hi<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
968 &self,
969 ) -> I16x8 {
970 select_impl_block! { scalar { I16x8::from([ self.as_array()[0 + 0 * 8], self.as_array()[1 + 0 * 8], self.as_array()[2 + 0 * 8], self.as_array()[3 + 0 * 8], self.as_array()[I0 + 4 + 0 * 8], self.as_array()[I1 + 4 + 0 * 8], self.as_array()[I2 + 4 + 0 * 8], self.as_array()[I3 + 4 + 0 * 8], ]) } avx2 { if I0 > 4 { panic!("I0 ({I0}) > 4"); } if I1 > 4 { panic!("I1 ({I1}) > 4"); } if I2 > 4 { panic!("I2 ({I2}) > 4"); } if I3 > 4 { panic!("I3 ({I3}) > 4"); } Self( avx2::_mm_shufflehi_epi16 ::<I3, I2, I1, I0>(self.0)) } }
972 }
973}
974impl crate::SimdBase8x for I16x8 {
975 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I16x8 ,\n # ) -> I16x8\n # ;}\n # impl SomeTraitForDoc for I16x8 {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I16x8 ,\n # ) -> I16x8\n # {\n I16x8::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n (if B4 { if_true } else { *self }).as_array()[4],\n (if B5 { if_true } else { *self }).as_array()[5],\n (if B6 { if_true } else { *self }).as_array()[6],\n (if B7 { if_true } else { *self }).as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_blend_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blend_epi16)\n\n\n * `PBLENDW xmm, xmm, imm8`\n </li>\n </ul>"]
976 #[inline(always)]
977 fn blend<
978 const B7: bool,
979 const B6: bool,
980 const B5: bool,
981 const B4: bool,
982 const B3: bool,
983 const B2: bool,
984 const B1: bool,
985 const B0: bool,
986 >(
987 &self,
988 if_true: I16x8,
989 ) -> I16x8 {
990 select_impl_block! { scalar { I16x8::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], (if B4 { if_true } else { *self }).as_array()[4], (if B5 { if_true } else { *self }).as_array()[5], (if B6 { if_true } else { *self }).as_array()[6], (if B7 { if_true } else { *self }).as_array()[7], ]) } avx2 { Self( avx2::_mm_blend_epi16 ::<B7, B6, B5, B4, B3, B2, B1, B0>(self.0, if_true.0)) } }
991 }
992}
993#[doc = "`[i16; 16]` as a vector."]
994#[repr(transparent)]
995#[derive(Clone, Copy)]
996pub struct I16x16(I16x16Internal);
997unsafe impl bytemuck::Pod for I16x16 {}
998unsafe impl bytemuck::Zeroable for I16x16 {}
999impl PartialEq for I16x16 {
1000 #[inline(always)]
1001 fn eq(&self, other: &Self) -> bool {
1002 ((*self) ^ (*other)).is_zero()
1003 }
1004}
1005impl Eq for I16x16 {}
1006impl Default for I16x16 {
1007 #[doc = "The zero vector."]
1008 #[inline(always)]
1009 fn default() -> Self {
1010 Self::ZERO
1011 }
1012}
1013impl std::hash::Hash for I16x16 {
1014 #[inline]
1015 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1016 bytemuck::bytes_of(self).hash(state);
1017 }
1018}
1019impl std::fmt::Debug for I16x16 {
1020 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1021 write!(f, "I16x16({:?})", <[i16; 16]>::from(*self))
1022 }
1023}
1024impl subtle::ConstantTimeEq for I16x16 {
1025 fn ct_eq(&self, other: &Self) -> subtle::Choice {
1026 self.as_array().ct_eq(&other.as_array())
1027 }
1028}
1029impl subtle::ConditionallySelectable for I16x16 {
1030 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
1031 let mut out = [0; 16];
1032 for (out, (a, b)) in out
1033 .iter_mut()
1034 .zip(a.as_array().iter().zip(b.as_array().iter()))
1035 {
1036 *out = <i16 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
1037 }
1038 Self::from(out)
1039 }
1040}
1041impl rand::distributions::Distribution<I16x16> for rand::distributions::Standard {
1042 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I16x16 {
1043 let mut out = I16x16::ZERO;
1044 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
1045 out
1046 }
1047}
1048impl AsRef<[i16]> for I16x16 {
1049 fn as_ref(&self) -> &[i16] {
1050 let arr: &[i16; 16] = bytemuck::cast_ref(self);
1051 arr
1052 }
1053}
1054impl AsMut<[i16]> for I16x16 {
1055 fn as_mut(&mut self) -> &mut [i16] {
1056 let arr: &mut [i16; 16] = bytemuck::cast_mut(self);
1057 arr
1058 }
1059}
1060impl From<I8x32> for I16x16 {
1061 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x32\nas little endian bits of I16x16."]
1062 #[inline(always)]
1063 fn from(x: I8x32) -> I16x16 {
1064 Self({
1065 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1067 })
1068 }
1069}
1070impl From<I32x8> for I16x16 {
1071 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x8\nas little endian bits of I16x16."]
1072 #[inline(always)]
1073 fn from(x: I32x8) -> I16x16 {
1074 Self({
1075 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1077 })
1078 }
1079}
1080impl From<I64x4> for I16x16 {
1081 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x4\nas little endian bits of I16x16."]
1082 #[inline(always)]
1083 fn from(x: I64x4) -> I16x16 {
1084 Self({
1085 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1087 })
1088 }
1089}
1090impl From<U8x32> for I16x16 {
1091 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x32\nas little endian bits of I16x16."]
1092 #[inline(always)]
1093 fn from(x: U8x32) -> I16x16 {
1094 Self({
1095 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1097 })
1098 }
1099}
1100impl From<U16x16> for I16x16 {
1101 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x16\nas little endian bits of I16x16."]
1102 #[inline(always)]
1103 fn from(x: U16x16) -> I16x16 {
1104 Self({
1105 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1107 })
1108 }
1109}
1110impl From<U32x8> for I16x16 {
1111 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x8\nas little endian bits of I16x16."]
1112 #[inline(always)]
1113 fn from(x: U32x8) -> I16x16 {
1114 Self({
1115 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1117 })
1118 }
1119}
1120impl From<U64x4> for I16x16 {
1121 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x4\nas little endian bits of I16x16."]
1122 #[inline(always)]
1123 fn from(x: U64x4) -> I16x16 {
1124 Self({
1125 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1127 })
1128 }
1129}
1130impl From<I8x16> for I16x16 {
1131 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n i16::from(vector.as_array()[0]),\n i16::from(vector.as_array()[1]),\n i16::from(vector.as_array()[2]),\n i16::from(vector.as_array()[3]),\n i16::from(vector.as_array()[4]),\n i16::from(vector.as_array()[5]),\n i16::from(vector.as_array()[6]),\n i16::from(vector.as_array()[7]),\n i16::from(vector.as_array()[8]),\n i16::from(vector.as_array()[9]),\n i16::from(vector.as_array()[10]),\n i16::from(vector.as_array()[11]),\n i16::from(vector.as_array()[12]),\n i16::from(vector.as_array()[13]),\n i16::from(vector.as_array()[14]),\n i16::from(vector.as_array()[15]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi8_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi8_epi16)\n\n\n * `VPMOVSXBW ymm, xmm`\n </li>\n </ul>"]
1132 #[inline(always)]
1133 fn from(vector: I8x16) -> I16x16 {
1134 select_impl_block! { scalar { I16x16::from([ i16::from(vector.as_array()[0]), i16::from(vector.as_array()[1]), i16::from(vector.as_array()[2]), i16::from(vector.as_array()[3]), i16::from(vector.as_array()[4]), i16::from(vector.as_array()[5]), i16::from(vector.as_array()[6]), i16::from(vector.as_array()[7]), i16::from(vector.as_array()[8]), i16::from(vector.as_array()[9]), i16::from(vector.as_array()[10]), i16::from(vector.as_array()[11]), i16::from(vector.as_array()[12]), i16::from(vector.as_array()[13]), i16::from(vector.as_array()[14]), i16::from(vector.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_cvtepi8_epi16 (vector.0)) } }
1135 }
1136}
1137impl crate::ExtendingCast<I8x16> for I16x16 {
1138 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n i16::from(vector.as_array()[0]),\n i16::from(vector.as_array()[1]),\n i16::from(vector.as_array()[2]),\n i16::from(vector.as_array()[3]),\n i16::from(vector.as_array()[4]),\n i16::from(vector.as_array()[5]),\n i16::from(vector.as_array()[6]),\n i16::from(vector.as_array()[7]),\n i16::from(vector.as_array()[8]),\n i16::from(vector.as_array()[9]),\n i16::from(vector.as_array()[10]),\n i16::from(vector.as_array()[11]),\n i16::from(vector.as_array()[12]),\n i16::from(vector.as_array()[13]),\n i16::from(vector.as_array()[14]),\n i16::from(vector.as_array()[15]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi8_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi8_epi16)\n\n\n * `VPMOVSXBW ymm, xmm`\n </li>\n </ul>"]
1139 #[inline(always)]
1140 fn extending_cast_from(vector: I8x16) -> I16x16 {
1141 select_impl_block! { scalar { I16x16::from([ i16::from(vector.as_array()[0]), i16::from(vector.as_array()[1]), i16::from(vector.as_array()[2]), i16::from(vector.as_array()[3]), i16::from(vector.as_array()[4]), i16::from(vector.as_array()[5]), i16::from(vector.as_array()[6]), i16::from(vector.as_array()[7]), i16::from(vector.as_array()[8]), i16::from(vector.as_array()[9]), i16::from(vector.as_array()[10]), i16::from(vector.as_array()[11]), i16::from(vector.as_array()[12]), i16::from(vector.as_array()[13]), i16::from(vector.as_array()[14]), i16::from(vector.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_cvtepi8_epi16 (vector.0)) } }
1142 }
1143}
1144impl From<I16x8> for I16x16 {
1145 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I16x16\n # {\n let mut out = [0; 16];\n out[0..8].copy_from_slice(&vector.as_array());\n I16x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
1146 #[inline(always)]
1147 fn from(vector: I16x8) -> I16x16 {
1148 select_impl_block! { scalar { let mut out = [0; 16]; out[0..8].copy_from_slice(&vector.as_array()); I16x16::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
1149 }
1150}
1151impl From<[I16x8; 2]> for I16x16 {
1152 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [I16x8; 2] ,\n # ) -> I16x16\n # {\n let mut out = [0; 16];\n out[0..8].copy_from_slice(&vectors[0].as_array());\n out[8..].copy_from_slice(&vectors[1].as_array());\n I16x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
1153 #[inline(always)]
1154 fn from(vectors: [I16x8; 2]) -> I16x16 {
1155 select_impl_block! { scalar { let mut out = [0; 16]; out[0..8].copy_from_slice(&vectors[0].as_array()); out[8..].copy_from_slice(&vectors[1].as_array()); I16x16::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
1156 }
1157} impl From<I16x16> for [I16x8; 2] {
1159 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x16 ,\n # ) -> [I16x8; 2]\n # {\n let mut lo = [0; 8];\n let mut hi = [0; 8];\n lo.copy_from_slice(&vector.as_array()[0..8]);\n hi.copy_from_slice(&vector.as_array()[8..]);\n [I16x8::from(lo), I16x8::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
1160 #[inline(always)]
1161 fn from(vector: I16x16) -> [I16x8; 2] {
1162 select_impl_block! { scalar { let mut lo = [0; 8]; let mut hi = [0; 8]; lo.copy_from_slice(&vector.as_array()[0..8]); hi.copy_from_slice(&vector.as_array()[8..]); [I16x8::from(lo), I16x8::from(hi)] } avx2 { [ I16x8( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), I16x8( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
1163 }
1164}
1165impl crate::SimdSaturatingArithmetic for I16x16 {
1166 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_adds_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_adds_epi16)\n\n\n * `VPADDSW ymm, ymm, ymm`\n </li>\n </ul>"]
1167 #[inline(always)]
1168 fn saturating_add(&self, other: I16x16) -> I16x16 {
1169 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_adds_epi16 (self.0, other.0)) } }
1170 }
1171 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_subs_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_subs_epi16)\n\n\n * `VPSUBSW ymm, ymm, ymm`\n </li>\n </ul>"]
1172 #[inline(always)]
1173 fn saturating_sub(&self, other: I16x16) -> I16x16 {
1174 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_subs_epi16 (self.0, other.0)) } }
1175 }
1176} impl ShlAssign<u64> for I16x16 {
1178 #[inline(always)]
1179 fn shl_assign(&mut self, amount: u64) {
1180 *self = (*self) << amount;
1181 }
1182}
1183impl Shl<u64> for I16x16 {
1184 type Output = Self;
1185 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x16\n # {\n if amount >= 16 {\n I16x16::ZERO\n } else {\n I16x16::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n self.as_array()[8] << amount,\n self.as_array()[9] << amount,\n self.as_array()[10] << amount,\n self.as_array()[11] << amount,\n self.as_array()[12] << amount,\n self.as_array()[13] << amount,\n self.as_array()[14] << amount,\n self.as_array()[15] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sll_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sll_epi16)\n\n\n * `VPSLLW ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1186 #[inline(always)]
1187 fn shl(self, amount: u64) -> I16x16 {
1188 select_impl_block! { scalar { if amount >= 16 { I16x16::ZERO } else { I16x16::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_sll_epi16 (self.0, amount)) } }
1189 }
1190} impl ShlAssign<I16x16> for I16x16 {
1192 #[inline(always)]
1193 fn shl_assign(&mut self, amount: I16x16) {
1194 *self = (*self) << amount;
1195 }
1196}
1197impl Shl<I16x16> for I16x16 {
1198 type Output = Self;
1199 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x16 ,\n # ) -> I16x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I16x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
1200 #[inline(always)]
1201 fn shl(self, amount: I16x16) -> I16x16 {
1202 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } I16x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } I16x16::from(out) } }
1203 }
1204} impl ShrAssign<u64> for I16x16 {
1206 #[inline(always)]
1207 fn shr_assign(&mut self, amount: u64) {
1208 *self = (*self) >> amount;
1209 }
1210}
1211impl Shr<u64> for I16x16 {
1212 type Output = Self;
1213 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I16x16\n # {\n if amount >= 16 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I16x16::from(out)\n } else {\n I16x16::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n self.as_array()[8] >> amount,\n self.as_array()[9] >> amount,\n self.as_array()[10] >> amount,\n self.as_array()[11] >> amount,\n self.as_array()[12] >> amount,\n self.as_array()[13] >> amount,\n self.as_array()[14] >> amount,\n self.as_array()[15] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sra_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sra_epi16)\n\n\n * `VPSRAW ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1214 #[inline(always)]
1215 fn shr(self, amount: u64) -> I16x16 {
1216 select_impl_block! { scalar { if amount >= 16 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I16x16::from(out) } else { I16x16::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_sra_epi16 (self.0, amount)) } }
1217 }
1218} impl ShrAssign<I16x16> for I16x16 {
1220 #[inline(always)]
1221 fn shr_assign(&mut self, amount: I16x16) {
1222 *self = (*self) >> amount;
1223 }
1224}
1225impl Shr<I16x16> for I16x16 {
1226 type Output = Self;
1227 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I16x16 ,\n # ) -> I16x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I16x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
1228 #[inline(always)]
1229 fn shr(self, amount: I16x16) -> I16x16 {
1230 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I16x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I16x16::from(out) } }
1231 }
1232}
1233impl SimdBase for I16x16 {
1234 type Scalar = i16;
1235 type Array = [i16; 16];
1236 type Signed = I16x16;
1237 type Unsigned = U16x16;
1238 const LANES: usize = 16;
1239 const ZERO: Self = Self::from_array([0; 16]);
1240 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
1241 #[inline(always)]
1242 fn is_zero(&self) -> bool {
1243 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
1244 }
1245 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i16 ,\n # ) -> I16x16\n # {\n let mut out = [0; 16];\n out[0] = scalar;\n I16x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1246 #[inline(always)]
1247 fn set_lo(scalar: i16) -> I16x16 {
1248 select_impl_block! { scalar { let mut out = [0; 16]; out[0] = scalar; I16x16::from(out) } avx2 { Self( avx2::_mm256_set_epi16 ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, scalar as i16, )) } }
1249 }
1250 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i16\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1251 #[inline(always)]
1252 fn extract<const I: usize>(&self) -> i16 {
1253 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi16 ::<I>(self.0) as i16 } }
1254 }
1255 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i16 ,\n # ) -> I16x16\n # {\n I16x16::from([scalar; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1256 #[inline(always)]
1257 fn broadcast(scalar: i16) -> I16x16 {
1258 select_impl_block! { scalar { I16x16::from([scalar; 16]) } avx2 { Self( avx2::_mm256_set1_epi16 (scalar as i16)) } }
1259 }
1260 type BroadcastLoInput = I16x8;
1261 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I16x16\n # {\n I16x16::from([vector.as_array()[0]; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastw_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastw_epi16)\n\n\n * `VPBROADCASTW ymm, xmm`\n </li>\n </ul>"]
1262 #[inline(always)]
1263 fn broadcast_lo(vector: I16x8) -> I16x16 {
1264 select_impl_block! { scalar { I16x16::from([vector.as_array()[0]; 16]) } avx2 { Self( avx2::_mm256_broadcastw_epi16 (vector.0)) } }
1265 }
1266 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 },\n if self.as_array()[8] == other.as_array()[8] { -1 } else { 0 },\n if self.as_array()[9] == other.as_array()[9] { -1 } else { 0 },\n if self.as_array()[10] == other.as_array()[10] { -1 } else { 0 },\n if self.as_array()[11] == other.as_array()[11] { -1 } else { 0 },\n if self.as_array()[12] == other.as_array()[12] { -1 } else { 0 },\n if self.as_array()[13] == other.as_array()[13] { -1 } else { 0 },\n if self.as_array()[14] == other.as_array()[14] { -1 } else { 0 },\n if self.as_array()[15] == other.as_array()[15] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi16)\n\n\n * `VPCMPEQW ymm, ymm, ymm`\n </li>\n </ul>"]
1267 #[inline(always)]
1268 fn cmp_eq(&self, other: I16x16) -> I16x16 {
1269 select_impl_block! { scalar { I16x16::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 }, if self.as_array()[8] == other.as_array()[8] { -1 } else { 0 }, if self.as_array()[9] == other.as_array()[9] { -1 } else { 0 }, if self.as_array()[10] == other.as_array()[10] { -1 } else { 0 }, if self.as_array()[11] == other.as_array()[11] { -1 } else { 0 }, if self.as_array()[12] == other.as_array()[12] { -1 } else { 0 }, if self.as_array()[13] == other.as_array()[13] { -1 } else { 0 }, if self.as_array()[14] == other.as_array()[14] { -1 } else { 0 }, if self.as_array()[15] == other.as_array()[15] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi16 (self.0, other.0)) } }
1270 }
1271 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n self.as_array()[8] & (!other.as_array()[8]),\n self.as_array()[9] & (!other.as_array()[9]),\n self.as_array()[10] & (!other.as_array()[10]),\n self.as_array()[11] & (!other.as_array()[11]),\n self.as_array()[12] & (!other.as_array()[12]),\n self.as_array()[13] & (!other.as_array()[13]),\n self.as_array()[14] & (!other.as_array()[14]),\n self.as_array()[15] & (!other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
1272 #[inline(always)]
1273 fn and_not(&self, other: I16x16) -> I16x16 {
1274 select_impl_block! { scalar { I16x16::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), self.as_array()[8] & (!other.as_array()[8]), self.as_array()[9] & (!other.as_array()[9]), self.as_array()[10] & (!other.as_array()[10]), self.as_array()[11] & (!other.as_array()[11]), self.as_array()[12] & (!other.as_array()[12]), self.as_array()[13] & (!other.as_array()[13]), self.as_array()[14] & (!other.as_array()[14]), self.as_array()[15] & (!other.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
1275 }
1276 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 },\n if self.as_array()[8] > other.as_array()[8] { -1 } else { 0 },\n if self.as_array()[9] > other.as_array()[9] { -1 } else { 0 },\n if self.as_array()[10] > other.as_array()[10] { -1 } else { 0 },\n if self.as_array()[11] > other.as_array()[11] { -1 } else { 0 },\n if self.as_array()[12] > other.as_array()[12] { -1 } else { 0 },\n if self.as_array()[13] > other.as_array()[13] { -1 } else { 0 },\n if self.as_array()[14] > other.as_array()[14] { -1 } else { 0 },\n if self.as_array()[15] > other.as_array()[15] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpgt_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpgt_epi16)\n\n\n * `VPCMPGTW ymm, ymm, ymm`\n </li>\n </ul>"]
1277 #[inline(always)]
1278 fn cmp_gt(&self, other: I16x16) -> I16x16 {
1279 select_impl_block! { scalar { I16x16::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 }, if self.as_array()[8] > other.as_array()[8] { -1 } else { 0 }, if self.as_array()[9] > other.as_array()[9] { -1 } else { 0 }, if self.as_array()[10] > other.as_array()[10] { -1 } else { 0 }, if self.as_array()[11] > other.as_array()[11] { -1 } else { 0 }, if self.as_array()[12] > other.as_array()[12] { -1 } else { 0 }, if self.as_array()[13] > other.as_array()[13] { -1 } else { 0 }, if self.as_array()[14] > other.as_array()[14] { -1 } else { 0 }, if self.as_array()[15] > other.as_array()[15] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpgt_epi16 (self.0, other.0)) } }
1280 }
1281 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I16x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_epi16)\n\n\n * `VPSLLW ymm, ymm, imm8`\n </li>\n </ul>"]
1282 #[inline(always)]
1283 fn shift_left<const BITS: usize>(&self) -> I16x16 {
1284 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I16x16::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_slli_epi16 ::<BITS>(self.0)) } }
1285 }
1286 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I16x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srai_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srai_epi16)\n\n\n * `VPSRAW ymm, ymm, imm8`\n </li>\n </ul>"]
1287 #[inline(always)]
1288 fn shift_right<const BITS: usize>(&self) -> I16x16 {
1289 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I16x16::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_srai_epi16 ::<BITS>(self.0)) } }
1290 }
1291 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n // Lane# 1\n self.as_array()[8],\n other.as_array()[8],\n self.as_array()[9],\n other.as_array()[9],\n self.as_array()[10],\n other.as_array()[10],\n self.as_array()[11],\n other.as_array()[11],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi16)\n\n\n * `VPUNPCKLWD ymm, ymm, ymm`\n </li>\n </ul>"]
1292 #[inline(always)]
1293 fn unpack_lo(&self, other: I16x16) -> I16x16 {
1294 select_impl_block! { scalar { I16x16::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[8], other.as_array()[8], self.as_array()[9], other.as_array()[9], self.as_array()[10], other.as_array()[10], self.as_array()[11], other.as_array()[11], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi16 (self.0, other.0)) } }
1297 }
1298 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n // Lane# 0\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n // Lane# 1\n self.as_array()[12],\n other.as_array()[12],\n self.as_array()[13],\n other.as_array()[13],\n self.as_array()[14],\n other.as_array()[14],\n self.as_array()[15],\n other.as_array()[15],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi16)\n\n\n * `VPUNPCKHWD ymm, ymm, ymm`\n </li>\n </ul>"]
1299 #[inline(always)]
1300 fn unpack_hi(&self, other: I16x16) -> I16x16 {
1301 select_impl_block! { scalar { I16x16::from([ self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], self.as_array()[12], other.as_array()[12], self.as_array()[13], other.as_array()[13], self.as_array()[14], other.as_array()[14], self.as_array()[15], other.as_array()[15], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi16 (self.0, other.0)) } }
1304 }
1305 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n self.as_array()[8].max(other.as_array()[8]),\n self.as_array()[9].max(other.as_array()[9]),\n self.as_array()[10].max(other.as_array()[10]),\n self.as_array()[11].max(other.as_array()[11]),\n self.as_array()[12].max(other.as_array()[12]),\n self.as_array()[13].max(other.as_array()[13]),\n self.as_array()[14].max(other.as_array()[14]),\n self.as_array()[15].max(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_max_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_max_epi16)\n\n\n * `VPMAXSW ymm, ymm, ymm`\n </li>\n </ul>"]
1306 #[inline(always)]
1307 fn max(&self, other: I16x16) -> I16x16 {
1308 select_impl_block! { scalar { I16x16::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), self.as_array()[8].max(other.as_array()[8]), self.as_array()[9].max(other.as_array()[9]), self.as_array()[10].max(other.as_array()[10]), self.as_array()[11].max(other.as_array()[11]), self.as_array()[12].max(other.as_array()[12]), self.as_array()[13].max(other.as_array()[13]), self.as_array()[14].max(other.as_array()[14]), self.as_array()[15].max(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_max_epi16 (self.0, other.0)) } }
1309 }
1310 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I16x16 ,\n # ) -> I16x16\n # {\n I16x16::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n self.as_array()[8].min(other.as_array()[8]),\n self.as_array()[9].min(other.as_array()[9]),\n self.as_array()[10].min(other.as_array()[10]),\n self.as_array()[11].min(other.as_array()[11]),\n self.as_array()[12].min(other.as_array()[12]),\n self.as_array()[13].min(other.as_array()[13]),\n self.as_array()[14].min(other.as_array()[14]),\n self.as_array()[15].min(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_min_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_min_epi16)\n\n\n * `VPMINSW ymm, ymm, ymm`\n </li>\n </ul>"]
1311 #[inline(always)]
1312 fn min(&self, other: I16x16) -> I16x16 {
1313 select_impl_block! { scalar { I16x16::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), self.as_array()[8].min(other.as_array()[8]), self.as_array()[9].min(other.as_array()[9]), self.as_array()[10].min(other.as_array()[10]), self.as_array()[11].min(other.as_array()[11]), self.as_array()[12].min(other.as_array()[12]), self.as_array()[13].min(other.as_array()[13]), self.as_array()[14].min(other.as_array()[14]), self.as_array()[15].min(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_min_epi16 (self.0, other.0)) } }
1314 }
1315}
1316impl crate::SimdBase16 for I16x16 {
1317 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # {\n I16x16::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 8],\n self.as_array()[I1 + 0 * 8],\n self.as_array()[I2 + 0 * 8],\n self.as_array()[I3 + 0 * 8],\n self.as_array()[4 + 0 * 8],\n self.as_array()[5 + 0 * 8],\n self.as_array()[6 + 0 * 8],\n self.as_array()[7 + 0 * 8],\n // 128-bit Lane #1\n self.as_array()[I0 + 1 * 8],\n self.as_array()[I1 + 1 * 8],\n self.as_array()[I2 + 1 * 8],\n self.as_array()[I3 + 1 * 8],\n self.as_array()[4 + 1 * 8],\n self.as_array()[5 + 1 * 8],\n self.as_array()[6 + 1 * 8],\n self.as_array()[7 + 1 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shufflelo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shufflelo_epi16)\n\n\n * `VPSHUFLW ymm, ymm, imm8`\n </li>\n </ul>"]
1318 #[inline(always)]
1319 fn shuffle_lo<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
1320 &self,
1321 ) -> I16x16 {
1322 select_impl_block! { scalar { I16x16::from([ self.as_array()[I0 + 0 * 8], self.as_array()[I1 + 0 * 8], self.as_array()[I2 + 0 * 8], self.as_array()[I3 + 0 * 8], self.as_array()[4 + 0 * 8], self.as_array()[5 + 0 * 8], self.as_array()[6 + 0 * 8], self.as_array()[7 + 0 * 8], self.as_array()[I0 + 1 * 8], self.as_array()[I1 + 1 * 8], self.as_array()[I2 + 1 * 8], self.as_array()[I3 + 1 * 8], self.as_array()[4 + 1 * 8], self.as_array()[5 + 1 * 8], self.as_array()[6 + 1 * 8], self.as_array()[7 + 1 * 8], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm256_shufflelo_epi16 ::<I3, I2, I1, I0>(self.0)) } }
1325 }
1326 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # ;}\n # impl SomeTraitForDoc for I16x16 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I16x16\n # {\n I16x16::from([\n // 128-bit Lane #0\n self.as_array()[0 + 0 * 8],\n self.as_array()[1 + 0 * 8],\n self.as_array()[2 + 0 * 8],\n self.as_array()[3 + 0 * 8],\n self.as_array()[I0 + 4 + 0 * 8],\n self.as_array()[I1 + 4 + 0 * 8],\n self.as_array()[I2 + 4 + 0 * 8],\n self.as_array()[I3 + 4 + 0 * 8],\n // 128-bit Lane #1\n self.as_array()[0 + 1 * 8],\n self.as_array()[1 + 1 * 8],\n self.as_array()[2 + 1 * 8],\n self.as_array()[3 + 1 * 8],\n self.as_array()[I0 + 4 + 1 * 8],\n self.as_array()[I1 + 4 + 1 * 8],\n self.as_array()[I2 + 4 + 1 * 8],\n self.as_array()[I3 + 4 + 1 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shufflehi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shufflehi_epi16)\n\n\n * `VPSHUFHW ymm, ymm, imm8`\n </li>\n </ul>"]
1327 #[inline(always)]
1328 fn shuffle_hi<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
1329 &self,
1330 ) -> I16x16 {
1331 select_impl_block! { scalar { I16x16::from([ self.as_array()[0 + 0 * 8], self.as_array()[1 + 0 * 8], self.as_array()[2 + 0 * 8], self.as_array()[3 + 0 * 8], self.as_array()[I0 + 4 + 0 * 8], self.as_array()[I1 + 4 + 0 * 8], self.as_array()[I2 + 4 + 0 * 8], self.as_array()[I3 + 4 + 0 * 8], self.as_array()[0 + 1 * 8], self.as_array()[1 + 1 * 8], self.as_array()[2 + 1 * 8], self.as_array()[3 + 1 * 8], self.as_array()[I0 + 4 + 1 * 8], self.as_array()[I1 + 4 + 1 * 8], self.as_array()[I2 + 4 + 1 * 8], self.as_array()[I3 + 4 + 1 * 8], ]) } avx2 { if I0 > 4 { panic!("I0 ({I0}) > 4"); } if I1 > 4 { panic!("I1 ({I1}) > 4"); } if I2 > 4 { panic!("I2 ({I2}) > 4"); } if I3 > 4 { panic!("I3 ({I3}) > 4"); } Self( avx2::_mm256_shufflehi_epi16 ::<I3, I2, I1, I0>(self.0)) } }
1334 }
1335}
1336#[doc = "`[i32; 4]` as a vector."]
1337#[repr(transparent)]
1338#[derive(Clone, Copy)]
1339pub struct I32x4(I32x4Internal);
1340unsafe impl bytemuck::Pod for I32x4 {}
1341unsafe impl bytemuck::Zeroable for I32x4 {}
1342impl PartialEq for I32x4 {
1343 #[inline(always)]
1344 fn eq(&self, other: &Self) -> bool {
1345 ((*self) ^ (*other)).is_zero()
1346 }
1347}
1348impl Eq for I32x4 {}
1349impl Default for I32x4 {
1350 #[doc = "The zero vector."]
1351 #[inline(always)]
1352 fn default() -> Self {
1353 Self::ZERO
1354 }
1355}
1356impl std::hash::Hash for I32x4 {
1357 #[inline]
1358 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1359 bytemuck::bytes_of(self).hash(state);
1360 }
1361}
1362impl std::fmt::Debug for I32x4 {
1363 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1364 write!(f, "I32x4({:?})", <[i32; 4]>::from(*self))
1365 }
1366}
1367impl subtle::ConstantTimeEq for I32x4 {
1368 fn ct_eq(&self, other: &Self) -> subtle::Choice {
1369 self.as_array().ct_eq(&other.as_array())
1370 }
1371}
1372impl subtle::ConditionallySelectable for I32x4 {
1373 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
1374 let mut out = [0; 4];
1375 for (out, (a, b)) in out
1376 .iter_mut()
1377 .zip(a.as_array().iter().zip(b.as_array().iter()))
1378 {
1379 *out = <i32 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
1380 }
1381 Self::from(out)
1382 }
1383}
1384impl rand::distributions::Distribution<I32x4> for rand::distributions::Standard {
1385 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I32x4 {
1386 let mut out = I32x4::ZERO;
1387 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
1388 out
1389 }
1390}
1391impl AsRef<[i32]> for I32x4 {
1392 fn as_ref(&self) -> &[i32] {
1393 let arr: &[i32; 4] = bytemuck::cast_ref(self);
1394 arr
1395 }
1396}
1397impl AsMut<[i32]> for I32x4 {
1398 fn as_mut(&mut self) -> &mut [i32] {
1399 let arr: &mut [i32; 4] = bytemuck::cast_mut(self);
1400 arr
1401 }
1402}
1403impl From<I8x16> for I32x4 {
1404 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x16\nas little endian bits of I32x4."]
1405 #[inline(always)]
1406 fn from(x: I8x16) -> I32x4 {
1407 Self({
1408 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1410 })
1411 }
1412}
1413impl From<I16x8> for I32x4 {
1414 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x8\nas little endian bits of I32x4."]
1415 #[inline(always)]
1416 fn from(x: I16x8) -> I32x4 {
1417 Self({
1418 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1420 })
1421 }
1422}
1423impl From<I64x2> for I32x4 {
1424 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x2\nas little endian bits of I32x4."]
1425 #[inline(always)]
1426 fn from(x: I64x2) -> I32x4 {
1427 Self({
1428 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1430 })
1431 }
1432}
1433impl From<U8x16> for I32x4 {
1434 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x16\nas little endian bits of I32x4."]
1435 #[inline(always)]
1436 fn from(x: U8x16) -> I32x4 {
1437 Self({
1438 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1440 })
1441 }
1442}
1443impl From<U16x8> for I32x4 {
1444 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x8\nas little endian bits of I32x4."]
1445 #[inline(always)]
1446 fn from(x: U16x8) -> I32x4 {
1447 Self({
1448 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1450 })
1451 }
1452}
1453impl From<U32x4> for I32x4 {
1454 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x4\nas little endian bits of I32x4."]
1455 #[inline(always)]
1456 fn from(x: U32x4) -> I32x4 {
1457 Self({
1458 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1460 })
1461 }
1462}
1463impl From<U64x2> for I32x4 {
1464 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x2\nas little endian bits of I32x4."]
1465 #[inline(always)]
1466 fn from(x: U64x2) -> I32x4 {
1467 Self({
1468 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1470 })
1471 }
1472}
1473impl crate::ExtendingCast<I8x16> for I32x4 {
1474 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I32x4\n # {\n I32x4::from([\n i32::from(vector.as_array()[0]),\n i32::from(vector.as_array()[1]),\n i32::from(vector.as_array()[2]),\n i32::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepi8_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepi8_epi32)\n\n\n * `PMOVSXBD xmm, xmm`\n </li>\n </ul>"]
1475 #[inline(always)]
1476 fn extending_cast_from(vector: I8x16) -> I32x4 {
1477 select_impl_block! { scalar { I32x4::from([ i32::from(vector.as_array()[0]), i32::from(vector.as_array()[1]), i32::from(vector.as_array()[2]), i32::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm_cvtepi8_epi32 (vector.0)) } }
1478 }
1479}
1480impl crate::ExtendingCast<I16x8> for I32x4 {
1481 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I32x4\n # {\n I32x4::from([\n i32::from(vector.as_array()[0]),\n i32::from(vector.as_array()[1]),\n i32::from(vector.as_array()[2]),\n i32::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepi16_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepi16_epi32)\n\n\n * `PMOVSXWD xmm, xmm`\n </li>\n </ul>"]
1482 #[inline(always)]
1483 fn extending_cast_from(vector: I16x8) -> I32x4 {
1484 select_impl_block! { scalar { I32x4::from([ i32::from(vector.as_array()[0]), i32::from(vector.as_array()[1]), i32::from(vector.as_array()[2]), i32::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm_cvtepi16_epi32 (vector.0)) } }
1485 }
1486}
1487#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
1488impl crate::SimdBaseGatherable<I32x4> for I32x4 {
1489 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_i32gather_epi32)\n\n\n * `VPGATHERDD xmm, vm32x, xmm`\n </li>\n </ul>"]
1490 #[inline(always)]
1491 unsafe fn gather(base: *const i32, indices: I32x4) -> I32x4 {
1492 select_impl_block! { scalar { I32x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm_i32gather_epi32 ::<4>(base as *const i32, indices.0)) } }
1493 }
1494 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : I32x4 ,\n # mask : I32x4 ,\n # src : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n if ((mask.as_array()[0] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if ((mask.as_array()[2] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if ((mask.as_array()[3] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mask_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i32gather_epi32)\n\n\n * `VPGATHERDD xmm, vm32x, xmm`\n </li>\n </ul>"]
1495 #[inline(always)]
1496 unsafe fn gather_masked(base: *const i32, indices: I32x4, mask: I32x4, src: I32x4) -> I32x4 {
1497 select_impl_block! { scalar { I32x4::from([ if ((mask.as_array()[0] as u32) >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u32) >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if ((mask.as_array()[2] as u32) >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if ((mask.as_array()[3] as u32) >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm_mask_i32gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
1498 }
1499}
1500#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
1501impl crate::SimdBaseGatherable<U64x4> for I32x4 {
1502 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : U64x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
1503 #[inline(always)]
1504 unsafe fn gather(base: *const i32, indices: U64x4) -> I32x4 {
1505 select_impl_block! { scalar { I32x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi32 ::<4>(base as *const i32, indices.0)) } }
1506 }
1507 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : U64x4 ,\n # mask : I32x4 ,\n # src : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n if ((mask.as_array()[0] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if ((mask.as_array()[2] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if ((mask.as_array()[3] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
1508 #[inline(always)]
1509 unsafe fn gather_masked(base: *const i32, indices: U64x4, mask: I32x4, src: I32x4) -> I32x4 {
1510 select_impl_block! { scalar { I32x4::from([ if ((mask.as_array()[0] as u32) >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u32) >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if ((mask.as_array()[2] as u32) >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if ((mask.as_array()[3] as u32) >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
1511 }
1512}
1513#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
1514impl crate::SimdBaseGatherable<I64x4> for I32x4 {
1515 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : I64x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
1516 #[inline(always)]
1517 unsafe fn gather(base: *const i32, indices: I64x4) -> I32x4 {
1518 select_impl_block! { scalar { I32x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi32 ::<4>(base as *const i32, indices.0)) } }
1519 }
1520 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : I64x4 ,\n # mask : I32x4 ,\n # src : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n if ((mask.as_array()[0] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if ((mask.as_array()[2] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if ((mask.as_array()[3] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
1521 #[inline(always)]
1522 unsafe fn gather_masked(base: *const i32, indices: I64x4, mask: I32x4, src: I32x4) -> I32x4 {
1523 select_impl_block! { scalar { I32x4::from([ if ((mask.as_array()[0] as u32) >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u32) >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if ((mask.as_array()[2] as u32) >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if ((mask.as_array()[3] as u32) >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
1524 }
1525} impl ShlAssign<u64> for I32x4 {
1527 #[inline(always)]
1528 fn shl_assign(&mut self, amount: u64) {
1529 *self = (*self) << amount;
1530 }
1531}
1532impl Shl<u64> for I32x4 {
1533 type Output = Self;
1534 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x4\n # {\n if amount >= 32 {\n I32x4::ZERO\n } else {\n I32x4::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_sll_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi32)\n\n\n * `PSLLD xmm, xmm`\n </li>\n </ul>"]
1535 #[inline(always)]
1536 fn shl(self, amount: u64) -> I32x4 {
1537 select_impl_block! { scalar { if amount >= 32 { I32x4::ZERO } else { I32x4::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_sll_epi32 (self.0, amount)) } }
1538 }
1539} impl ShlAssign<I32x4> for I32x4 {
1541 #[inline(always)]
1542 fn shl_assign(&mut self, amount: I32x4) {
1543 *self = (*self) << amount;
1544 }
1545}
1546impl Shl<I32x4> for I32x4 {
1547 type Output = Self;
1548 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x4 ,\n # ) -> I32x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_sllv_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sllv_epi32)\n\n\n * `VPSLLVD xmm, xmm, xmm`\n </li>\n </ul>"]
1549 #[inline(always)]
1550 fn shl(self, amount: I32x4) -> I32x4 {
1551 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x << amm } else { 0 }; } I32x4::from(out) } avx2 { Self( avx2::_mm_sllv_epi32 (self.0, amount.0)) } }
1552 }
1553} impl ShrAssign<u64> for I32x4 {
1555 #[inline(always)]
1556 fn shr_assign(&mut self, amount: u64) {
1557 *self = (*self) >> amount;
1558 }
1559}
1560impl Shr<u64> for I32x4 {
1561 type Output = Self;
1562 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x4\n # {\n if amount >= 32 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I32x4::from(out)\n } else {\n I32x4::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_sra_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sra_epi32)\n\n\n * `PSRAD xmm, xmm`\n </li>\n </ul>"]
1563 #[inline(always)]
1564 fn shr(self, amount: u64) -> I32x4 {
1565 select_impl_block! { scalar { if amount >= 32 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I32x4::from(out) } else { I32x4::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_sra_epi32 (self.0, amount)) } }
1566 }
1567} impl ShrAssign<I32x4> for I32x4 {
1569 #[inline(always)]
1570 fn shr_assign(&mut self, amount: I32x4) {
1571 *self = (*self) >> amount;
1572 }
1573}
1574impl Shr<I32x4> for I32x4 {
1575 type Output = Self;
1576 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x4 ,\n # ) -> I32x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srav_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srav_epi32)\n\n\n * `VPSRAVD xmm, xmm, xmm`\n </li>\n </ul>"]
1577 #[inline(always)]
1578 fn shr(self, amount: I32x4) -> I32x4 {
1579 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I32x4::from(out) } avx2 { Self( avx2::_mm_srav_epi32 (self.0, amount.0)) } }
1580 }
1581}
1582impl SimdBase for I32x4 {
1583 type Scalar = i32;
1584 type Array = [i32; 4];
1585 type Signed = I32x4;
1586 type Unsigned = U32x4;
1587 const LANES: usize = 4;
1588 const ZERO: Self = Self::from_array([0; 4]);
1589 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
1590 #[inline(always)]
1591 fn is_zero(&self) -> bool {
1592 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
1593 }
1594 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i32 ,\n # ) -> I32x4\n # {\n let mut out = [0; 4];\n out[0] = scalar;\n I32x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1595 #[inline(always)]
1596 fn set_lo(scalar: i32) -> I32x4 {
1597 select_impl_block! { scalar { let mut out = [0; 4]; out[0] = scalar; I32x4::from(out) } avx2 { Self( avx2::_mm_set_epi32 ( 0, 0, 0, scalar as i32, )) } }
1598 }
1599 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i32\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i32\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi32)\n\n\n * `PEXTRD r32, xmm, imm8`\n </li>\n </ul>"]
1600 #[inline(always)]
1601 fn extract<const I: usize>(&self) -> i32 {
1602 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi32 ::<I>(self.0) as i32 } }
1603 }
1604 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i32 ,\n # ) -> I32x4\n # {\n I32x4::from([scalar; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1605 #[inline(always)]
1606 fn broadcast(scalar: i32) -> I32x4 {
1607 select_impl_block! { scalar { I32x4::from([scalar; 4]) } avx2 { Self( avx2::_mm_set1_epi32 (scalar as i32)) } }
1608 }
1609 type BroadcastLoInput = I32x4;
1610 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([vector.as_array()[0]; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastd_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastd_epi32)\n\n\n * `VPBROADCASTD xmm, xmm`\n </li>\n </ul>"]
1611 #[inline(always)]
1612 fn broadcast_lo(vector: I32x4) -> I32x4 {
1613 select_impl_block! { scalar { I32x4::from([vector.as_array()[0]; 4]) } avx2 { Self( avx2::_mm_broadcastd_epi32 (vector.0)) } }
1614 }
1615 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi32)\n\n\n * `PCMPEQD xmm, xmm`\n </li>\n </ul>"]
1616 #[inline(always)]
1617 fn cmp_eq(&self, other: I32x4) -> I32x4 {
1618 select_impl_block! { scalar { I32x4::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi32 (self.0, other.0)) } }
1619 }
1620 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
1621 #[inline(always)]
1622 fn and_not(&self, other: I32x4) -> I32x4 {
1623 select_impl_block! { scalar { I32x4::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
1624 }
1625 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpgt_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpgt_epi32)\n\n\n * `PCMPGTD xmm, xmm`\n </li>\n </ul>"]
1626 #[inline(always)]
1627 fn cmp_gt(&self, other: I32x4) -> I32x4 {
1628 select_impl_block! { scalar { I32x4::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpgt_epi32 (self.0, other.0)) } }
1629 }
1630 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi32)\n\n\n * `PSLLD xmm, imm8`\n </li>\n </ul>"]
1631 #[inline(always)]
1632 fn shift_left<const BITS: usize>(&self) -> I32x4 {
1633 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I32x4::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_slli_epi32 ::<BITS>(self.0)) } }
1634 }
1635 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srai_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srai_epi32)\n\n\n * `PSRAD xmm, imm8`\n </li>\n </ul>"]
1636 #[inline(always)]
1637 fn shift_right<const BITS: usize>(&self) -> I32x4 {
1638 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I32x4::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_srai_epi32 ::<BITS>(self.0)) } }
1639 }
1640 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi32)\n\n\n * `PUNPCKLDQ xmm, xmm`\n </li>\n </ul>"]
1641 #[inline(always)]
1642 fn unpack_lo(&self, other: I32x4) -> I32x4 {
1643 select_impl_block! { scalar { I32x4::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], ]) } avx2 { Self( avx2::_mm_unpacklo_epi32 (self.0, other.0)) } }
1645 }
1646 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n // Lane# 0\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi32)\n\n\n * `PUNPCKHDQ xmm, xmm`\n </li>\n </ul>"]
1647 #[inline(always)]
1648 fn unpack_hi(&self, other: I32x4) -> I32x4 {
1649 select_impl_block! { scalar { I32x4::from([ self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], ]) } avx2 { Self( avx2::_mm_unpackhi_epi32 (self.0, other.0)) } }
1651 }
1652 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_max_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epi32)\n\n\n * `PMAXSD xmm, xmm`\n </li>\n </ul>"]
1653 #[inline(always)]
1654 fn max(&self, other: I32x4) -> I32x4 {
1655 select_impl_block! { scalar { I32x4::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), ]) } avx2 { Self( avx2::_mm_max_epi32 (self.0, other.0)) } }
1656 }
1657 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_min_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epi32)\n\n\n * `PMINSD xmm, xmm`\n </li>\n </ul>"]
1658 #[inline(always)]
1659 fn min(&self, other: I32x4) -> I32x4 {
1660 select_impl_block! { scalar { I32x4::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), ]) } avx2 { Self( avx2::_mm_min_epi32 (self.0, other.0)) } }
1661 }
1662}
1663impl crate::SimdBase32 for I32x4 {
1664 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I32x4\n # {\n I32x4::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 4],\n self.as_array()[I1 + 0 * 4],\n self.as_array()[I2 + 0 * 4],\n self.as_array()[I3 + 0 * 4],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shuffle_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_epi32)\n\n\n * `PSHUFD xmm, xmm, imm8`\n </li>\n </ul>"]
1665 #[inline(always)]
1666 fn shuffle<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(&self) -> I32x4 {
1667 select_impl_block! { scalar { I32x4::from([ self.as_array()[I0 + 0 * 4], self.as_array()[I1 + 0 * 4], self.as_array()[I2 + 0 * 4], self.as_array()[I3 + 0 * 4], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm_shuffle_epi32 ::<I3, I2, I1, I0>(self.0)) } }
1669 }
1670}
1671impl crate::SimdBase4x for I32x4 {
1672 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I32x4 ,\n # ) -> I32x4\n # ;}\n # impl SomeTraitForDoc for I32x4 {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I32x4 ,\n # ) -> I32x4\n # {\n I32x4::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_blend_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blend_epi32)\n\n\n * `VPBLENDD xmm, xmm, xmm, imm8`\n </li>\n </ul>"]
1673 #[inline(always)]
1674 fn blend<const B3: bool, const B2: bool, const B1: bool, const B0: bool>(
1675 &self,
1676 if_true: I32x4,
1677 ) -> I32x4 {
1678 select_impl_block! { scalar { I32x4::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], ]) } avx2 { Self( avx2::_mm_blend_epi32 ::<B3, B2, B1, B0>(self.0, if_true.0)) } }
1679 }
1680}
1681#[doc = "`[i32; 8]` as a vector."]
1682#[repr(transparent)]
1683#[derive(Clone, Copy)]
1684pub struct I32x8(I32x8Internal);
1685unsafe impl bytemuck::Pod for I32x8 {}
1686unsafe impl bytemuck::Zeroable for I32x8 {}
1687impl PartialEq for I32x8 {
1688 #[inline(always)]
1689 fn eq(&self, other: &Self) -> bool {
1690 ((*self) ^ (*other)).is_zero()
1691 }
1692}
1693impl Eq for I32x8 {}
1694impl Default for I32x8 {
1695 #[doc = "The zero vector."]
1696 #[inline(always)]
1697 fn default() -> Self {
1698 Self::ZERO
1699 }
1700}
1701impl std::hash::Hash for I32x8 {
1702 #[inline]
1703 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1704 bytemuck::bytes_of(self).hash(state);
1705 }
1706}
1707impl std::fmt::Debug for I32x8 {
1708 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1709 write!(f, "I32x8({:?})", <[i32; 8]>::from(*self))
1710 }
1711}
1712impl subtle::ConstantTimeEq for I32x8 {
1713 fn ct_eq(&self, other: &Self) -> subtle::Choice {
1714 self.as_array().ct_eq(&other.as_array())
1715 }
1716}
1717impl subtle::ConditionallySelectable for I32x8 {
1718 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
1719 let mut out = [0; 8];
1720 for (out, (a, b)) in out
1721 .iter_mut()
1722 .zip(a.as_array().iter().zip(b.as_array().iter()))
1723 {
1724 *out = <i32 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
1725 }
1726 Self::from(out)
1727 }
1728}
1729impl rand::distributions::Distribution<I32x8> for rand::distributions::Standard {
1730 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I32x8 {
1731 let mut out = I32x8::ZERO;
1732 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
1733 out
1734 }
1735}
1736impl AsRef<[i32]> for I32x8 {
1737 fn as_ref(&self) -> &[i32] {
1738 let arr: &[i32; 8] = bytemuck::cast_ref(self);
1739 arr
1740 }
1741}
1742impl AsMut<[i32]> for I32x8 {
1743 fn as_mut(&mut self) -> &mut [i32] {
1744 let arr: &mut [i32; 8] = bytemuck::cast_mut(self);
1745 arr
1746 }
1747}
1748impl From<I8x32> for I32x8 {
1749 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x32\nas little endian bits of I32x8."]
1750 #[inline(always)]
1751 fn from(x: I8x32) -> I32x8 {
1752 Self({
1753 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1755 })
1756 }
1757}
1758impl From<I16x16> for I32x8 {
1759 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x16\nas little endian bits of I32x8."]
1760 #[inline(always)]
1761 fn from(x: I16x16) -> I32x8 {
1762 Self({
1763 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1765 })
1766 }
1767}
1768impl From<I64x4> for I32x8 {
1769 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x4\nas little endian bits of I32x8."]
1770 #[inline(always)]
1771 fn from(x: I64x4) -> I32x8 {
1772 Self({
1773 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1775 })
1776 }
1777}
1778impl From<U8x32> for I32x8 {
1779 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x32\nas little endian bits of I32x8."]
1780 #[inline(always)]
1781 fn from(x: U8x32) -> I32x8 {
1782 Self({
1783 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1785 })
1786 }
1787}
1788impl From<U16x16> for I32x8 {
1789 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x16\nas little endian bits of I32x8."]
1790 #[inline(always)]
1791 fn from(x: U16x16) -> I32x8 {
1792 Self({
1793 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1795 })
1796 }
1797}
1798impl From<U32x8> for I32x8 {
1799 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x8\nas little endian bits of I32x8."]
1800 #[inline(always)]
1801 fn from(x: U32x8) -> I32x8 {
1802 Self({
1803 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1805 })
1806 }
1807}
1808impl From<U64x4> for I32x8 {
1809 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x4\nas little endian bits of I32x8."]
1810 #[inline(always)]
1811 fn from(x: U64x4) -> I32x8 {
1812 Self({
1813 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
1815 })
1816 }
1817}
1818impl From<I16x8> for I32x8 {
1819 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n i32::from(vector.as_array()[0]),\n i32::from(vector.as_array()[1]),\n i32::from(vector.as_array()[2]),\n i32::from(vector.as_array()[3]),\n i32::from(vector.as_array()[4]),\n i32::from(vector.as_array()[5]),\n i32::from(vector.as_array()[6]),\n i32::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi16_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi16_epi32)\n\n\n * `VPMOVSXWD ymm, xmm`\n </li>\n </ul>"]
1820 #[inline(always)]
1821 fn from(vector: I16x8) -> I32x8 {
1822 select_impl_block! { scalar { I32x8::from([ i32::from(vector.as_array()[0]), i32::from(vector.as_array()[1]), i32::from(vector.as_array()[2]), i32::from(vector.as_array()[3]), i32::from(vector.as_array()[4]), i32::from(vector.as_array()[5]), i32::from(vector.as_array()[6]), i32::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_cvtepi16_epi32 (vector.0)) } }
1823 }
1824}
1825impl crate::ExtendingCast<I8x16> for I32x8 {
1826 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I32x8\n # {\n I32x8::from([\n i32::from(vector.as_array()[0]),\n i32::from(vector.as_array()[1]),\n i32::from(vector.as_array()[2]),\n i32::from(vector.as_array()[3]),\n i32::from(vector.as_array()[4]),\n i32::from(vector.as_array()[5]),\n i32::from(vector.as_array()[6]),\n i32::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi8_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi8_epi32)\n\n\n * `VPMOVSXBD ymm, xmm`\n </li>\n </ul>"]
1827 #[inline(always)]
1828 fn extending_cast_from(vector: I8x16) -> I32x8 {
1829 select_impl_block! { scalar { I32x8::from([ i32::from(vector.as_array()[0]), i32::from(vector.as_array()[1]), i32::from(vector.as_array()[2]), i32::from(vector.as_array()[3]), i32::from(vector.as_array()[4]), i32::from(vector.as_array()[5]), i32::from(vector.as_array()[6]), i32::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_cvtepi8_epi32 (vector.0)) } }
1830 }
1831}
1832impl crate::ExtendingCast<I16x8> for I32x8 {
1833 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n i32::from(vector.as_array()[0]),\n i32::from(vector.as_array()[1]),\n i32::from(vector.as_array()[2]),\n i32::from(vector.as_array()[3]),\n i32::from(vector.as_array()[4]),\n i32::from(vector.as_array()[5]),\n i32::from(vector.as_array()[6]),\n i32::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi16_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi16_epi32)\n\n\n * `VPMOVSXWD ymm, xmm`\n </li>\n </ul>"]
1834 #[inline(always)]
1835 fn extending_cast_from(vector: I16x8) -> I32x8 {
1836 select_impl_block! { scalar { I32x8::from([ i32::from(vector.as_array()[0]), i32::from(vector.as_array()[1]), i32::from(vector.as_array()[2]), i32::from(vector.as_array()[3]), i32::from(vector.as_array()[4]), i32::from(vector.as_array()[5]), i32::from(vector.as_array()[6]), i32::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_cvtepi16_epi32 (vector.0)) } }
1837 }
1838}
1839impl From<I32x4> for I32x8 {
1840 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I32x4 ,\n # ) -> I32x8\n # {\n let mut out = [0; 8];\n out[0..4].copy_from_slice(&vector.as_array());\n I32x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
1841 #[inline(always)]
1842 fn from(vector: I32x4) -> I32x8 {
1843 select_impl_block! { scalar { let mut out = [0; 8]; out[0..4].copy_from_slice(&vector.as_array()); I32x8::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
1844 }
1845}
1846impl From<[I32x4; 2]> for I32x8 {
1847 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [I32x4; 2] ,\n # ) -> I32x8\n # {\n let mut out = [0; 8];\n out[0..4].copy_from_slice(&vectors[0].as_array());\n out[4..].copy_from_slice(&vectors[1].as_array());\n I32x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
1848 #[inline(always)]
1849 fn from(vectors: [I32x4; 2]) -> I32x8 {
1850 select_impl_block! { scalar { let mut out = [0; 8]; out[0..4].copy_from_slice(&vectors[0].as_array()); out[4..].copy_from_slice(&vectors[1].as_array()); I32x8::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
1851 }
1852} impl From<I32x8> for [I32x4; 2] {
1854 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I32x8 ,\n # ) -> [I32x4; 2]\n # {\n let mut lo = [0; 4];\n let mut hi = [0; 4];\n lo.copy_from_slice(&vector.as_array()[0..4]);\n hi.copy_from_slice(&vector.as_array()[4..]);\n [I32x4::from(lo), I32x4::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
1855 #[inline(always)]
1856 fn from(vector: I32x8) -> [I32x4; 2] {
1857 select_impl_block! { scalar { let mut lo = [0; 4]; let mut hi = [0; 4]; lo.copy_from_slice(&vector.as_array()[0..4]); hi.copy_from_slice(&vector.as_array()[4..]); [I32x4::from(lo), I32x4::from(hi)] } avx2 { [ I32x4( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), I32x4( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
1858 }
1859}
1860#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
1861impl crate::SimdBaseGatherable<I32x8> for I32x8 {
1862 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n base.offset(indices.as_array()[4] as isize).read_unaligned(),\n base.offset(indices.as_array()[5] as isize).read_unaligned(),\n base.offset(indices.as_array()[6] as isize).read_unaligned(),\n base.offset(indices.as_array()[7] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i32gather_epi32)\n\n\n * `VPGATHERDD ymm, vm32x, ymm`\n </li>\n </ul>"]
1863 #[inline(always)]
1864 unsafe fn gather(base: *const i32, indices: I32x8) -> I32x8 {
1865 select_impl_block! { scalar { I32x8::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), base.offset(indices.as_array()[4] as isize).read_unaligned(), base.offset(indices.as_array()[5] as isize).read_unaligned(), base.offset(indices.as_array()[6] as isize).read_unaligned(), base.offset(indices.as_array()[7] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i32gather_epi32 ::<4>(base as *const i32, indices.0)) } }
1866 }
1867 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i32 ,\n # indices : I32x8 ,\n # mask : I32x8 ,\n # src : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n if ((mask.as_array()[0] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if ((mask.as_array()[2] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if ((mask.as_array()[3] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n if ((mask.as_array()[4] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[4] as isize).read_unaligned()\n } else {\n src.as_array()[4]\n },\n if ((mask.as_array()[5] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[5] as isize).read_unaligned()\n } else {\n src.as_array()[5]\n },\n if ((mask.as_array()[6] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[6] as isize).read_unaligned()\n } else {\n src.as_array()[6]\n },\n if ((mask.as_array()[7] as u32) >> 31) == 1 {\n base.offset(indices.as_array()[7] as isize).read_unaligned()\n } else {\n src.as_array()[7]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i32gather_epi32)\n\n\n * `VPGATHERDD ymm, vm32x, ymm`\n </li>\n </ul>"]
1868 #[inline(always)]
1869 unsafe fn gather_masked(base: *const i32, indices: I32x8, mask: I32x8, src: I32x8) -> I32x8 {
1870 select_impl_block! { scalar { I32x8::from([ if ((mask.as_array()[0] as u32) >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u32) >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if ((mask.as_array()[2] as u32) >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if ((mask.as_array()[3] as u32) >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, if ((mask.as_array()[4] as u32) >> 31) == 1 { base.offset(indices.as_array()[4] as isize).read_unaligned() } else { src.as_array()[4] }, if ((mask.as_array()[5] as u32) >> 31) == 1 { base.offset(indices.as_array()[5] as isize).read_unaligned() } else { src.as_array()[5] }, if ((mask.as_array()[6] as u32) >> 31) == 1 { base.offset(indices.as_array()[6] as isize).read_unaligned() } else { src.as_array()[6] }, if ((mask.as_array()[7] as u32) >> 31) == 1 { base.offset(indices.as_array()[7] as isize).read_unaligned() } else { src.as_array()[7] }, ]) } avx2 { Self( avx2::_mm256_mask_i32gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
1871 }
1872} impl ShlAssign<u64> for I32x8 {
1874 #[inline(always)]
1875 fn shl_assign(&mut self, amount: u64) {
1876 *self = (*self) << amount;
1877 }
1878}
1879impl Shl<u64> for I32x8 {
1880 type Output = Self;
1881 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x8\n # {\n if amount >= 32 {\n I32x8::ZERO\n } else {\n I32x8::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sll_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sll_epi32)\n\n\n * `VPSLLD ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1882 #[inline(always)]
1883 fn shl(self, amount: u64) -> I32x8 {
1884 select_impl_block! { scalar { if amount >= 32 { I32x8::ZERO } else { I32x8::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_sll_epi32 (self.0, amount)) } }
1885 }
1886} impl ShlAssign<I32x8> for I32x8 {
1888 #[inline(always)]
1889 fn shl_assign(&mut self, amount: I32x8) {
1890 *self = (*self) << amount;
1891 }
1892}
1893impl Shl<I32x8> for I32x8 {
1894 type Output = Self;
1895 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x8 ,\n # ) -> I32x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sllv_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sllv_epi32)\n\n\n * `VPSLLVD ymm, ymm, ymm`\n </li>\n </ul>"]
1896 #[inline(always)]
1897 fn shl(self, amount: I32x8) -> I32x8 {
1898 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x << amm } else { 0 }; } I32x8::from(out) } avx2 { Self( avx2::_mm256_sllv_epi32 (self.0, amount.0)) } }
1899 }
1900} impl ShrAssign<u64> for I32x8 {
1902 #[inline(always)]
1903 fn shr_assign(&mut self, amount: u64) {
1904 *self = (*self) >> amount;
1905 }
1906}
1907impl Shr<u64> for I32x8 {
1908 type Output = Self;
1909 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I32x8\n # {\n if amount >= 32 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I32x8::from(out)\n } else {\n I32x8::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sra_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sra_epi32)\n\n\n * `VPSRAD ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1910 #[inline(always)]
1911 fn shr(self, amount: u64) -> I32x8 {
1912 select_impl_block! { scalar { if amount >= 32 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I32x8::from(out) } else { I32x8::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_sra_epi32 (self.0, amount)) } }
1913 }
1914} impl ShrAssign<I32x8> for I32x8 {
1916 #[inline(always)]
1917 fn shr_assign(&mut self, amount: I32x8) {
1918 *self = (*self) >> amount;
1919 }
1920}
1921impl Shr<I32x8> for I32x8 {
1922 type Output = Self;
1923 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I32x8 ,\n # ) -> I32x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srav_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srav_epi32)\n\n\n * `VPSRAVD ymm, ymm, ymm`\n </li>\n </ul>"]
1924 #[inline(always)]
1925 fn shr(self, amount: I32x8) -> I32x8 {
1926 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I32x8::from(out) } avx2 { Self( avx2::_mm256_srav_epi32 (self.0, amount.0)) } }
1927 }
1928}
1929impl SimdBase for I32x8 {
1930 type Scalar = i32;
1931 type Array = [i32; 8];
1932 type Signed = I32x8;
1933 type Unsigned = U32x8;
1934 const LANES: usize = 8;
1935 const ZERO: Self = Self::from_array([0; 8]);
1936 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
1937 #[inline(always)]
1938 fn is_zero(&self) -> bool {
1939 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
1940 }
1941 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i32 ,\n # ) -> I32x8\n # {\n let mut out = [0; 8];\n out[0] = scalar;\n I32x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1942 #[inline(always)]
1943 fn set_lo(scalar: i32) -> I32x8 {
1944 select_impl_block! { scalar { let mut out = [0; 8]; out[0] = scalar; I32x8::from(out) } avx2 { Self( avx2::_mm256_set_epi32 ( 0, 0, 0, 0, 0, 0, 0, scalar as i32, )) } }
1945 }
1946 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i32\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i32\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1947 #[inline(always)]
1948 fn extract<const I: usize>(&self) -> i32 {
1949 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi32 ::<I>(self.0) as i32 } }
1950 }
1951 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i32 ,\n # ) -> I32x8\n # {\n I32x8::from([scalar; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
1952 #[inline(always)]
1953 fn broadcast(scalar: i32) -> I32x8 {
1954 select_impl_block! { scalar { I32x8::from([scalar; 8]) } avx2 { Self( avx2::_mm256_set1_epi32 (scalar as i32)) } }
1955 }
1956 type BroadcastLoInput = I32x4;
1957 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I32x4 ,\n # ) -> I32x8\n # {\n I32x8::from([vector.as_array()[0]; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastd_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastd_epi32)\n\n\n * `VPBROADCASTD ymm, xmm`\n </li>\n </ul>"]
1958 #[inline(always)]
1959 fn broadcast_lo(vector: I32x4) -> I32x8 {
1960 select_impl_block! { scalar { I32x8::from([vector.as_array()[0]; 8]) } avx2 { Self( avx2::_mm256_broadcastd_epi32 (vector.0)) } }
1961 }
1962 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi32)\n\n\n * `VPCMPEQD ymm, ymm, ymm`\n </li>\n </ul>"]
1963 #[inline(always)]
1964 fn cmp_eq(&self, other: I32x8) -> I32x8 {
1965 select_impl_block! { scalar { I32x8::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] == other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] == other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] == other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] == other.as_array()[7] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi32 (self.0, other.0)) } }
1966 }
1967 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
1968 #[inline(always)]
1969 fn and_not(&self, other: I32x8) -> I32x8 {
1970 select_impl_block! { scalar { I32x8::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
1971 }
1972 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpgt_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpgt_epi32)\n\n\n * `VPCMPGTD ymm, ymm, ymm`\n </li>\n </ul>"]
1973 #[inline(always)]
1974 fn cmp_gt(&self, other: I32x8) -> I32x8 {
1975 select_impl_block! { scalar { I32x8::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 }, if self.as_array()[4] > other.as_array()[4] { -1 } else { 0 }, if self.as_array()[5] > other.as_array()[5] { -1 } else { 0 }, if self.as_array()[6] > other.as_array()[6] { -1 } else { 0 }, if self.as_array()[7] > other.as_array()[7] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpgt_epi32 (self.0, other.0)) } }
1976 }
1977 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_epi32)\n\n\n * `VPSLLD ymm, ymm, imm8`\n </li>\n </ul>"]
1978 #[inline(always)]
1979 fn shift_left<const BITS: usize>(&self) -> I32x8 {
1980 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I32x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_slli_epi32 ::<BITS>(self.0)) } }
1981 }
1982 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I32x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srai_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srai_epi32)\n\n\n * `VPSRAD ymm, ymm, imm8`\n </li>\n </ul>"]
1983 #[inline(always)]
1984 fn shift_right<const BITS: usize>(&self) -> I32x8 {
1985 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I32x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_srai_epi32 ::<BITS>(self.0)) } }
1986 }
1987 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n // Lane# 1\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi32)\n\n\n * `VPUNPCKLDQ ymm, ymm, ymm`\n </li>\n </ul>"]
1988 #[inline(always)]
1989 fn unpack_lo(&self, other: I32x8) -> I32x8 {
1990 select_impl_block! { scalar { I32x8::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi32 (self.0, other.0)) } }
1993 }
1994 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n // Lane# 0\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n // Lane# 1\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi32)\n\n\n * `VPUNPCKHDQ ymm, ymm, ymm`\n </li>\n </ul>"]
1995 #[inline(always)]
1996 fn unpack_hi(&self, other: I32x8) -> I32x8 {
1997 select_impl_block! { scalar { I32x8::from([ self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi32 (self.0, other.0)) } }
2000 }
2001 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_max_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_max_epi32)\n\n\n * `VPMAXSD ymm, ymm, ymm`\n </li>\n </ul>"]
2002 #[inline(always)]
2003 fn max(&self, other: I32x8) -> I32x8 {
2004 select_impl_block! { scalar { I32x8::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_max_epi32 (self.0, other.0)) } }
2005 }
2006 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_min_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_min_epi32)\n\n\n * `VPMINSD ymm, ymm, ymm`\n </li>\n </ul>"]
2007 #[inline(always)]
2008 fn min(&self, other: I32x8) -> I32x8 {
2009 select_impl_block! { scalar { I32x8::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_min_epi32 (self.0, other.0)) } }
2010 }
2011}
2012impl crate::SimdBase32 for I32x8 {
2013 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I32x8\n # {\n I32x8::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 4],\n self.as_array()[I1 + 0 * 4],\n self.as_array()[I2 + 0 * 4],\n self.as_array()[I3 + 0 * 4],\n // 128-bit Lane #1\n self.as_array()[I0 + 1 * 4],\n self.as_array()[I1 + 1 * 4],\n self.as_array()[I2 + 1 * 4],\n self.as_array()[I3 + 1 * 4],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shuffle_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shuffle_epi32)\n\n\n * `VPSHUFD ymm, ymm, imm8`\n </li>\n </ul>"]
2014 #[inline(always)]
2015 fn shuffle<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(&self) -> I32x8 {
2016 select_impl_block! { scalar { I32x8::from([ self.as_array()[I0 + 0 * 4], self.as_array()[I1 + 0 * 4], self.as_array()[I2 + 0 * 4], self.as_array()[I3 + 0 * 4], self.as_array()[I0 + 1 * 4], self.as_array()[I1 + 1 * 4], self.as_array()[I2 + 1 * 4], self.as_array()[I3 + 1 * 4], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm256_shuffle_epi32 ::<I3, I2, I1, I0>(self.0)) } }
2019 }
2020}
2021impl crate::SimdBase8x for I32x8 {
2022 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I32x8 ,\n # ) -> I32x8\n # ;}\n # impl SomeTraitForDoc for I32x8 {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I32x8 ,\n # ) -> I32x8\n # {\n I32x8::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n (if B4 { if_true } else { *self }).as_array()[4],\n (if B5 { if_true } else { *self }).as_array()[5],\n (if B6 { if_true } else { *self }).as_array()[6],\n (if B7 { if_true } else { *self }).as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_blend_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_blend_epi32)\n\n\n * `VPBLENDD ymm, ymm, ymm, imm8`\n </li>\n </ul>"]
2023 #[inline(always)]
2024 fn blend<
2025 const B7: bool,
2026 const B6: bool,
2027 const B5: bool,
2028 const B4: bool,
2029 const B3: bool,
2030 const B2: bool,
2031 const B1: bool,
2032 const B0: bool,
2033 >(
2034 &self,
2035 if_true: I32x8,
2036 ) -> I32x8 {
2037 select_impl_block! { scalar { I32x8::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], (if B4 { if_true } else { *self }).as_array()[4], (if B5 { if_true } else { *self }).as_array()[5], (if B6 { if_true } else { *self }).as_array()[6], (if B7 { if_true } else { *self }).as_array()[7], ]) } avx2 { Self( avx2::_mm256_blend_epi32 ::<B7, B6, B5, B4, B3, B2, B1, B0>(self.0, if_true.0)) } }
2038 }
2039}
2040#[doc = "`[i64; 2]` as a vector."]
2041#[repr(transparent)]
2042#[derive(Clone, Copy)]
2043pub struct I64x2(I64x2Internal);
2044unsafe impl bytemuck::Pod for I64x2 {}
2045unsafe impl bytemuck::Zeroable for I64x2 {}
2046impl PartialEq for I64x2 {
2047 #[inline(always)]
2048 fn eq(&self, other: &Self) -> bool {
2049 ((*self) ^ (*other)).is_zero()
2050 }
2051}
2052impl Eq for I64x2 {}
2053impl Default for I64x2 {
2054 #[doc = "The zero vector."]
2055 #[inline(always)]
2056 fn default() -> Self {
2057 Self::ZERO
2058 }
2059}
2060impl std::hash::Hash for I64x2 {
2061 #[inline]
2062 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2063 bytemuck::bytes_of(self).hash(state);
2064 }
2065}
2066impl std::fmt::Debug for I64x2 {
2067 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2068 write!(f, "I64x2({:?})", <[i64; 2]>::from(*self))
2069 }
2070}
2071impl subtle::ConstantTimeEq for I64x2 {
2072 fn ct_eq(&self, other: &Self) -> subtle::Choice {
2073 self.as_array().ct_eq(&other.as_array())
2074 }
2075}
2076impl subtle::ConditionallySelectable for I64x2 {
2077 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
2078 let mut out = [0; 2];
2079 for (out, (a, b)) in out
2080 .iter_mut()
2081 .zip(a.as_array().iter().zip(b.as_array().iter()))
2082 {
2083 *out = <i64 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
2084 }
2085 Self::from(out)
2086 }
2087}
2088impl rand::distributions::Distribution<I64x2> for rand::distributions::Standard {
2089 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I64x2 {
2090 let mut out = I64x2::ZERO;
2091 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
2092 out
2093 }
2094}
2095impl AsRef<[i64]> for I64x2 {
2096 fn as_ref(&self) -> &[i64] {
2097 let arr: &[i64; 2] = bytemuck::cast_ref(self);
2098 arr
2099 }
2100}
2101impl AsMut<[i64]> for I64x2 {
2102 fn as_mut(&mut self) -> &mut [i64] {
2103 let arr: &mut [i64; 2] = bytemuck::cast_mut(self);
2104 arr
2105 }
2106}
2107impl From<I8x16> for I64x2 {
2108 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x16\nas little endian bits of I64x2."]
2109 #[inline(always)]
2110 fn from(x: I8x16) -> I64x2 {
2111 Self({
2112 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2114 })
2115 }
2116}
2117impl From<I16x8> for I64x2 {
2118 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x8\nas little endian bits of I64x2."]
2119 #[inline(always)]
2120 fn from(x: I16x8) -> I64x2 {
2121 Self({
2122 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2124 })
2125 }
2126}
2127impl From<I32x4> for I64x2 {
2128 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x4\nas little endian bits of I64x2."]
2129 #[inline(always)]
2130 fn from(x: I32x4) -> I64x2 {
2131 Self({
2132 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2134 })
2135 }
2136}
2137impl From<U8x16> for I64x2 {
2138 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x16\nas little endian bits of I64x2."]
2139 #[inline(always)]
2140 fn from(x: U8x16) -> I64x2 {
2141 Self({
2142 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2144 })
2145 }
2146}
2147impl From<U16x8> for I64x2 {
2148 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x8\nas little endian bits of I64x2."]
2149 #[inline(always)]
2150 fn from(x: U16x8) -> I64x2 {
2151 Self({
2152 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2154 })
2155 }
2156}
2157impl From<U32x4> for I64x2 {
2158 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x4\nas little endian bits of I64x2."]
2159 #[inline(always)]
2160 fn from(x: U32x4) -> I64x2 {
2161 Self({
2162 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2164 })
2165 }
2166}
2167impl From<U64x2> for I64x2 {
2168 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x2\nas little endian bits of I64x2."]
2169 #[inline(always)]
2170 fn from(x: U64x2) -> I64x2 {
2171 Self({
2172 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2174 })
2175 }
2176}
2177impl crate::ExtendingCast<I8x16> for I64x2 {
2178 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I64x2\n # {\n I64x2::from([\n i64::from(vector.as_array()[0]),\n i64::from(vector.as_array()[1]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepi8_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepi8_epi64)\n\n\n * `PMOVSXBQ xmm, xmm`\n </li>\n </ul>"]
2179 #[inline(always)]
2180 fn extending_cast_from(vector: I8x16) -> I64x2 {
2181 select_impl_block! { scalar { I64x2::from([ i64::from(vector.as_array()[0]), i64::from(vector.as_array()[1]), ]) } avx2 { Self( avx2::_mm_cvtepi8_epi64 (vector.0)) } }
2182 }
2183}
2184impl crate::ExtendingCast<I16x8> for I64x2 {
2185 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I64x2\n # {\n I64x2::from([\n i64::from(vector.as_array()[0]),\n i64::from(vector.as_array()[1]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepi16_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepi16_epi64)\n\n\n * `PMOVSXWQ xmm, xmm`\n </li>\n </ul>"]
2186 #[inline(always)]
2187 fn extending_cast_from(vector: I16x8) -> I64x2 {
2188 select_impl_block! { scalar { I64x2::from([ i64::from(vector.as_array()[0]), i64::from(vector.as_array()[1]), ]) } avx2 { Self( avx2::_mm_cvtepi16_epi64 (vector.0)) } }
2189 }
2190}
2191impl crate::ExtendingCast<I32x4> for I64x2 {
2192 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I32x4 ,\n # ) -> I64x2\n # {\n I64x2::from([\n i64::from(vector.as_array()[0]),\n i64::from(vector.as_array()[1]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepi32_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepi32_epi64)\n\n\n * `PMOVSXDQ xmm, xmm`\n </li>\n </ul>"]
2193 #[inline(always)]
2194 fn extending_cast_from(vector: I32x4) -> I64x2 {
2195 select_impl_block! { scalar { I64x2::from([ i64::from(vector.as_array()[0]), i64::from(vector.as_array()[1]), ]) } avx2 { Self( avx2::_mm_cvtepi32_epi64 (vector.0)) } }
2196 }
2197}
2198#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
2199impl crate::SimdBaseGatherable<U64x2> for I64x2 {
2200 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : U64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
2201 #[inline(always)]
2202 unsafe fn gather(base: *const i64, indices: U64x2) -> I64x2 {
2203 select_impl_block! { scalar { I64x2::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
2204 }
2205 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : U64x2 ,\n # mask : I64x2 ,\n # src : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n if ((mask.as_array()[0] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
2206 #[inline(always)]
2207 unsafe fn gather_masked(base: *const i64, indices: U64x2, mask: I64x2, src: I64x2) -> I64x2 {
2208 select_impl_block! { scalar { I64x2::from([ if ((mask.as_array()[0] as u64) >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u64) >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, ]) } avx2 { Self( avx2::_mm_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
2209 }
2210}
2211#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
2212impl crate::SimdBaseGatherable<I64x2> for I64x2 {
2213 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
2214 #[inline(always)]
2215 unsafe fn gather(base: *const i64, indices: I64x2) -> I64x2 {
2216 select_impl_block! { scalar { I64x2::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
2217 }
2218 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : I64x2 ,\n # mask : I64x2 ,\n # src : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n if ((mask.as_array()[0] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
2219 #[inline(always)]
2220 unsafe fn gather_masked(base: *const i64, indices: I64x2, mask: I64x2, src: I64x2) -> I64x2 {
2221 select_impl_block! { scalar { I64x2::from([ if ((mask.as_array()[0] as u64) >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u64) >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, ]) } avx2 { Self( avx2::_mm_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
2222 }
2223} impl ShlAssign<u64> for I64x2 {
2225 #[inline(always)]
2226 fn shl_assign(&mut self, amount: u64) {
2227 *self = (*self) << amount;
2228 }
2229}
2230impl Shl<u64> for I64x2 {
2231 type Output = Self;
2232 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x2\n # {\n if amount >= 64 {\n I64x2::ZERO\n } else {\n I64x2::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2233 #[inline(always)]
2234 fn shl(self, amount: u64) -> I64x2 {
2235 select_impl_block! { scalar { if amount >= 64 { I64x2::ZERO } else { I64x2::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, ]) } } avx2 { if amount >= 64 { I64x2::ZERO } else { I64x2::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, ]) } } }
2236 }
2237} impl ShlAssign<I64x2> for I64x2 {
2239 #[inline(always)]
2240 fn shl_assign(&mut self, amount: I64x2) {
2241 *self = (*self) << amount;
2242 }
2243}
2244impl Shl<I64x2> for I64x2 {
2245 type Output = Self;
2246 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x2 ,\n # ) -> I64x2\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I64x2::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2247 #[inline(always)]
2248 fn shl(self, amount: I64x2) -> I64x2 {
2249 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x << amm } else { 0 }; } I64x2::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x << amm } else { 0 }; } I64x2::from(out) } }
2250 }
2251} impl ShrAssign<u64> for I64x2 {
2253 #[inline(always)]
2254 fn shr_assign(&mut self, amount: u64) {
2255 *self = (*self) >> amount;
2256 }
2257}
2258impl Shr<u64> for I64x2 {
2259 type Output = Self;
2260 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x2\n # {\n if amount >= 64 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I64x2::from(out)\n } else {\n I64x2::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2261 #[inline(always)]
2262 fn shr(self, amount: u64) -> I64x2 {
2263 select_impl_block! { scalar { if amount >= 64 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I64x2::from(out) } else { I64x2::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, ]) } } avx2 { if amount >= 64 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I64x2::from(out) } else { I64x2::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, ]) } } }
2264 }
2265} impl ShrAssign<I64x2> for I64x2 {
2267 #[inline(always)]
2268 fn shr_assign(&mut self, amount: I64x2) {
2269 *self = (*self) >> amount;
2270 }
2271}
2272impl Shr<I64x2> for I64x2 {
2273 type Output = Self;
2274 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x2 ,\n # ) -> I64x2\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I64x2::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2275 #[inline(always)]
2276 fn shr(self, amount: I64x2) -> I64x2 {
2277 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I64x2::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I64x2::from(out) } }
2278 }
2279}
2280impl SimdBase for I64x2 {
2281 type Scalar = i64;
2282 type Array = [i64; 2];
2283 type Signed = I64x2;
2284 type Unsigned = U64x2;
2285 const LANES: usize = 2;
2286 const ZERO: Self = Self::from_array([0; 2]);
2287 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
2288 #[inline(always)]
2289 fn is_zero(&self) -> bool {
2290 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
2291 }
2292 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i64 ,\n # ) -> I64x2\n # {\n let mut out = [0; 2];\n out[0] = scalar;\n I64x2::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
2293 #[inline(always)]
2294 fn set_lo(scalar: i64) -> I64x2 {
2295 select_impl_block! { scalar { let mut out = [0; 2]; out[0] = scalar; I64x2::from(out) } avx2 { Self( avx2::_mm_set_epi64x ( 0, scalar as i64, )) } }
2296 }
2297 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i64\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i64\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi64)\n\n\n * `PEXTRQ r64, xmm, imm8`\n </li>\n </ul>"]
2298 #[inline(always)]
2299 fn extract<const I: usize>(&self) -> i64 {
2300 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi64 ::<I>(self.0) as i64 } }
2301 }
2302 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i64 ,\n # ) -> I64x2\n # {\n I64x2::from([scalar; 2])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
2303 #[inline(always)]
2304 fn broadcast(scalar: i64) -> I64x2 {
2305 select_impl_block! { scalar { I64x2::from([scalar; 2]) } avx2 { Self( avx2::_mm_set1_epi64x (scalar as i64)) } }
2306 }
2307 type BroadcastLoInput = I64x2;
2308 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([vector.as_array()[0]; 2])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastq_epi64)\n\n\n * `VPBROADCASTQ xmm, xmm`\n </li>\n </ul>"]
2309 #[inline(always)]
2310 fn broadcast_lo(vector: I64x2) -> I64x2 {
2311 select_impl_block! { scalar { I64x2::from([vector.as_array()[0]; 2]) } avx2 { Self( avx2::_mm_broadcastq_epi64 (vector.0)) } }
2312 }
2313 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi64)\n\n\n * `PCMPEQQ xmm, xmm`\n </li>\n </ul>"]
2314 #[inline(always)]
2315 fn cmp_eq(&self, other: I64x2) -> I64x2 {
2316 select_impl_block! { scalar { I64x2::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi64 (self.0, other.0)) } }
2317 }
2318 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
2319 #[inline(always)]
2320 fn and_not(&self, other: I64x2) -> I64x2 {
2321 select_impl_block! { scalar { I64x2::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
2322 }
2323 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpgt_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpgt_epi64)\n\n\n * `PCMPGTQ xmm, xmm`\n </li>\n </ul>"]
2324 #[inline(always)]
2325 fn cmp_gt(&self, other: I64x2) -> I64x2 {
2326 select_impl_block! { scalar { I64x2::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpgt_epi64 (self.0, other.0)) } }
2327 }
2328 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x2\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I64x2::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi64)\n\n\n * `PSLLQ xmm, imm8`\n </li>\n </ul>"]
2329 #[inline(always)]
2330 fn shift_left<const BITS: usize>(&self) -> I64x2 {
2331 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I64x2::from(out) } avx2 { const USELESS_ARRAY: [u8; 64] = [0; 64]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_slli_epi64 ::<BITS>(self.0)) } }
2332 }
2333 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x2\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I64x2::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2334 #[inline(always)]
2335 fn shift_right<const BITS: usize>(&self) -> I64x2 {
2336 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I64x2::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I64x2::from(out) } }
2337 }
2338 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi64)\n\n\n * `PUNPCKLQDQ xmm, xmm`\n </li>\n </ul>"]
2339 #[inline(always)]
2340 fn unpack_lo(&self, other: I64x2) -> I64x2 {
2341 select_impl_block! { scalar { I64x2::from([ self.as_array()[0], other.as_array()[0], ]) } avx2 { Self( avx2::_mm_unpacklo_epi64 (self.0, other.0)) } }
2343 }
2344 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n // Lane# 0\n self.as_array()[1],\n other.as_array()[1],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi64)\n\n\n * `PUNPCKHQDQ xmm, xmm`\n </li>\n </ul>"]
2345 #[inline(always)]
2346 fn unpack_hi(&self, other: I64x2) -> I64x2 {
2347 select_impl_block! { scalar { I64x2::from([ self.as_array()[1], other.as_array()[1], ]) } avx2 { Self( avx2::_mm_unpackhi_epi64 (self.0, other.0)) } }
2349 }
2350 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2351 #[inline(always)]
2352 fn max(&self, other: I64x2) -> I64x2 {
2353 select_impl_block! { scalar { I64x2::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), ]) } avx2 { I64x2::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), ]) } }
2354 }
2355 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2356 #[inline(always)]
2357 fn min(&self, other: I64x2) -> I64x2 {
2358 select_impl_block! { scalar { I64x2::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), ]) } avx2 { I64x2::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), ]) } }
2359 }
2360}
2361impl crate::SimdBase64 for I64x2 {
2362 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # ;}\n # impl SomeTraitForDoc for I64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x2 ,\n # ) -> I64x2\n # {\n I64x2::from([\n ((self.as_array()[0] as i32) as i64) * ((other.as_array()[0] as i32) as i64),\n ((self.as_array()[1] as i32) as i64) * ((other.as_array()[1] as i32) as i64),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mul_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mul_epi32)\n\n\n * `PMULDQ xmm, xmm`\n </li>\n </ul>"]
2363 #[inline(always)]
2364 fn mul_lo(&self, other: I64x2) -> I64x2 {
2365 select_impl_block! { scalar { I64x2::from([ ((self.as_array()[0] as i32) as i64) * ((other.as_array()[0] as i32) as i64), ((self.as_array()[1] as i32) as i64) * ((other.as_array()[1] as i32) as i64), ]) } avx2 { Self( avx2::_mm_mul_epi32 (self.0, other.0)) } }
2366 }
2367}
2368#[doc = "`[i64; 4]` as a vector."]
2369#[repr(transparent)]
2370#[derive(Clone, Copy)]
2371pub struct I64x4(I64x4Internal);
2372unsafe impl bytemuck::Pod for I64x4 {}
2373unsafe impl bytemuck::Zeroable for I64x4 {}
2374impl PartialEq for I64x4 {
2375 #[inline(always)]
2376 fn eq(&self, other: &Self) -> bool {
2377 ((*self) ^ (*other)).is_zero()
2378 }
2379}
2380impl Eq for I64x4 {}
2381impl Default for I64x4 {
2382 #[doc = "The zero vector."]
2383 #[inline(always)]
2384 fn default() -> Self {
2385 Self::ZERO
2386 }
2387}
2388impl std::hash::Hash for I64x4 {
2389 #[inline]
2390 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2391 bytemuck::bytes_of(self).hash(state);
2392 }
2393}
2394impl std::fmt::Debug for I64x4 {
2395 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2396 write!(f, "I64x4({:?})", <[i64; 4]>::from(*self))
2397 }
2398}
2399impl subtle::ConstantTimeEq for I64x4 {
2400 fn ct_eq(&self, other: &Self) -> subtle::Choice {
2401 self.as_array().ct_eq(&other.as_array())
2402 }
2403}
2404impl subtle::ConditionallySelectable for I64x4 {
2405 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
2406 let mut out = [0; 4];
2407 for (out, (a, b)) in out
2408 .iter_mut()
2409 .zip(a.as_array().iter().zip(b.as_array().iter()))
2410 {
2411 *out = <i64 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
2412 }
2413 Self::from(out)
2414 }
2415}
2416impl rand::distributions::Distribution<I64x4> for rand::distributions::Standard {
2417 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> I64x4 {
2418 let mut out = I64x4::ZERO;
2419 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
2420 out
2421 }
2422}
2423impl AsRef<[i64]> for I64x4 {
2424 fn as_ref(&self) -> &[i64] {
2425 let arr: &[i64; 4] = bytemuck::cast_ref(self);
2426 arr
2427 }
2428}
2429impl AsMut<[i64]> for I64x4 {
2430 fn as_mut(&mut self) -> &mut [i64] {
2431 let arr: &mut [i64; 4] = bytemuck::cast_mut(self);
2432 arr
2433 }
2434}
2435impl From<I8x32> for I64x4 {
2436 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x32\nas little endian bits of I64x4."]
2437 #[inline(always)]
2438 fn from(x: I8x32) -> I64x4 {
2439 Self({
2440 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2442 })
2443 }
2444}
2445impl From<I16x16> for I64x4 {
2446 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x16\nas little endian bits of I64x4."]
2447 #[inline(always)]
2448 fn from(x: I16x16) -> I64x4 {
2449 Self({
2450 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2452 })
2453 }
2454}
2455impl From<I32x8> for I64x4 {
2456 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x8\nas little endian bits of I64x4."]
2457 #[inline(always)]
2458 fn from(x: I32x8) -> I64x4 {
2459 Self({
2460 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2462 })
2463 }
2464}
2465impl From<U8x32> for I64x4 {
2466 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x32\nas little endian bits of I64x4."]
2467 #[inline(always)]
2468 fn from(x: U8x32) -> I64x4 {
2469 Self({
2470 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2472 })
2473 }
2474}
2475impl From<U16x16> for I64x4 {
2476 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x16\nas little endian bits of I64x4."]
2477 #[inline(always)]
2478 fn from(x: U16x16) -> I64x4 {
2479 Self({
2480 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2482 })
2483 }
2484}
2485impl From<U32x8> for I64x4 {
2486 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x8\nas little endian bits of I64x4."]
2487 #[inline(always)]
2488 fn from(x: U32x8) -> I64x4 {
2489 Self({
2490 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2492 })
2493 }
2494}
2495impl From<U64x4> for I64x4 {
2496 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x4\nas little endian bits of I64x4."]
2497 #[inline(always)]
2498 fn from(x: U64x4) -> I64x4 {
2499 Self({
2500 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2502 })
2503 }
2504}
2505impl From<I32x4> for I64x4 {
2506 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I32x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n i64::from(vector.as_array()[0]),\n i64::from(vector.as_array()[1]),\n i64::from(vector.as_array()[2]),\n i64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi32_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi32_epi64)\n\n\n * `VPMOVSXDQ ymm, xmm`\n </li>\n </ul>"]
2507 #[inline(always)]
2508 fn from(vector: I32x4) -> I64x4 {
2509 select_impl_block! { scalar { I64x4::from([ i64::from(vector.as_array()[0]), i64::from(vector.as_array()[1]), i64::from(vector.as_array()[2]), i64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepi32_epi64 (vector.0)) } }
2510 }
2511}
2512impl crate::ExtendingCast<I8x16> for I64x4 {
2513 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I8x16 ,\n # ) -> I64x4\n # {\n I64x4::from([\n i64::from(vector.as_array()[0]),\n i64::from(vector.as_array()[1]),\n i64::from(vector.as_array()[2]),\n i64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi8_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi8_epi64)\n\n\n * `VPMOVSXBQ ymm, xmm`\n </li>\n </ul>"]
2514 #[inline(always)]
2515 fn extending_cast_from(vector: I8x16) -> I64x4 {
2516 select_impl_block! { scalar { I64x4::from([ i64::from(vector.as_array()[0]), i64::from(vector.as_array()[1]), i64::from(vector.as_array()[2]), i64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepi8_epi64 (vector.0)) } }
2517 }
2518}
2519impl crate::ExtendingCast<I16x8> for I64x4 {
2520 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I16x8 ,\n # ) -> I64x4\n # {\n I64x4::from([\n i64::from(vector.as_array()[0]),\n i64::from(vector.as_array()[1]),\n i64::from(vector.as_array()[2]),\n i64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi16_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi16_epi64)\n\n\n * `VPMOVSXWQ ymm, xmm`\n </li>\n </ul>"]
2521 #[inline(always)]
2522 fn extending_cast_from(vector: I16x8) -> I64x4 {
2523 select_impl_block! { scalar { I64x4::from([ i64::from(vector.as_array()[0]), i64::from(vector.as_array()[1]), i64::from(vector.as_array()[2]), i64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepi16_epi64 (vector.0)) } }
2524 }
2525}
2526impl crate::ExtendingCast<I32x4> for I64x4 {
2527 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I32x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n i64::from(vector.as_array()[0]),\n i64::from(vector.as_array()[1]),\n i64::from(vector.as_array()[2]),\n i64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepi32_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepi32_epi64)\n\n\n * `VPMOVSXDQ ymm, xmm`\n </li>\n </ul>"]
2528 #[inline(always)]
2529 fn extending_cast_from(vector: I32x4) -> I64x4 {
2530 select_impl_block! { scalar { I64x4::from([ i64::from(vector.as_array()[0]), i64::from(vector.as_array()[1]), i64::from(vector.as_array()[2]), i64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepi32_epi64 (vector.0)) } }
2531 }
2532}
2533impl From<I64x2> for I64x4 {
2534 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I64x2 ,\n # ) -> I64x4\n # {\n let mut out = [0; 4];\n out[0..2].copy_from_slice(&vector.as_array());\n I64x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
2535 #[inline(always)]
2536 fn from(vector: I64x2) -> I64x4 {
2537 select_impl_block! { scalar { let mut out = [0; 4]; out[0..2].copy_from_slice(&vector.as_array()); I64x4::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
2538 }
2539}
2540impl From<[I64x2; 2]> for I64x4 {
2541 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [I64x2; 2] ,\n # ) -> I64x4\n # {\n let mut out = [0; 4];\n out[0..2].copy_from_slice(&vectors[0].as_array());\n out[2..].copy_from_slice(&vectors[1].as_array());\n I64x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
2542 #[inline(always)]
2543 fn from(vectors: [I64x2; 2]) -> I64x4 {
2544 select_impl_block! { scalar { let mut out = [0; 4]; out[0..2].copy_from_slice(&vectors[0].as_array()); out[2..].copy_from_slice(&vectors[1].as_array()); I64x4::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
2545 }
2546} impl From<I64x4> for [I64x2; 2] {
2548 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I64x4 ,\n # ) -> [I64x2; 2]\n # {\n let mut lo = [0; 2];\n let mut hi = [0; 2];\n lo.copy_from_slice(&vector.as_array()[0..2]);\n hi.copy_from_slice(&vector.as_array()[2..]);\n [I64x2::from(lo), I64x2::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
2549 #[inline(always)]
2550 fn from(vector: I64x4) -> [I64x2; 2] {
2551 select_impl_block! { scalar { let mut lo = [0; 2]; let mut hi = [0; 2]; lo.copy_from_slice(&vector.as_array()[0..2]); hi.copy_from_slice(&vector.as_array()[2..]); [I64x2::from(lo), I64x2::from(hi)] } avx2 { [ I64x2( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), I64x2( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
2552 }
2553}
2554#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
2555impl crate::SimdBaseGatherable<I32x4> for I64x4 {
2556 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : I32x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i32gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i32gather_epi64)\n\n\n * `VPGATHERDQ ymm, vm32x, ymm`\n </li>\n </ul>"]
2557 #[inline(always)]
2558 unsafe fn gather(base: *const i64, indices: I32x4) -> I64x4 {
2559 select_impl_block! { scalar { I64x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i32gather_epi64 ::<8>(base as *const i64, indices.0)) } }
2560 }
2561 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : I32x4 ,\n # mask : I64x4 ,\n # src : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n if ((mask.as_array()[0] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if ((mask.as_array()[2] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if ((mask.as_array()[3] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i32gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i32gather_epi64)\n\n\n * `VPGATHERDQ ymm, vm32x, ymm`\n </li>\n </ul>"]
2562 #[inline(always)]
2563 unsafe fn gather_masked(base: *const i64, indices: I32x4, mask: I64x4, src: I64x4) -> I64x4 {
2564 select_impl_block! { scalar { I64x4::from([ if ((mask.as_array()[0] as u64) >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u64) >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if ((mask.as_array()[2] as u64) >> 63) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if ((mask.as_array()[3] as u64) >> 63) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i32gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
2565 }
2566}
2567#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
2568impl crate::SimdBaseGatherable<U64x4> for I64x4 {
2569 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : U64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
2570 #[inline(always)]
2571 unsafe fn gather(base: *const i64, indices: U64x4) -> I64x4 {
2572 select_impl_block! { scalar { I64x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
2573 }
2574 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : U64x4 ,\n # mask : I64x4 ,\n # src : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n if ((mask.as_array()[0] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if ((mask.as_array()[2] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if ((mask.as_array()[3] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
2575 #[inline(always)]
2576 unsafe fn gather_masked(base: *const i64, indices: U64x4, mask: I64x4, src: I64x4) -> I64x4 {
2577 select_impl_block! { scalar { I64x4::from([ if ((mask.as_array()[0] as u64) >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u64) >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if ((mask.as_array()[2] as u64) >> 63) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if ((mask.as_array()[3] as u64) >> 63) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
2578 }
2579}
2580#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
2581impl crate::SimdBaseGatherable<I64x4> for I64x4 {
2582 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
2583 #[inline(always)]
2584 unsafe fn gather(base: *const i64, indices: I64x4) -> I64x4 {
2585 select_impl_block! { scalar { I64x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
2586 }
2587 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const i64 ,\n # indices : I64x4 ,\n # mask : I64x4 ,\n # src : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n if ((mask.as_array()[0] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if ((mask.as_array()[1] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if ((mask.as_array()[2] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if ((mask.as_array()[3] as u64) >> 63) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
2588 #[inline(always)]
2589 unsafe fn gather_masked(base: *const i64, indices: I64x4, mask: I64x4, src: I64x4) -> I64x4 {
2590 select_impl_block! { scalar { I64x4::from([ if ((mask.as_array()[0] as u64) >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if ((mask.as_array()[1] as u64) >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if ((mask.as_array()[2] as u64) >> 63) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if ((mask.as_array()[3] as u64) >> 63) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
2591 }
2592} impl ShlAssign<u64> for I64x4 {
2594 #[inline(always)]
2595 fn shl_assign(&mut self, amount: u64) {
2596 *self = (*self) << amount;
2597 }
2598}
2599impl Shl<u64> for I64x4 {
2600 type Output = Self;
2601 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x4\n # {\n if amount >= 64 {\n I64x4::ZERO\n } else {\n I64x4::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2602 #[inline(always)]
2603 fn shl(self, amount: u64) -> I64x4 {
2604 select_impl_block! { scalar { if amount >= 64 { I64x4::ZERO } else { I64x4::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, ]) } } avx2 { if amount >= 64 { I64x4::ZERO } else { I64x4::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, ]) } } }
2605 }
2606} impl ShlAssign<I64x4> for I64x4 {
2608 #[inline(always)]
2609 fn shl_assign(&mut self, amount: I64x4) {
2610 *self = (*self) << amount;
2611 }
2612}
2613impl Shl<I64x4> for I64x4 {
2614 type Output = Self;
2615 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x4 ,\n # ) -> I64x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n I64x4::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2616 #[inline(always)]
2617 fn shl(self, amount: I64x4) -> I64x4 {
2618 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x << amm } else { 0 }; } I64x4::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x << amm } else { 0 }; } I64x4::from(out) } }
2619 }
2620} impl ShrAssign<u64> for I64x4 {
2622 #[inline(always)]
2623 fn shr_assign(&mut self, amount: u64) {
2624 *self = (*self) >> amount;
2625 }
2626}
2627impl Shr<u64> for I64x4 {
2628 type Output = Self;
2629 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> I64x4\n # {\n if amount >= 64 {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x = if *x < 0 { -1 } else { 0 };\n }\n I64x4::from(out)\n } else {\n I64x4::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2630 #[inline(always)]
2631 fn shr(self, amount: u64) -> I64x4 {
2632 select_impl_block! { scalar { if amount >= 64 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I64x4::from(out) } else { I64x4::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, ]) } } avx2 { if amount >= 64 { let mut out = self.as_array(); for x in out.iter_mut() { *x = if *x < 0 { -1 } else { 0 }; } I64x4::from(out) } else { I64x4::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, ]) } } }
2633 }
2634} impl ShrAssign<I64x4> for I64x4 {
2636 #[inline(always)]
2637 fn shr_assign(&mut self, amount: I64x4) {
2638 *self = (*self) >> amount;
2639 }
2640}
2641impl Shr<I64x4> for I64x4 {
2642 type Output = Self;
2643 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : I64x4 ,\n # ) -> I64x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x >> amm\n } else if *x < 0 {\n -1\n } else {\n 0\n };\n }\n I64x4::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2644 #[inline(always)]
2645 fn shr(self, amount: I64x4) -> I64x4 {
2646 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I64x4::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x >> amm } else if *x < 0 { -1 } else { 0 }; } I64x4::from(out) } }
2647 }
2648}
2649impl SimdBase for I64x4 {
2650 type Scalar = i64;
2651 type Array = [i64; 4];
2652 type Signed = I64x4;
2653 type Unsigned = U64x4;
2654 const LANES: usize = 4;
2655 const ZERO: Self = Self::from_array([0; 4]);
2656 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
2657 #[inline(always)]
2658 fn is_zero(&self) -> bool {
2659 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
2660 }
2661 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i64 ,\n # ) -> I64x4\n # {\n let mut out = [0; 4];\n out[0] = scalar;\n I64x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
2662 #[inline(always)]
2663 fn set_lo(scalar: i64) -> I64x4 {
2664 select_impl_block! { scalar { let mut out = [0; 4]; out[0] = scalar; I64x4::from(out) } avx2 { Self( avx2::_mm256_set_epi64x ( 0, 0, 0, scalar as i64, )) } }
2665 }
2666 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i64\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> i64\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi64)\n\n\n Instruction sequence.\n </li>\n </ul>"]
2667 #[inline(always)]
2668 fn extract<const I: usize>(&self) -> i64 {
2669 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi64 ::<I>(self.0) as i64 } }
2670 }
2671 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : i64 ,\n # ) -> I64x4\n # {\n I64x4::from([scalar; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
2672 #[inline(always)]
2673 fn broadcast(scalar: i64) -> I64x4 {
2674 select_impl_block! { scalar { I64x4::from([scalar; 4]) } avx2 { Self( avx2::_mm256_set1_epi64x (scalar as i64)) } }
2675 }
2676 type BroadcastLoInput = I64x2;
2677 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : I64x2 ,\n # ) -> I64x4\n # {\n I64x4::from([vector.as_array()[0]; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastq_epi64)\n\n\n * `VPBROADCASTQ ymm, xmm`\n </li>\n </ul>"]
2678 #[inline(always)]
2679 fn broadcast_lo(vector: I64x2) -> I64x4 {
2680 select_impl_block! { scalar { I64x4::from([vector.as_array()[0]; 4]) } avx2 { Self( avx2::_mm256_broadcastq_epi64 (vector.0)) } }
2681 }
2682 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi64)\n\n\n * `VPCMPEQQ ymm, ymm, ymm`\n </li>\n </ul>"]
2683 #[inline(always)]
2684 fn cmp_eq(&self, other: I64x4) -> I64x4 {
2685 select_impl_block! { scalar { I64x4::from([ if self.as_array()[0] == other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] == other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] == other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] == other.as_array()[3] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi64 (self.0, other.0)) } }
2686 }
2687 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
2688 #[inline(always)]
2689 fn and_not(&self, other: I64x4) -> I64x4 {
2690 select_impl_block! { scalar { I64x4::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
2691 }
2692 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpgt_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpgt_epi64)\n\n\n * `VPCMPGTQ ymm, ymm, ymm`\n </li>\n </ul>"]
2693 #[inline(always)]
2694 fn cmp_gt(&self, other: I64x4) -> I64x4 {
2695 select_impl_block! { scalar { I64x4::from([ if self.as_array()[0] > other.as_array()[0] { -1 } else { 0 }, if self.as_array()[1] > other.as_array()[1] { -1 } else { 0 }, if self.as_array()[2] > other.as_array()[2] { -1 } else { 0 }, if self.as_array()[3] > other.as_array()[3] { -1 } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpgt_epi64 (self.0, other.0)) } }
2696 }
2697 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n I64x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_epi64)\n\n\n * `VPSLLQ ymm, ymm, imm8`\n </li>\n </ul>"]
2698 #[inline(always)]
2699 fn shift_left<const BITS: usize>(&self) -> I64x4 {
2700 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } I64x4::from(out) } avx2 { const USELESS_ARRAY: [u8; 64] = [0; 64]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_slli_epi64 ::<BITS>(self.0)) } }
2701 }
2702 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> I64x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n I64x4::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2703 #[inline(always)]
2704 fn shift_right<const BITS: usize>(&self) -> I64x4 {
2705 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I64x4::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } I64x4::from(out) } }
2706 }
2707 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n // Lane# 1\n self.as_array()[2],\n other.as_array()[2],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi64)\n\n\n * `VPUNPCKLQDQ ymm, ymm, ymm`\n </li>\n </ul>"]
2708 #[inline(always)]
2709 fn unpack_lo(&self, other: I64x4) -> I64x4 {
2710 select_impl_block! { scalar { I64x4::from([ self.as_array()[0], other.as_array()[0], self.as_array()[2], other.as_array()[2], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi64 (self.0, other.0)) } }
2713 }
2714 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n // Lane# 0\n self.as_array()[1],\n other.as_array()[1],\n // Lane# 1\n self.as_array()[3],\n other.as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi64)\n\n\n * `VPUNPCKHQDQ ymm, ymm, ymm`\n </li>\n </ul>"]
2715 #[inline(always)]
2716 fn unpack_hi(&self, other: I64x4) -> I64x4 {
2717 select_impl_block! { scalar { I64x4::from([ self.as_array()[1], other.as_array()[1], self.as_array()[3], other.as_array()[3], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi64 (self.0, other.0)) } }
2720 }
2721 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2722 #[inline(always)]
2723 fn max(&self, other: I64x4) -> I64x4 {
2724 select_impl_block! { scalar { I64x4::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), ]) } avx2 { I64x4::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), ]) } }
2725 }
2726 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2727 #[inline(always)]
2728 fn min(&self, other: I64x4) -> I64x4 {
2729 select_impl_block! { scalar { I64x4::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), ]) } avx2 { I64x4::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), ]) } }
2730 }
2731}
2732impl crate::SimdBase4x for I64x4 {
2733 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_blend_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_blend_epi32)\n\n\n * `VPBLENDD ymm, ymm, ymm, imm8`\n </li>\n </ul>"]
2734 #[inline(always)]
2735 fn blend<const B3: bool, const B2: bool, const B1: bool, const B0: bool>(
2736 &self,
2737 if_true: I64x4,
2738 ) -> I64x4 {
2739 select_impl_block! { scalar { I64x4::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], ]) } avx2 { Self( avx2::_mm256_blend_epi32 ::< B3, B3, B2, B2, B1, B1, B0, B0 >(self.0, if_true.0)) } }
2740 }
2741}
2742impl crate::SimdBase64 for I64x4 {
2743 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : I64x4 ,\n # ) -> I64x4\n # {\n I64x4::from([\n ((self.as_array()[0] as i32) as i64) * ((other.as_array()[0] as i32) as i64),\n ((self.as_array()[1] as i32) as i64) * ((other.as_array()[1] as i32) as i64),\n ((self.as_array()[2] as i32) as i64) * ((other.as_array()[2] as i32) as i64),\n ((self.as_array()[3] as i32) as i64) * ((other.as_array()[3] as i32) as i64),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mul_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mul_epi32)\n\n\n * `VPMULDQ ymm, ymm, ymm`\n </li>\n </ul>"]
2744 #[inline(always)]
2745 fn mul_lo(&self, other: I64x4) -> I64x4 {
2746 select_impl_block! { scalar { I64x4::from([ ((self.as_array()[0] as i32) as i64) * ((other.as_array()[0] as i32) as i64), ((self.as_array()[1] as i32) as i64) * ((other.as_array()[1] as i32) as i64), ((self.as_array()[2] as i32) as i64) * ((other.as_array()[2] as i32) as i64), ((self.as_array()[3] as i32) as i64) * ((other.as_array()[3] as i32) as i64), ]) } avx2 { Self( avx2::_mm256_mul_epi32 (self.0, other.0)) } }
2747 }
2748}
2749impl crate::SimdBase4x64 for I64x4 {
2750 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I64x4\n # ;}\n # impl SomeTraitForDoc for I64x4 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> I64x4\n # {\n I64x4::from([\n self.as_array()[I0],\n self.as_array()[I1],\n self.as_array()[I2],\n self.as_array()[I3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_permute4x64_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_permute4x64_epi64)\n\n\n * `VPERMQ ymm, ymm, imm8`\n </li>\n </ul>"]
2751 #[inline(always)]
2752 fn shuffle<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(&self) -> I64x4 {
2753 select_impl_block! { scalar { I64x4::from([ self.as_array()[I0], self.as_array()[I1], self.as_array()[I2], self.as_array()[I3], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm256_permute4x64_epi64 ::<I3, I2, I1, I0>(self.0)) } }
2754 }
2755}
2756#[doc = "`[u8; 16]` as a vector."]
2757#[repr(transparent)]
2758#[derive(Clone, Copy)]
2759pub struct U8x16(U8x16Internal);
2760unsafe impl bytemuck::Pod for U8x16 {}
2761unsafe impl bytemuck::Zeroable for U8x16 {}
2762impl PartialEq for U8x16 {
2763 #[inline(always)]
2764 fn eq(&self, other: &Self) -> bool {
2765 ((*self) ^ (*other)).is_zero()
2766 }
2767}
2768impl Eq for U8x16 {}
2769impl Default for U8x16 {
2770 #[doc = "The zero vector."]
2771 #[inline(always)]
2772 fn default() -> Self {
2773 Self::ZERO
2774 }
2775}
2776impl std::hash::Hash for U8x16 {
2777 #[inline]
2778 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2779 bytemuck::bytes_of(self).hash(state);
2780 }
2781}
2782impl std::fmt::Debug for U8x16 {
2783 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2784 write!(f, "U8x16({:?})", <[u8; 16]>::from(*self))
2785 }
2786}
2787impl subtle::ConstantTimeEq for U8x16 {
2788 fn ct_eq(&self, other: &Self) -> subtle::Choice {
2789 self.as_array().ct_eq(&other.as_array())
2790 }
2791}
2792impl subtle::ConditionallySelectable for U8x16 {
2793 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
2794 let mut out = [0; 16];
2795 for (out, (a, b)) in out
2796 .iter_mut()
2797 .zip(a.as_array().iter().zip(b.as_array().iter()))
2798 {
2799 *out = <u8 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
2800 }
2801 Self::from(out)
2802 }
2803}
2804impl rand::distributions::Distribution<U8x16> for rand::distributions::Standard {
2805 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U8x16 {
2806 let mut out = U8x16::ZERO;
2807 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
2808 out
2809 }
2810}
2811impl AsRef<[u8]> for U8x16 {
2812 fn as_ref(&self) -> &[u8] {
2813 let arr: &[u8; 16] = bytemuck::cast_ref(self);
2814 arr
2815 }
2816}
2817impl AsMut<[u8]> for U8x16 {
2818 fn as_mut(&mut self) -> &mut [u8] {
2819 let arr: &mut [u8; 16] = bytemuck::cast_mut(self);
2820 arr
2821 }
2822}
2823impl From<I8x16> for U8x16 {
2824 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x16\nas little endian bits of U8x16."]
2825 #[inline(always)]
2826 fn from(x: I8x16) -> U8x16 {
2827 Self({
2828 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2830 })
2831 }
2832}
2833impl From<I16x8> for U8x16 {
2834 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x8\nas little endian bits of U8x16."]
2835 #[inline(always)]
2836 fn from(x: I16x8) -> U8x16 {
2837 Self({
2838 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2840 })
2841 }
2842}
2843impl From<I32x4> for U8x16 {
2844 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x4\nas little endian bits of U8x16."]
2845 #[inline(always)]
2846 fn from(x: I32x4) -> U8x16 {
2847 Self({
2848 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2850 })
2851 }
2852}
2853impl From<I64x2> for U8x16 {
2854 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x2\nas little endian bits of U8x16."]
2855 #[inline(always)]
2856 fn from(x: I64x2) -> U8x16 {
2857 Self({
2858 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2860 })
2861 }
2862}
2863impl From<U16x8> for U8x16 {
2864 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x8\nas little endian bits of U8x16."]
2865 #[inline(always)]
2866 fn from(x: U16x8) -> U8x16 {
2867 Self({
2868 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2870 })
2871 }
2872}
2873impl From<U32x4> for U8x16 {
2874 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x4\nas little endian bits of U8x16."]
2875 #[inline(always)]
2876 fn from(x: U32x4) -> U8x16 {
2877 Self({
2878 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2880 })
2881 }
2882}
2883impl From<U64x2> for U8x16 {
2884 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x2\nas little endian bits of U8x16."]
2885 #[inline(always)]
2886 fn from(x: U64x2) -> U8x16 {
2887 Self({
2888 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
2890 })
2891 }
2892}
2893impl crate::SimdSaturatingArithmetic for U8x16 {
2894 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_adds_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_adds_epu8)\n\n\n * `PADDUSB xmm, xmm`\n </li>\n </ul>"]
2895 #[inline(always)]
2896 fn saturating_add(&self, other: U8x16) -> U8x16 {
2897 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm_adds_epu8 (self.0, other.0)) } }
2898 }
2899 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_subs_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_subs_epu8)\n\n\n * `PSUBUSB xmm, xmm`\n </li>\n </ul>"]
2900 #[inline(always)]
2901 fn saturating_sub(&self, other: U8x16) -> U8x16 {
2902 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm_subs_epu8 (self.0, other.0)) } }
2903 }
2904} impl ShlAssign<u64> for U8x16 {
2906 #[inline(always)]
2907 fn shl_assign(&mut self, amount: u64) {
2908 *self = (*self) << amount;
2909 }
2910}
2911impl Shl<u64> for U8x16 {
2912 type Output = Self;
2913 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x16\n # {\n if amount >= 8 {\n U8x16::ZERO\n } else {\n U8x16::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n self.as_array()[8] << amount,\n self.as_array()[9] << amount,\n self.as_array()[10] << amount,\n self.as_array()[11] << amount,\n self.as_array()[12] << amount,\n self.as_array()[13] << amount,\n self.as_array()[14] << amount,\n self.as_array()[15] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2914 #[inline(always)]
2915 fn shl(self, amount: u64) -> U8x16 {
2916 select_impl_block! { scalar { if amount >= 8 { U8x16::ZERO } else { U8x16::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, ]) } } avx2 { if amount >= 8 { U8x16::ZERO } else { U8x16::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, ]) } } }
2917 }
2918} impl ShlAssign<U8x16> for U8x16 {
2920 #[inline(always)]
2921 fn shl_assign(&mut self, amount: U8x16) {
2922 *self = (*self) << amount;
2923 }
2924}
2925impl Shl<U8x16> for U8x16 {
2926 type Output = Self;
2927 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x16 ,\n # ) -> U8x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2928 #[inline(always)]
2929 fn shl(self, amount: U8x16) -> U8x16 {
2930 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } U8x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } U8x16::from(out) } }
2931 }
2932} impl ShrAssign<u64> for U8x16 {
2934 #[inline(always)]
2935 fn shr_assign(&mut self, amount: u64) {
2936 *self = (*self) >> amount;
2937 }
2938}
2939impl Shr<u64> for U8x16 {
2940 type Output = Self;
2941 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x16\n # {\n if amount >= 8 {\n U8x16::ZERO\n } else {\n U8x16::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n self.as_array()[8] >> amount,\n self.as_array()[9] >> amount,\n self.as_array()[10] >> amount,\n self.as_array()[11] >> amount,\n self.as_array()[12] >> amount,\n self.as_array()[13] >> amount,\n self.as_array()[14] >> amount,\n self.as_array()[15] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2942 #[inline(always)]
2943 fn shr(self, amount: u64) -> U8x16 {
2944 select_impl_block! { scalar { if amount >= 8 { U8x16::ZERO } else { U8x16::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, ]) } } avx2 { if amount >= 8 { U8x16::ZERO } else { U8x16::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, ]) } } }
2945 }
2946} impl ShrAssign<U8x16> for U8x16 {
2948 #[inline(always)]
2949 fn shr_assign(&mut self, amount: U8x16) {
2950 *self = (*self) >> amount;
2951 }
2952}
2953impl Shr<U8x16> for U8x16 {
2954 type Output = Self;
2955 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x16 ,\n # ) -> U8x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
2956 #[inline(always)]
2957 fn shr(self, amount: U8x16) -> U8x16 {
2958 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else { 0 }; } U8x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else { 0 }; } U8x16::from(out) } }
2959 }
2960}
2961impl SimdBase for U8x16 {
2962 type Scalar = u8;
2963 type Array = [u8; 16];
2964 type Signed = I8x16;
2965 type Unsigned = U8x16;
2966 const LANES: usize = 16;
2967 const ZERO: Self = Self::from_array([0; 16]);
2968 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
2969 #[inline(always)]
2970 fn is_zero(&self) -> bool {
2971 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
2972 }
2973 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u8 ,\n # ) -> U8x16\n # {\n let mut out = [0; 16];\n out[0] = scalar;\n U8x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
2974 #[inline(always)]
2975 fn set_lo(scalar: u8) -> U8x16 {
2976 select_impl_block! { scalar { let mut out = [0; 16]; out[0] = scalar; U8x16::from(out) } avx2 { Self( avx2::_mm_set_epi8 ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, scalar as i8, )) } }
2977 }
2978 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u8\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u8\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi8)\n\n\n * `PEXTRB r32, xmm, imm8`\n </li>\n </ul>"]
2979 #[inline(always)]
2980 fn extract<const I: usize>(&self) -> u8 {
2981 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi8 ::<I>(self.0) as u8 } }
2982 }
2983 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u8 ,\n # ) -> U8x16\n # {\n U8x16::from([scalar; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
2984 #[inline(always)]
2985 fn broadcast(scalar: u8) -> U8x16 {
2986 select_impl_block! { scalar { U8x16::from([scalar; 16]) } avx2 { Self( avx2::_mm_set1_epi8 (scalar as i8)) } }
2987 }
2988 type BroadcastLoInput = U8x16;
2989 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([vector.as_array()[0]; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastb_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastb_epi8)\n\n\n * `VPBROADCASTB xmm, xmm`\n </li>\n </ul>"]
2990 #[inline(always)]
2991 fn broadcast_lo(vector: U8x16) -> U8x16 {
2992 select_impl_block! { scalar { U8x16::from([vector.as_array()[0]; 16]) } avx2 { Self( avx2::_mm_broadcastb_epi8 (vector.0)) } }
2993 }
2994 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([\n if self.as_array()[0] == other.as_array()[0] { u8::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u8::MAX } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { u8::MAX } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { u8::MAX } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { u8::MAX } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { u8::MAX } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { u8::MAX } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { u8::MAX } else { 0 },\n if self.as_array()[8] == other.as_array()[8] { u8::MAX } else { 0 },\n if self.as_array()[9] == other.as_array()[9] { u8::MAX } else { 0 },\n if self.as_array()[10] == other.as_array()[10] { u8::MAX } else { 0 },\n if self.as_array()[11] == other.as_array()[11] { u8::MAX } else { 0 },\n if self.as_array()[12] == other.as_array()[12] { u8::MAX } else { 0 },\n if self.as_array()[13] == other.as_array()[13] { u8::MAX } else { 0 },\n if self.as_array()[14] == other.as_array()[14] { u8::MAX } else { 0 },\n if self.as_array()[15] == other.as_array()[15] { u8::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi8)\n\n\n * `PCMPEQB xmm, xmm`\n </li>\n </ul>"]
2995 #[inline(always)]
2996 fn cmp_eq(&self, other: U8x16) -> U8x16 {
2997 select_impl_block! { scalar { U8x16::from([ if self.as_array()[0] == other.as_array()[0] { u8::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u8::MAX } else { 0 }, if self.as_array()[2] == other.as_array()[2] { u8::MAX } else { 0 }, if self.as_array()[3] == other.as_array()[3] { u8::MAX } else { 0 }, if self.as_array()[4] == other.as_array()[4] { u8::MAX } else { 0 }, if self.as_array()[5] == other.as_array()[5] { u8::MAX } else { 0 }, if self.as_array()[6] == other.as_array()[6] { u8::MAX } else { 0 }, if self.as_array()[7] == other.as_array()[7] { u8::MAX } else { 0 }, if self.as_array()[8] == other.as_array()[8] { u8::MAX } else { 0 }, if self.as_array()[9] == other.as_array()[9] { u8::MAX } else { 0 }, if self.as_array()[10] == other.as_array()[10] { u8::MAX } else { 0 }, if self.as_array()[11] == other.as_array()[11] { u8::MAX } else { 0 }, if self.as_array()[12] == other.as_array()[12] { u8::MAX } else { 0 }, if self.as_array()[13] == other.as_array()[13] { u8::MAX } else { 0 }, if self.as_array()[14] == other.as_array()[14] { u8::MAX } else { 0 }, if self.as_array()[15] == other.as_array()[15] { u8::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi8 (self.0, other.0)) } }
2998 }
2999 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n self.as_array()[8] & (!other.as_array()[8]),\n self.as_array()[9] & (!other.as_array()[9]),\n self.as_array()[10] & (!other.as_array()[10]),\n self.as_array()[11] & (!other.as_array()[11]),\n self.as_array()[12] & (!other.as_array()[12]),\n self.as_array()[13] & (!other.as_array()[13]),\n self.as_array()[14] & (!other.as_array()[14]),\n self.as_array()[15] & (!other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
3000 #[inline(always)]
3001 fn and_not(&self, other: U8x16) -> U8x16 {
3002 select_impl_block! { scalar { U8x16::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), self.as_array()[8] & (!other.as_array()[8]), self.as_array()[9] & (!other.as_array()[9]), self.as_array()[10] & (!other.as_array()[10]), self.as_array()[11] & (!other.as_array()[11]), self.as_array()[12] & (!other.as_array()[12]), self.as_array()[13] & (!other.as_array()[13]), self.as_array()[14] & (!other.as_array()[14]), self.as_array()[15] & (!other.as_array()[15]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
3003 }
3004 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([\n if self.as_array()[0] > other.as_array()[0] { u8::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u8::MAX } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { u8::MAX } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { u8::MAX } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { u8::MAX } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { u8::MAX } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { u8::MAX } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { u8::MAX } else { 0 },\n if self.as_array()[8] > other.as_array()[8] { u8::MAX } else { 0 },\n if self.as_array()[9] > other.as_array()[9] { u8::MAX } else { 0 },\n if self.as_array()[10] > other.as_array()[10] { u8::MAX } else { 0 },\n if self.as_array()[11] > other.as_array()[11] { u8::MAX } else { 0 },\n if self.as_array()[12] > other.as_array()[12] { u8::MAX } else { 0 },\n if self.as_array()[13] > other.as_array()[13] { u8::MAX } else { 0 },\n if self.as_array()[14] > other.as_array()[14] { u8::MAX } else { 0 },\n if self.as_array()[15] > other.as_array()[15] { u8::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 7);\n Self::from(I8x16::from(*self ^ sign_bit).cmp_gt(\n I8x16::from(other ^ sign_bit)\n ))\n ```"]
3005 #[inline(always)]
3006 fn cmp_gt(&self, other: U8x16) -> U8x16 {
3007 select_impl_block! { scalar { U8x16::from([ if self.as_array()[0] > other.as_array()[0] { u8::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u8::MAX } else { 0 }, if self.as_array()[2] > other.as_array()[2] { u8::MAX } else { 0 }, if self.as_array()[3] > other.as_array()[3] { u8::MAX } else { 0 }, if self.as_array()[4] > other.as_array()[4] { u8::MAX } else { 0 }, if self.as_array()[5] > other.as_array()[5] { u8::MAX } else { 0 }, if self.as_array()[6] > other.as_array()[6] { u8::MAX } else { 0 }, if self.as_array()[7] > other.as_array()[7] { u8::MAX } else { 0 }, if self.as_array()[8] > other.as_array()[8] { u8::MAX } else { 0 }, if self.as_array()[9] > other.as_array()[9] { u8::MAX } else { 0 }, if self.as_array()[10] > other.as_array()[10] { u8::MAX } else { 0 }, if self.as_array()[11] > other.as_array()[11] { u8::MAX } else { 0 }, if self.as_array()[12] > other.as_array()[12] { u8::MAX } else { 0 }, if self.as_array()[13] > other.as_array()[13] { u8::MAX } else { 0 }, if self.as_array()[14] > other.as_array()[14] { u8::MAX } else { 0 }, if self.as_array()[15] > other.as_array()[15] { u8::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 7); Self::from(I8x16::from(*self ^ sign_bit).cmp_gt( I8x16::from(other ^ sign_bit) )) } }
3009 }
3010 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3011 #[inline(always)]
3012 fn shift_left<const BITS: usize>(&self) -> U8x16 {
3013 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U8x16::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U8x16::from(out) } }
3014 }
3015 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U8x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3016 #[inline(always)]
3017 fn shift_right<const BITS: usize>(&self) -> U8x16 {
3018 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U8x16::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U8x16::from(out) } }
3019 }
3020 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi8)\n\n\n * `PUNPCKLBW xmm, xmm`\n </li>\n </ul>"]
3021 #[inline(always)]
3022 fn unpack_lo(&self, other: U8x16) -> U8x16 {
3023 select_impl_block! { scalar { U8x16::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], ]) } avx2 { Self( avx2::_mm_unpacklo_epi8 (self.0, other.0)) } }
3025 }
3026 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([\n // Lane# 0\n self.as_array()[8],\n other.as_array()[8],\n self.as_array()[9],\n other.as_array()[9],\n self.as_array()[10],\n other.as_array()[10],\n self.as_array()[11],\n other.as_array()[11],\n self.as_array()[12],\n other.as_array()[12],\n self.as_array()[13],\n other.as_array()[13],\n self.as_array()[14],\n other.as_array()[14],\n self.as_array()[15],\n other.as_array()[15],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi8)\n\n\n * `PUNPCKHBW xmm, xmm`\n </li>\n </ul>"]
3027 #[inline(always)]
3028 fn unpack_hi(&self, other: U8x16) -> U8x16 {
3029 select_impl_block! { scalar { U8x16::from([ self.as_array()[8], other.as_array()[8], self.as_array()[9], other.as_array()[9], self.as_array()[10], other.as_array()[10], self.as_array()[11], other.as_array()[11], self.as_array()[12], other.as_array()[12], self.as_array()[13], other.as_array()[13], self.as_array()[14], other.as_array()[14], self.as_array()[15], other.as_array()[15], ]) } avx2 { Self( avx2::_mm_unpackhi_epi8 (self.0, other.0)) } }
3031 }
3032 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n self.as_array()[8].max(other.as_array()[8]),\n self.as_array()[9].max(other.as_array()[9]),\n self.as_array()[10].max(other.as_array()[10]),\n self.as_array()[11].max(other.as_array()[11]),\n self.as_array()[12].max(other.as_array()[12]),\n self.as_array()[13].max(other.as_array()[13]),\n self.as_array()[14].max(other.as_array()[14]),\n self.as_array()[15].max(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_max_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu8)\n\n\n * `PMAXUB xmm, xmm`\n </li>\n </ul>"]
3033 #[inline(always)]
3034 fn max(&self, other: U8x16) -> U8x16 {
3035 select_impl_block! { scalar { U8x16::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), self.as_array()[8].max(other.as_array()[8]), self.as_array()[9].max(other.as_array()[9]), self.as_array()[10].max(other.as_array()[10]), self.as_array()[11].max(other.as_array()[11]), self.as_array()[12].max(other.as_array()[12]), self.as_array()[13].max(other.as_array()[13]), self.as_array()[14].max(other.as_array()[14]), self.as_array()[15].max(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm_max_epu8 (self.0, other.0)) } }
3036 }
3037 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x16 ,\n # ) -> U8x16\n # {\n U8x16::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n self.as_array()[8].min(other.as_array()[8]),\n self.as_array()[9].min(other.as_array()[9]),\n self.as_array()[10].min(other.as_array()[10]),\n self.as_array()[11].min(other.as_array()[11]),\n self.as_array()[12].min(other.as_array()[12]),\n self.as_array()[13].min(other.as_array()[13]),\n self.as_array()[14].min(other.as_array()[14]),\n self.as_array()[15].min(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_min_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epu8)\n\n\n * `PMINUB xmm, xmm`\n </li>\n </ul>"]
3038 #[inline(always)]
3039 fn min(&self, other: U8x16) -> U8x16 {
3040 select_impl_block! { scalar { U8x16::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), self.as_array()[8].min(other.as_array()[8]), self.as_array()[9].min(other.as_array()[9]), self.as_array()[10].min(other.as_array()[10]), self.as_array()[11].min(other.as_array()[11]), self.as_array()[12].min(other.as_array()[12]), self.as_array()[13].min(other.as_array()[13]), self.as_array()[14].min(other.as_array()[14]), self.as_array()[15].min(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm_min_epu8 (self.0, other.0)) } }
3041 }
3042}
3043impl crate::SimdBase8 for U8x16 {
3044 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # {\n let mut out = [0; 16];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]);\n }\n U8x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_si128)\n\n\n * `PSLLDQ xmm, imm8`\n </li>\n </ul>"]
3045 #[inline(always)]
3046 fn shift_bytes_left<const AMOUNT: usize>(&self) -> U8x16 {
3047 select_impl_block! { scalar { let mut out = [0; 16]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]); } U8x16::from(out) } avx2 { Self( avx2::_mm_slli_si128 ::<AMOUNT>(self.0)) } }
3048 }
3049 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x16\n # {\n let mut out = [0; 16];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]);\n }\n U8x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srli_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_si128)\n\n\n * `PSRLDQ xmm, imm8`\n </li>\n </ul>"]
3050 #[inline(always)]
3051 fn shift_bytes_right<const AMOUNT: usize>(&self) -> U8x16 {
3052 select_impl_block! { scalar { let mut out = [0; 16]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]); } U8x16::from(out) } avx2 { Self( avx2::_mm_srli_si128 ::<AMOUNT>(self.0)) } }
3053 }
3054 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # {\n let mut out: u32 = 0;\n for (i, value) in self.as_array().iter().copied().enumerate() {\n out |= u32::from((value as u8) >> 7) << i;\n }\n out\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_movemask_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movemask_epi8)\n\n\n * `PMOVMSKB r32, xmm`\n </li>\n </ul>"]
3055 #[inline(always)]
3056 fn most_significant_bits(&self) -> u32 {
3057 select_impl_block! { scalar { let mut out: u32 = 0; for (i, value) in self.as_array().iter().copied().enumerate() { out |= u32::from((value as u8) >> 7) << i; } out } avx2 { avx2::_mm_movemask_epi8 (self.0) as u32 } }
3058 }
3059}
3060impl U8x16 {
3061 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x16 ,\n # ) -> U8x16\n # ;}\n # impl SomeTraitForDoc for U8x16 {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x16 ,\n # ) -> U8x16\n # {\n let mut arr = [0; 16];\n for (lane_dst, (lane_src, order)) in\n arr.chunks_exact_mut(16).zip(\n self.as_array().chunks_exact(16)\n .zip(order.as_array().chunks_exact(16))\n )\n {\n for (dst, idx) in lane_dst.iter_mut().zip(order) {\n let idx = *idx;\n *dst = if (idx >> 7) == 1 {\n 0\n } else {\n lane_src[(idx as usize) % 16]\n };\n }\n }\n arr.into()\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shuffle_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_epi8)\n\n\n * `PSHUFB xmm, xmm`\n </li>\n </ul>"]
3062 #[inline(always)]
3063 pub fn shuffle(&self, order: U8x16) -> U8x16 {
3064 select_impl_block! { scalar { let mut arr = [0; 16]; for (lane_dst, (lane_src, order)) in arr.chunks_exact_mut(16).zip( self.as_array().chunks_exact(16) .zip(order.as_array().chunks_exact(16)) ) { for (dst, idx) in lane_dst.iter_mut().zip(order) { let idx = *idx; *dst = if (idx >> 7) == 1 { 0 } else { lane_src[(idx as usize) % 16] }; } } arr.into() } avx2 { Self( avx2::_mm_shuffle_epi8 (self.0, order.0)) } }
3065 }
3066}
3067#[doc = "`[u8; 32]` as a vector."]
3068#[repr(transparent)]
3069#[derive(Clone, Copy)]
3070pub struct U8x32(U8x32Internal);
3071unsafe impl bytemuck::Pod for U8x32 {}
3072unsafe impl bytemuck::Zeroable for U8x32 {}
3073impl PartialEq for U8x32 {
3074 #[inline(always)]
3075 fn eq(&self, other: &Self) -> bool {
3076 ((*self) ^ (*other)).is_zero()
3077 }
3078}
3079impl Eq for U8x32 {}
3080impl Default for U8x32 {
3081 #[doc = "The zero vector."]
3082 #[inline(always)]
3083 fn default() -> Self {
3084 Self::ZERO
3085 }
3086}
3087impl std::hash::Hash for U8x32 {
3088 #[inline]
3089 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
3090 bytemuck::bytes_of(self).hash(state);
3091 }
3092}
3093impl std::fmt::Debug for U8x32 {
3094 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3095 write!(f, "U8x32({:?})", <[u8; 32]>::from(*self))
3096 }
3097}
3098impl subtle::ConstantTimeEq for U8x32 {
3099 fn ct_eq(&self, other: &Self) -> subtle::Choice {
3100 self.as_array().ct_eq(&other.as_array())
3101 }
3102}
3103impl subtle::ConditionallySelectable for U8x32 {
3104 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
3105 let mut out = [0; 32];
3106 for (out, (a, b)) in out
3107 .iter_mut()
3108 .zip(a.as_array().iter().zip(b.as_array().iter()))
3109 {
3110 *out = <u8 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
3111 }
3112 Self::from(out)
3113 }
3114}
3115impl rand::distributions::Distribution<U8x32> for rand::distributions::Standard {
3116 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U8x32 {
3117 let mut out = U8x32::ZERO;
3118 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
3119 out
3120 }
3121}
3122impl AsRef<[u8]> for U8x32 {
3123 fn as_ref(&self) -> &[u8] {
3124 let arr: &[u8; 32] = bytemuck::cast_ref(self);
3125 arr
3126 }
3127}
3128impl AsMut<[u8]> for U8x32 {
3129 fn as_mut(&mut self) -> &mut [u8] {
3130 let arr: &mut [u8; 32] = bytemuck::cast_mut(self);
3131 arr
3132 }
3133}
3134impl From<I8x32> for U8x32 {
3135 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x32\nas little endian bits of U8x32."]
3136 #[inline(always)]
3137 fn from(x: I8x32) -> U8x32 {
3138 Self({
3139 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3141 })
3142 }
3143}
3144impl From<I16x16> for U8x32 {
3145 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x16\nas little endian bits of U8x32."]
3146 #[inline(always)]
3147 fn from(x: I16x16) -> U8x32 {
3148 Self({
3149 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3151 })
3152 }
3153}
3154impl From<I32x8> for U8x32 {
3155 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x8\nas little endian bits of U8x32."]
3156 #[inline(always)]
3157 fn from(x: I32x8) -> U8x32 {
3158 Self({
3159 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3161 })
3162 }
3163}
3164impl From<I64x4> for U8x32 {
3165 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x4\nas little endian bits of U8x32."]
3166 #[inline(always)]
3167 fn from(x: I64x4) -> U8x32 {
3168 Self({
3169 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3171 })
3172 }
3173}
3174impl From<U16x16> for U8x32 {
3175 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x16\nas little endian bits of U8x32."]
3176 #[inline(always)]
3177 fn from(x: U16x16) -> U8x32 {
3178 Self({
3179 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3181 })
3182 }
3183}
3184impl From<U32x8> for U8x32 {
3185 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x8\nas little endian bits of U8x32."]
3186 #[inline(always)]
3187 fn from(x: U32x8) -> U8x32 {
3188 Self({
3189 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3191 })
3192 }
3193}
3194impl From<U64x4> for U8x32 {
3195 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x4\nas little endian bits of U8x32."]
3196 #[inline(always)]
3197 fn from(x: U64x4) -> U8x32 {
3198 Self({
3199 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3201 })
3202 }
3203}
3204impl From<U8x16> for U8x32 {
3205 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U8x32\n # {\n let mut out = [0; 32];\n out[0..16].copy_from_slice(&vector.as_array());\n U8x32::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
3206 #[inline(always)]
3207 fn from(vector: U8x16) -> U8x32 {
3208 select_impl_block! { scalar { let mut out = [0; 32]; out[0..16].copy_from_slice(&vector.as_array()); U8x32::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
3209 }
3210}
3211impl From<[U8x16; 2]> for U8x32 {
3212 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [U8x16; 2] ,\n # ) -> U8x32\n # {\n let mut out = [0; 32];\n out[0..16].copy_from_slice(&vectors[0].as_array());\n out[16..].copy_from_slice(&vectors[1].as_array());\n U8x32::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
3213 #[inline(always)]
3214 fn from(vectors: [U8x16; 2]) -> U8x32 {
3215 select_impl_block! { scalar { let mut out = [0; 32]; out[0..16].copy_from_slice(&vectors[0].as_array()); out[16..].copy_from_slice(&vectors[1].as_array()); U8x32::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
3216 }
3217} impl From<U8x32> for [U8x16; 2] {
3219 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x32 ,\n # ) -> [U8x16; 2]\n # {\n let mut lo = [0; 16];\n let mut hi = [0; 16];\n lo.copy_from_slice(&vector.as_array()[0..16]);\n hi.copy_from_slice(&vector.as_array()[16..]);\n [U8x16::from(lo), U8x16::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
3220 #[inline(always)]
3221 fn from(vector: U8x32) -> [U8x16; 2] {
3222 select_impl_block! { scalar { let mut lo = [0; 16]; let mut hi = [0; 16]; lo.copy_from_slice(&vector.as_array()[0..16]); hi.copy_from_slice(&vector.as_array()[16..]); [U8x16::from(lo), U8x16::from(hi)] } avx2 { [ U8x16( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), U8x16( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
3223 }
3224}
3225impl crate::SimdSaturatingArithmetic for U8x32 {
3226 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_adds_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_adds_epu8)\n\n\n * `VPADDUSB ymm, ymm, ymm`\n </li>\n </ul>"]
3227 #[inline(always)]
3228 fn saturating_add(&self, other: U8x32) -> U8x32 {
3229 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_adds_epu8 (self.0, other.0)) } }
3230 }
3231 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_subs_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_subs_epu8)\n\n\n * `VPSUBUSB ymm, ymm, ymm`\n </li>\n </ul>"]
3232 #[inline(always)]
3233 fn saturating_sub(&self, other: U8x32) -> U8x32 {
3234 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_subs_epu8 (self.0, other.0)) } }
3235 }
3236} impl ShlAssign<u64> for U8x32 {
3238 #[inline(always)]
3239 fn shl_assign(&mut self, amount: u64) {
3240 *self = (*self) << amount;
3241 }
3242}
3243impl Shl<u64> for U8x32 {
3244 type Output = Self;
3245 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x32\n # {\n if amount >= 8 {\n U8x32::ZERO\n } else {\n U8x32::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n self.as_array()[8] << amount,\n self.as_array()[9] << amount,\n self.as_array()[10] << amount,\n self.as_array()[11] << amount,\n self.as_array()[12] << amount,\n self.as_array()[13] << amount,\n self.as_array()[14] << amount,\n self.as_array()[15] << amount,\n self.as_array()[16] << amount,\n self.as_array()[17] << amount,\n self.as_array()[18] << amount,\n self.as_array()[19] << amount,\n self.as_array()[20] << amount,\n self.as_array()[21] << amount,\n self.as_array()[22] << amount,\n self.as_array()[23] << amount,\n self.as_array()[24] << amount,\n self.as_array()[25] << amount,\n self.as_array()[26] << amount,\n self.as_array()[27] << amount,\n self.as_array()[28] << amount,\n self.as_array()[29] << amount,\n self.as_array()[30] << amount,\n self.as_array()[31] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3246 #[inline(always)]
3247 fn shl(self, amount: u64) -> U8x32 {
3248 select_impl_block! { scalar { if amount >= 8 { U8x32::ZERO } else { U8x32::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, self.as_array()[16] << amount, self.as_array()[17] << amount, self.as_array()[18] << amount, self.as_array()[19] << amount, self.as_array()[20] << amount, self.as_array()[21] << amount, self.as_array()[22] << amount, self.as_array()[23] << amount, self.as_array()[24] << amount, self.as_array()[25] << amount, self.as_array()[26] << amount, self.as_array()[27] << amount, self.as_array()[28] << amount, self.as_array()[29] << amount, self.as_array()[30] << amount, self.as_array()[31] << amount, ]) } } avx2 { if amount >= 8 { U8x32::ZERO } else { U8x32::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, self.as_array()[16] << amount, self.as_array()[17] << amount, self.as_array()[18] << amount, self.as_array()[19] << amount, self.as_array()[20] << amount, self.as_array()[21] << amount, self.as_array()[22] << amount, self.as_array()[23] << amount, self.as_array()[24] << amount, self.as_array()[25] << amount, self.as_array()[26] << amount, self.as_array()[27] << amount, self.as_array()[28] << amount, self.as_array()[29] << amount, self.as_array()[30] << amount, self.as_array()[31] << amount, ]) } } }
3249 }
3250} impl ShlAssign<U8x32> for U8x32 {
3252 #[inline(always)]
3253 fn shl_assign(&mut self, amount: U8x32) {
3254 *self = (*self) << amount;
3255 }
3256}
3257impl Shl<U8x32> for U8x32 {
3258 type Output = Self;
3259 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x32 ,\n # ) -> U8x32\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3260 #[inline(always)]
3261 fn shl(self, amount: U8x32) -> U8x32 {
3262 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } U8x32::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x << amm } else { 0 }; } U8x32::from(out) } }
3263 }
3264} impl ShrAssign<u64> for U8x32 {
3266 #[inline(always)]
3267 fn shr_assign(&mut self, amount: u64) {
3268 *self = (*self) >> amount;
3269 }
3270}
3271impl Shr<u64> for U8x32 {
3272 type Output = Self;
3273 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U8x32\n # {\n if amount >= 8 {\n U8x32::ZERO\n } else {\n U8x32::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n self.as_array()[8] >> amount,\n self.as_array()[9] >> amount,\n self.as_array()[10] >> amount,\n self.as_array()[11] >> amount,\n self.as_array()[12] >> amount,\n self.as_array()[13] >> amount,\n self.as_array()[14] >> amount,\n self.as_array()[15] >> amount,\n self.as_array()[16] >> amount,\n self.as_array()[17] >> amount,\n self.as_array()[18] >> amount,\n self.as_array()[19] >> amount,\n self.as_array()[20] >> amount,\n self.as_array()[21] >> amount,\n self.as_array()[22] >> amount,\n self.as_array()[23] >> amount,\n self.as_array()[24] >> amount,\n self.as_array()[25] >> amount,\n self.as_array()[26] >> amount,\n self.as_array()[27] >> amount,\n self.as_array()[28] >> amount,\n self.as_array()[29] >> amount,\n self.as_array()[30] >> amount,\n self.as_array()[31] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3274 #[inline(always)]
3275 fn shr(self, amount: u64) -> U8x32 {
3276 select_impl_block! { scalar { if amount >= 8 { U8x32::ZERO } else { U8x32::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, self.as_array()[16] >> amount, self.as_array()[17] >> amount, self.as_array()[18] >> amount, self.as_array()[19] >> amount, self.as_array()[20] >> amount, self.as_array()[21] >> amount, self.as_array()[22] >> amount, self.as_array()[23] >> amount, self.as_array()[24] >> amount, self.as_array()[25] >> amount, self.as_array()[26] >> amount, self.as_array()[27] >> amount, self.as_array()[28] >> amount, self.as_array()[29] >> amount, self.as_array()[30] >> amount, self.as_array()[31] >> amount, ]) } } avx2 { if amount >= 8 { U8x32::ZERO } else { U8x32::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, self.as_array()[16] >> amount, self.as_array()[17] >> amount, self.as_array()[18] >> amount, self.as_array()[19] >> amount, self.as_array()[20] >> amount, self.as_array()[21] >> amount, self.as_array()[22] >> amount, self.as_array()[23] >> amount, self.as_array()[24] >> amount, self.as_array()[25] >> amount, self.as_array()[26] >> amount, self.as_array()[27] >> amount, self.as_array()[28] >> amount, self.as_array()[29] >> amount, self.as_array()[30] >> amount, self.as_array()[31] >> amount, ]) } } }
3277 }
3278} impl ShrAssign<U8x32> for U8x32 {
3280 #[inline(always)]
3281 fn shr_assign(&mut self, amount: U8x32) {
3282 *self = (*self) >> amount;
3283 }
3284}
3285impl Shr<U8x32> for U8x32 {
3286 type Output = Self;
3287 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U8x32 ,\n # ) -> U8x32\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..8).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3288 #[inline(always)]
3289 fn shr(self, amount: U8x32) -> U8x32 {
3290 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else { 0 }; } U8x32::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..8).contains(&amm) { *x >> amm } else { 0 }; } U8x32::from(out) } }
3291 }
3292}
3293impl SimdBase for U8x32 {
3294 type Scalar = u8;
3295 type Array = [u8; 32];
3296 type Signed = I8x32;
3297 type Unsigned = U8x32;
3298 const LANES: usize = 32;
3299 const ZERO: Self = Self::from_array([0; 32]);
3300 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
3301 #[inline(always)]
3302 fn is_zero(&self) -> bool {
3303 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
3304 }
3305 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u8 ,\n # ) -> U8x32\n # {\n let mut out = [0; 32];\n out[0] = scalar;\n U8x32::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3306 #[inline(always)]
3307 fn set_lo(scalar: u8) -> U8x32 {
3308 select_impl_block! { scalar { let mut out = [0; 32]; out[0] = scalar; U8x32::from(out) } avx2 { Self( avx2::_mm256_set_epi8 ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, scalar as i8, )) } }
3309 }
3310 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u8\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u8\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3311 #[inline(always)]
3312 fn extract<const I: usize>(&self) -> u8 {
3313 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi8 ::<I>(self.0) as u8 } }
3314 }
3315 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u8 ,\n # ) -> U8x32\n # {\n U8x32::from([scalar; 32])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi8)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3316 #[inline(always)]
3317 fn broadcast(scalar: u8) -> U8x32 {
3318 select_impl_block! { scalar { U8x32::from([scalar; 32]) } avx2 { Self( avx2::_mm256_set1_epi8 (scalar as i8)) } }
3319 }
3320 type BroadcastLoInput = U8x16;
3321 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U8x32\n # {\n U8x32::from([vector.as_array()[0]; 32])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastb_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastb_epi8)\n\n\n * `VPBROADCASTB ymm, xmm`\n </li>\n </ul>"]
3322 #[inline(always)]
3323 fn broadcast_lo(vector: U8x16) -> U8x32 {
3324 select_impl_block! { scalar { U8x32::from([vector.as_array()[0]; 32]) } avx2 { Self( avx2::_mm256_broadcastb_epi8 (vector.0)) } }
3325 }
3326 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n U8x32::from([\n if self.as_array()[0] == other.as_array()[0] { u8::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u8::MAX } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { u8::MAX } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { u8::MAX } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { u8::MAX } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { u8::MAX } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { u8::MAX } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { u8::MAX } else { 0 },\n if self.as_array()[8] == other.as_array()[8] { u8::MAX } else { 0 },\n if self.as_array()[9] == other.as_array()[9] { u8::MAX } else { 0 },\n if self.as_array()[10] == other.as_array()[10] { u8::MAX } else { 0 },\n if self.as_array()[11] == other.as_array()[11] { u8::MAX } else { 0 },\n if self.as_array()[12] == other.as_array()[12] { u8::MAX } else { 0 },\n if self.as_array()[13] == other.as_array()[13] { u8::MAX } else { 0 },\n if self.as_array()[14] == other.as_array()[14] { u8::MAX } else { 0 },\n if self.as_array()[15] == other.as_array()[15] { u8::MAX } else { 0 },\n if self.as_array()[16] == other.as_array()[16] { u8::MAX } else { 0 },\n if self.as_array()[17] == other.as_array()[17] { u8::MAX } else { 0 },\n if self.as_array()[18] == other.as_array()[18] { u8::MAX } else { 0 },\n if self.as_array()[19] == other.as_array()[19] { u8::MAX } else { 0 },\n if self.as_array()[20] == other.as_array()[20] { u8::MAX } else { 0 },\n if self.as_array()[21] == other.as_array()[21] { u8::MAX } else { 0 },\n if self.as_array()[22] == other.as_array()[22] { u8::MAX } else { 0 },\n if self.as_array()[23] == other.as_array()[23] { u8::MAX } else { 0 },\n if self.as_array()[24] == other.as_array()[24] { u8::MAX } else { 0 },\n if self.as_array()[25] == other.as_array()[25] { u8::MAX } else { 0 },\n if self.as_array()[26] == other.as_array()[26] { u8::MAX } else { 0 },\n if self.as_array()[27] == other.as_array()[27] { u8::MAX } else { 0 },\n if self.as_array()[28] == other.as_array()[28] { u8::MAX } else { 0 },\n if self.as_array()[29] == other.as_array()[29] { u8::MAX } else { 0 },\n if self.as_array()[30] == other.as_array()[30] { u8::MAX } else { 0 },\n if self.as_array()[31] == other.as_array()[31] { u8::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi8)\n\n\n * `VPCMPEQB ymm, ymm, ymm`\n </li>\n </ul>"]
3327 #[inline(always)]
3328 fn cmp_eq(&self, other: U8x32) -> U8x32 {
3329 select_impl_block! { scalar { U8x32::from([ if self.as_array()[0] == other.as_array()[0] { u8::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u8::MAX } else { 0 }, if self.as_array()[2] == other.as_array()[2] { u8::MAX } else { 0 }, if self.as_array()[3] == other.as_array()[3] { u8::MAX } else { 0 }, if self.as_array()[4] == other.as_array()[4] { u8::MAX } else { 0 }, if self.as_array()[5] == other.as_array()[5] { u8::MAX } else { 0 }, if self.as_array()[6] == other.as_array()[6] { u8::MAX } else { 0 }, if self.as_array()[7] == other.as_array()[7] { u8::MAX } else { 0 }, if self.as_array()[8] == other.as_array()[8] { u8::MAX } else { 0 }, if self.as_array()[9] == other.as_array()[9] { u8::MAX } else { 0 }, if self.as_array()[10] == other.as_array()[10] { u8::MAX } else { 0 }, if self.as_array()[11] == other.as_array()[11] { u8::MAX } else { 0 }, if self.as_array()[12] == other.as_array()[12] { u8::MAX } else { 0 }, if self.as_array()[13] == other.as_array()[13] { u8::MAX } else { 0 }, if self.as_array()[14] == other.as_array()[14] { u8::MAX } else { 0 }, if self.as_array()[15] == other.as_array()[15] { u8::MAX } else { 0 }, if self.as_array()[16] == other.as_array()[16] { u8::MAX } else { 0 }, if self.as_array()[17] == other.as_array()[17] { u8::MAX } else { 0 }, if self.as_array()[18] == other.as_array()[18] { u8::MAX } else { 0 }, if self.as_array()[19] == other.as_array()[19] { u8::MAX } else { 0 }, if self.as_array()[20] == other.as_array()[20] { u8::MAX } else { 0 }, if self.as_array()[21] == other.as_array()[21] { u8::MAX } else { 0 }, if self.as_array()[22] == other.as_array()[22] { u8::MAX } else { 0 }, if self.as_array()[23] == other.as_array()[23] { u8::MAX } else { 0 }, if self.as_array()[24] == other.as_array()[24] { u8::MAX } else { 0 }, if self.as_array()[25] == other.as_array()[25] { u8::MAX } else { 0 }, if self.as_array()[26] == other.as_array()[26] { u8::MAX } else { 0 }, if self.as_array()[27] == other.as_array()[27] { u8::MAX } else { 0 }, if self.as_array()[28] == other.as_array()[28] { u8::MAX } else { 0 }, if self.as_array()[29] == other.as_array()[29] { u8::MAX } else { 0 }, if self.as_array()[30] == other.as_array()[30] { u8::MAX } else { 0 }, if self.as_array()[31] == other.as_array()[31] { u8::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi8 (self.0, other.0)) } }
3330 }
3331 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n U8x32::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n self.as_array()[8] & (!other.as_array()[8]),\n self.as_array()[9] & (!other.as_array()[9]),\n self.as_array()[10] & (!other.as_array()[10]),\n self.as_array()[11] & (!other.as_array()[11]),\n self.as_array()[12] & (!other.as_array()[12]),\n self.as_array()[13] & (!other.as_array()[13]),\n self.as_array()[14] & (!other.as_array()[14]),\n self.as_array()[15] & (!other.as_array()[15]),\n self.as_array()[16] & (!other.as_array()[16]),\n self.as_array()[17] & (!other.as_array()[17]),\n self.as_array()[18] & (!other.as_array()[18]),\n self.as_array()[19] & (!other.as_array()[19]),\n self.as_array()[20] & (!other.as_array()[20]),\n self.as_array()[21] & (!other.as_array()[21]),\n self.as_array()[22] & (!other.as_array()[22]),\n self.as_array()[23] & (!other.as_array()[23]),\n self.as_array()[24] & (!other.as_array()[24]),\n self.as_array()[25] & (!other.as_array()[25]),\n self.as_array()[26] & (!other.as_array()[26]),\n self.as_array()[27] & (!other.as_array()[27]),\n self.as_array()[28] & (!other.as_array()[28]),\n self.as_array()[29] & (!other.as_array()[29]),\n self.as_array()[30] & (!other.as_array()[30]),\n self.as_array()[31] & (!other.as_array()[31]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
3332 #[inline(always)]
3333 fn and_not(&self, other: U8x32) -> U8x32 {
3334 select_impl_block! { scalar { U8x32::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), self.as_array()[8] & (!other.as_array()[8]), self.as_array()[9] & (!other.as_array()[9]), self.as_array()[10] & (!other.as_array()[10]), self.as_array()[11] & (!other.as_array()[11]), self.as_array()[12] & (!other.as_array()[12]), self.as_array()[13] & (!other.as_array()[13]), self.as_array()[14] & (!other.as_array()[14]), self.as_array()[15] & (!other.as_array()[15]), self.as_array()[16] & (!other.as_array()[16]), self.as_array()[17] & (!other.as_array()[17]), self.as_array()[18] & (!other.as_array()[18]), self.as_array()[19] & (!other.as_array()[19]), self.as_array()[20] & (!other.as_array()[20]), self.as_array()[21] & (!other.as_array()[21]), self.as_array()[22] & (!other.as_array()[22]), self.as_array()[23] & (!other.as_array()[23]), self.as_array()[24] & (!other.as_array()[24]), self.as_array()[25] & (!other.as_array()[25]), self.as_array()[26] & (!other.as_array()[26]), self.as_array()[27] & (!other.as_array()[27]), self.as_array()[28] & (!other.as_array()[28]), self.as_array()[29] & (!other.as_array()[29]), self.as_array()[30] & (!other.as_array()[30]), self.as_array()[31] & (!other.as_array()[31]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
3335 }
3336 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n U8x32::from([\n if self.as_array()[0] > other.as_array()[0] { u8::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u8::MAX } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { u8::MAX } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { u8::MAX } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { u8::MAX } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { u8::MAX } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { u8::MAX } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { u8::MAX } else { 0 },\n if self.as_array()[8] > other.as_array()[8] { u8::MAX } else { 0 },\n if self.as_array()[9] > other.as_array()[9] { u8::MAX } else { 0 },\n if self.as_array()[10] > other.as_array()[10] { u8::MAX } else { 0 },\n if self.as_array()[11] > other.as_array()[11] { u8::MAX } else { 0 },\n if self.as_array()[12] > other.as_array()[12] { u8::MAX } else { 0 },\n if self.as_array()[13] > other.as_array()[13] { u8::MAX } else { 0 },\n if self.as_array()[14] > other.as_array()[14] { u8::MAX } else { 0 },\n if self.as_array()[15] > other.as_array()[15] { u8::MAX } else { 0 },\n if self.as_array()[16] > other.as_array()[16] { u8::MAX } else { 0 },\n if self.as_array()[17] > other.as_array()[17] { u8::MAX } else { 0 },\n if self.as_array()[18] > other.as_array()[18] { u8::MAX } else { 0 },\n if self.as_array()[19] > other.as_array()[19] { u8::MAX } else { 0 },\n if self.as_array()[20] > other.as_array()[20] { u8::MAX } else { 0 },\n if self.as_array()[21] > other.as_array()[21] { u8::MAX } else { 0 },\n if self.as_array()[22] > other.as_array()[22] { u8::MAX } else { 0 },\n if self.as_array()[23] > other.as_array()[23] { u8::MAX } else { 0 },\n if self.as_array()[24] > other.as_array()[24] { u8::MAX } else { 0 },\n if self.as_array()[25] > other.as_array()[25] { u8::MAX } else { 0 },\n if self.as_array()[26] > other.as_array()[26] { u8::MAX } else { 0 },\n if self.as_array()[27] > other.as_array()[27] { u8::MAX } else { 0 },\n if self.as_array()[28] > other.as_array()[28] { u8::MAX } else { 0 },\n if self.as_array()[29] > other.as_array()[29] { u8::MAX } else { 0 },\n if self.as_array()[30] > other.as_array()[30] { u8::MAX } else { 0 },\n if self.as_array()[31] > other.as_array()[31] { u8::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 7);\n Self::from(I8x32::from(*self ^ sign_bit).cmp_gt(\n I8x32::from(other ^ sign_bit)\n ))\n ```"]
3337 #[inline(always)]
3338 fn cmp_gt(&self, other: U8x32) -> U8x32 {
3339 select_impl_block! { scalar { U8x32::from([ if self.as_array()[0] > other.as_array()[0] { u8::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u8::MAX } else { 0 }, if self.as_array()[2] > other.as_array()[2] { u8::MAX } else { 0 }, if self.as_array()[3] > other.as_array()[3] { u8::MAX } else { 0 }, if self.as_array()[4] > other.as_array()[4] { u8::MAX } else { 0 }, if self.as_array()[5] > other.as_array()[5] { u8::MAX } else { 0 }, if self.as_array()[6] > other.as_array()[6] { u8::MAX } else { 0 }, if self.as_array()[7] > other.as_array()[7] { u8::MAX } else { 0 }, if self.as_array()[8] > other.as_array()[8] { u8::MAX } else { 0 }, if self.as_array()[9] > other.as_array()[9] { u8::MAX } else { 0 }, if self.as_array()[10] > other.as_array()[10] { u8::MAX } else { 0 }, if self.as_array()[11] > other.as_array()[11] { u8::MAX } else { 0 }, if self.as_array()[12] > other.as_array()[12] { u8::MAX } else { 0 }, if self.as_array()[13] > other.as_array()[13] { u8::MAX } else { 0 }, if self.as_array()[14] > other.as_array()[14] { u8::MAX } else { 0 }, if self.as_array()[15] > other.as_array()[15] { u8::MAX } else { 0 }, if self.as_array()[16] > other.as_array()[16] { u8::MAX } else { 0 }, if self.as_array()[17] > other.as_array()[17] { u8::MAX } else { 0 }, if self.as_array()[18] > other.as_array()[18] { u8::MAX } else { 0 }, if self.as_array()[19] > other.as_array()[19] { u8::MAX } else { 0 }, if self.as_array()[20] > other.as_array()[20] { u8::MAX } else { 0 }, if self.as_array()[21] > other.as_array()[21] { u8::MAX } else { 0 }, if self.as_array()[22] > other.as_array()[22] { u8::MAX } else { 0 }, if self.as_array()[23] > other.as_array()[23] { u8::MAX } else { 0 }, if self.as_array()[24] > other.as_array()[24] { u8::MAX } else { 0 }, if self.as_array()[25] > other.as_array()[25] { u8::MAX } else { 0 }, if self.as_array()[26] > other.as_array()[26] { u8::MAX } else { 0 }, if self.as_array()[27] > other.as_array()[27] { u8::MAX } else { 0 }, if self.as_array()[28] > other.as_array()[28] { u8::MAX } else { 0 }, if self.as_array()[29] > other.as_array()[29] { u8::MAX } else { 0 }, if self.as_array()[30] > other.as_array()[30] { u8::MAX } else { 0 }, if self.as_array()[31] > other.as_array()[31] { u8::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 7); Self::from(I8x32::from(*self ^ sign_bit).cmp_gt( I8x32::from(other ^ sign_bit) )) } }
3341 }
3342 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3343 #[inline(always)]
3344 fn shift_left<const BITS: usize>(&self) -> U8x32 {
3345 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U8x32::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U8x32::from(out) } }
3346 }
3347 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U8x32::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3348 #[inline(always)]
3349 fn shift_right<const BITS: usize>(&self) -> U8x32 {
3350 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U8x32::from(out) } avx2 { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U8x32::from(out) } }
3351 }
3352 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n U8x32::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n // Lane# 1\n self.as_array()[16],\n other.as_array()[16],\n self.as_array()[17],\n other.as_array()[17],\n self.as_array()[18],\n other.as_array()[18],\n self.as_array()[19],\n other.as_array()[19],\n self.as_array()[20],\n other.as_array()[20],\n self.as_array()[21],\n other.as_array()[21],\n self.as_array()[22],\n other.as_array()[22],\n self.as_array()[23],\n other.as_array()[23],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi8)\n\n\n * `VPUNPCKLBW ymm, ymm, ymm`\n </li>\n </ul>"]
3353 #[inline(always)]
3354 fn unpack_lo(&self, other: U8x32) -> U8x32 {
3355 select_impl_block! { scalar { U8x32::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], self.as_array()[16], other.as_array()[16], self.as_array()[17], other.as_array()[17], self.as_array()[18], other.as_array()[18], self.as_array()[19], other.as_array()[19], self.as_array()[20], other.as_array()[20], self.as_array()[21], other.as_array()[21], self.as_array()[22], other.as_array()[22], self.as_array()[23], other.as_array()[23], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi8 (self.0, other.0)) } }
3358 }
3359 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n U8x32::from([\n // Lane# 0\n self.as_array()[8],\n other.as_array()[8],\n self.as_array()[9],\n other.as_array()[9],\n self.as_array()[10],\n other.as_array()[10],\n self.as_array()[11],\n other.as_array()[11],\n self.as_array()[12],\n other.as_array()[12],\n self.as_array()[13],\n other.as_array()[13],\n self.as_array()[14],\n other.as_array()[14],\n self.as_array()[15],\n other.as_array()[15],\n // Lane# 1\n self.as_array()[24],\n other.as_array()[24],\n self.as_array()[25],\n other.as_array()[25],\n self.as_array()[26],\n other.as_array()[26],\n self.as_array()[27],\n other.as_array()[27],\n self.as_array()[28],\n other.as_array()[28],\n self.as_array()[29],\n other.as_array()[29],\n self.as_array()[30],\n other.as_array()[30],\n self.as_array()[31],\n other.as_array()[31],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi8)\n\n\n * `VPUNPCKHBW ymm, ymm, ymm`\n </li>\n </ul>"]
3360 #[inline(always)]
3361 fn unpack_hi(&self, other: U8x32) -> U8x32 {
3362 select_impl_block! { scalar { U8x32::from([ self.as_array()[8], other.as_array()[8], self.as_array()[9], other.as_array()[9], self.as_array()[10], other.as_array()[10], self.as_array()[11], other.as_array()[11], self.as_array()[12], other.as_array()[12], self.as_array()[13], other.as_array()[13], self.as_array()[14], other.as_array()[14], self.as_array()[15], other.as_array()[15], self.as_array()[24], other.as_array()[24], self.as_array()[25], other.as_array()[25], self.as_array()[26], other.as_array()[26], self.as_array()[27], other.as_array()[27], self.as_array()[28], other.as_array()[28], self.as_array()[29], other.as_array()[29], self.as_array()[30], other.as_array()[30], self.as_array()[31], other.as_array()[31], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi8 (self.0, other.0)) } }
3365 }
3366 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n U8x32::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n self.as_array()[8].max(other.as_array()[8]),\n self.as_array()[9].max(other.as_array()[9]),\n self.as_array()[10].max(other.as_array()[10]),\n self.as_array()[11].max(other.as_array()[11]),\n self.as_array()[12].max(other.as_array()[12]),\n self.as_array()[13].max(other.as_array()[13]),\n self.as_array()[14].max(other.as_array()[14]),\n self.as_array()[15].max(other.as_array()[15]),\n self.as_array()[16].max(other.as_array()[16]),\n self.as_array()[17].max(other.as_array()[17]),\n self.as_array()[18].max(other.as_array()[18]),\n self.as_array()[19].max(other.as_array()[19]),\n self.as_array()[20].max(other.as_array()[20]),\n self.as_array()[21].max(other.as_array()[21]),\n self.as_array()[22].max(other.as_array()[22]),\n self.as_array()[23].max(other.as_array()[23]),\n self.as_array()[24].max(other.as_array()[24]),\n self.as_array()[25].max(other.as_array()[25]),\n self.as_array()[26].max(other.as_array()[26]),\n self.as_array()[27].max(other.as_array()[27]),\n self.as_array()[28].max(other.as_array()[28]),\n self.as_array()[29].max(other.as_array()[29]),\n self.as_array()[30].max(other.as_array()[30]),\n self.as_array()[31].max(other.as_array()[31]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_max_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_max_epu8)\n\n\n * `VPMAXUB ymm, ymm, ymm`\n </li>\n </ul>"]
3367 #[inline(always)]
3368 fn max(&self, other: U8x32) -> U8x32 {
3369 select_impl_block! { scalar { U8x32::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), self.as_array()[8].max(other.as_array()[8]), self.as_array()[9].max(other.as_array()[9]), self.as_array()[10].max(other.as_array()[10]), self.as_array()[11].max(other.as_array()[11]), self.as_array()[12].max(other.as_array()[12]), self.as_array()[13].max(other.as_array()[13]), self.as_array()[14].max(other.as_array()[14]), self.as_array()[15].max(other.as_array()[15]), self.as_array()[16].max(other.as_array()[16]), self.as_array()[17].max(other.as_array()[17]), self.as_array()[18].max(other.as_array()[18]), self.as_array()[19].max(other.as_array()[19]), self.as_array()[20].max(other.as_array()[20]), self.as_array()[21].max(other.as_array()[21]), self.as_array()[22].max(other.as_array()[22]), self.as_array()[23].max(other.as_array()[23]), self.as_array()[24].max(other.as_array()[24]), self.as_array()[25].max(other.as_array()[25]), self.as_array()[26].max(other.as_array()[26]), self.as_array()[27].max(other.as_array()[27]), self.as_array()[28].max(other.as_array()[28]), self.as_array()[29].max(other.as_array()[29]), self.as_array()[30].max(other.as_array()[30]), self.as_array()[31].max(other.as_array()[31]), ]) } avx2 { Self( avx2::_mm256_max_epu8 (self.0, other.0)) } }
3370 }
3371 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U8x32 ,\n # ) -> U8x32\n # {\n U8x32::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n self.as_array()[8].min(other.as_array()[8]),\n self.as_array()[9].min(other.as_array()[9]),\n self.as_array()[10].min(other.as_array()[10]),\n self.as_array()[11].min(other.as_array()[11]),\n self.as_array()[12].min(other.as_array()[12]),\n self.as_array()[13].min(other.as_array()[13]),\n self.as_array()[14].min(other.as_array()[14]),\n self.as_array()[15].min(other.as_array()[15]),\n self.as_array()[16].min(other.as_array()[16]),\n self.as_array()[17].min(other.as_array()[17]),\n self.as_array()[18].min(other.as_array()[18]),\n self.as_array()[19].min(other.as_array()[19]),\n self.as_array()[20].min(other.as_array()[20]),\n self.as_array()[21].min(other.as_array()[21]),\n self.as_array()[22].min(other.as_array()[22]),\n self.as_array()[23].min(other.as_array()[23]),\n self.as_array()[24].min(other.as_array()[24]),\n self.as_array()[25].min(other.as_array()[25]),\n self.as_array()[26].min(other.as_array()[26]),\n self.as_array()[27].min(other.as_array()[27]),\n self.as_array()[28].min(other.as_array()[28]),\n self.as_array()[29].min(other.as_array()[29]),\n self.as_array()[30].min(other.as_array()[30]),\n self.as_array()[31].min(other.as_array()[31]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_min_epu8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_min_epu8)\n\n\n * `VPMINUB ymm, ymm, ymm`\n </li>\n </ul>"]
3372 #[inline(always)]
3373 fn min(&self, other: U8x32) -> U8x32 {
3374 select_impl_block! { scalar { U8x32::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), self.as_array()[8].min(other.as_array()[8]), self.as_array()[9].min(other.as_array()[9]), self.as_array()[10].min(other.as_array()[10]), self.as_array()[11].min(other.as_array()[11]), self.as_array()[12].min(other.as_array()[12]), self.as_array()[13].min(other.as_array()[13]), self.as_array()[14].min(other.as_array()[14]), self.as_array()[15].min(other.as_array()[15]), self.as_array()[16].min(other.as_array()[16]), self.as_array()[17].min(other.as_array()[17]), self.as_array()[18].min(other.as_array()[18]), self.as_array()[19].min(other.as_array()[19]), self.as_array()[20].min(other.as_array()[20]), self.as_array()[21].min(other.as_array()[21]), self.as_array()[22].min(other.as_array()[22]), self.as_array()[23].min(other.as_array()[23]), self.as_array()[24].min(other.as_array()[24]), self.as_array()[25].min(other.as_array()[25]), self.as_array()[26].min(other.as_array()[26]), self.as_array()[27].min(other.as_array()[27]), self.as_array()[28].min(other.as_array()[28]), self.as_array()[29].min(other.as_array()[29]), self.as_array()[30].min(other.as_array()[30]), self.as_array()[31].min(other.as_array()[31]), ]) } avx2 { Self( avx2::_mm256_min_epu8 (self.0, other.0)) } }
3375 }
3376}
3377impl crate::SimdBase8 for U8x32 {
3378 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # {\n let mut out = [0; 32];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]);\n }\n U8x32::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_si256)\n\n\n * `VPSLLDQ ymm, ymm, imm8`\n </li>\n </ul>"]
3379 #[inline(always)]
3380 fn shift_bytes_left<const AMOUNT: usize>(&self) -> U8x32 {
3381 select_impl_block! { scalar { let mut out = [0; 32]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]); } U8x32::from(out) } avx2 { Self( avx2::_mm256_slli_si256 ::<AMOUNT>(self.0)) } }
3382 }
3383 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # <\n # const AMOUNT: usize,\n # >\n # (\n # &self ,\n # ) -> U8x32\n # {\n let mut out = [0; 32];\n for (out_lane, src_lane) in out\n .chunks_exact_mut(16)\n .zip(self.as_array().chunks_exact(16))\n {\n out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]);\n }\n U8x32::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srli_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srli_si256)\n\n\n * `VPSRLDQ ymm, ymm, imm8`\n </li>\n </ul>"]
3384 #[inline(always)]
3385 fn shift_bytes_right<const AMOUNT: usize>(&self) -> U8x32 {
3386 select_impl_block! { scalar { let mut out = [0; 32]; for (out_lane, src_lane) in out .chunks_exact_mut(16) .zip(self.as_array().chunks_exact(16)) { out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]); } U8x32::from(out) } avx2 { Self( avx2::_mm256_srli_si256 ::<AMOUNT>(self.0)) } }
3387 }
3388 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> u32\n # {\n let mut out: u32 = 0;\n for (i, value) in self.as_array().iter().copied().enumerate() {\n out |= u32::from((value as u8) >> 7) << i;\n }\n out\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_movemask_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_movemask_epi8)\n\n\n * `VPMOVMSKB r32, ymm`\n </li>\n </ul>"]
3389 #[inline(always)]
3390 fn most_significant_bits(&self) -> u32 {
3391 select_impl_block! { scalar { let mut out: u32 = 0; for (i, value) in self.as_array().iter().copied().enumerate() { out |= u32::from((value as u8) >> 7) << i; } out } avx2 { avx2::_mm256_movemask_epi8 (self.0) as u32 } }
3392 }
3393}
3394impl U8x32 {
3395 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x32 ,\n # ) -> U8x32\n # ;}\n # impl SomeTraitForDoc for U8x32 {\n # fn the_doc_function\n # (\n # &self ,\n # order : U8x32 ,\n # ) -> U8x32\n # {\n let mut arr = [0; 32];\n for (lane_dst, (lane_src, order)) in\n arr.chunks_exact_mut(16).zip(\n self.as_array().chunks_exact(16)\n .zip(order.as_array().chunks_exact(16))\n )\n {\n for (dst, idx) in lane_dst.iter_mut().zip(order) {\n let idx = *idx;\n *dst = if (idx >> 7) == 1 {\n 0\n } else {\n lane_src[(idx as usize) % 16]\n };\n }\n }\n arr.into()\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shuffle_epi8`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shuffle_epi8)\n\n\n * `VPSHUFB ymm, ymm, ymm`\n </li>\n </ul>"]
3396 #[inline(always)]
3397 pub fn shuffle(&self, order: U8x32) -> U8x32 {
3398 select_impl_block! { scalar { let mut arr = [0; 32]; for (lane_dst, (lane_src, order)) in arr.chunks_exact_mut(16).zip( self.as_array().chunks_exact(16) .zip(order.as_array().chunks_exact(16)) ) { for (dst, idx) in lane_dst.iter_mut().zip(order) { let idx = *idx; *dst = if (idx >> 7) == 1 { 0 } else { lane_src[(idx as usize) % 16] }; } } arr.into() } avx2 { Self( avx2::_mm256_shuffle_epi8 (self.0, order.0)) } }
3399 }
3400}
3401#[doc = "`[u16; 8]` as a vector."]
3402#[repr(transparent)]
3403#[derive(Clone, Copy)]
3404pub struct U16x8(U16x8Internal);
3405unsafe impl bytemuck::Pod for U16x8 {}
3406unsafe impl bytemuck::Zeroable for U16x8 {}
3407impl PartialEq for U16x8 {
3408 #[inline(always)]
3409 fn eq(&self, other: &Self) -> bool {
3410 ((*self) ^ (*other)).is_zero()
3411 }
3412}
3413impl Eq for U16x8 {}
3414impl Default for U16x8 {
3415 #[doc = "The zero vector."]
3416 #[inline(always)]
3417 fn default() -> Self {
3418 Self::ZERO
3419 }
3420}
3421impl std::hash::Hash for U16x8 {
3422 #[inline]
3423 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
3424 bytemuck::bytes_of(self).hash(state);
3425 }
3426}
3427impl std::fmt::Debug for U16x8 {
3428 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3429 write!(f, "U16x8({:?})", <[u16; 8]>::from(*self))
3430 }
3431}
3432impl subtle::ConstantTimeEq for U16x8 {
3433 fn ct_eq(&self, other: &Self) -> subtle::Choice {
3434 self.as_array().ct_eq(&other.as_array())
3435 }
3436}
3437impl subtle::ConditionallySelectable for U16x8 {
3438 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
3439 let mut out = [0; 8];
3440 for (out, (a, b)) in out
3441 .iter_mut()
3442 .zip(a.as_array().iter().zip(b.as_array().iter()))
3443 {
3444 *out = <u16 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
3445 }
3446 Self::from(out)
3447 }
3448}
3449impl rand::distributions::Distribution<U16x8> for rand::distributions::Standard {
3450 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U16x8 {
3451 let mut out = U16x8::ZERO;
3452 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
3453 out
3454 }
3455}
3456impl AsRef<[u16]> for U16x8 {
3457 fn as_ref(&self) -> &[u16] {
3458 let arr: &[u16; 8] = bytemuck::cast_ref(self);
3459 arr
3460 }
3461}
3462impl AsMut<[u16]> for U16x8 {
3463 fn as_mut(&mut self) -> &mut [u16] {
3464 let arr: &mut [u16; 8] = bytemuck::cast_mut(self);
3465 arr
3466 }
3467}
3468impl From<I8x16> for U16x8 {
3469 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x16\nas little endian bits of U16x8."]
3470 #[inline(always)]
3471 fn from(x: I8x16) -> U16x8 {
3472 Self({
3473 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3475 })
3476 }
3477}
3478impl From<I16x8> for U16x8 {
3479 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x8\nas little endian bits of U16x8."]
3480 #[inline(always)]
3481 fn from(x: I16x8) -> U16x8 {
3482 Self({
3483 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3485 })
3486 }
3487}
3488impl From<I32x4> for U16x8 {
3489 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x4\nas little endian bits of U16x8."]
3490 #[inline(always)]
3491 fn from(x: I32x4) -> U16x8 {
3492 Self({
3493 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3495 })
3496 }
3497}
3498impl From<I64x2> for U16x8 {
3499 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x2\nas little endian bits of U16x8."]
3500 #[inline(always)]
3501 fn from(x: I64x2) -> U16x8 {
3502 Self({
3503 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3505 })
3506 }
3507}
3508impl From<U8x16> for U16x8 {
3509 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x16\nas little endian bits of U16x8."]
3510 #[inline(always)]
3511 fn from(x: U8x16) -> U16x8 {
3512 Self({
3513 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3515 })
3516 }
3517}
3518impl From<U32x4> for U16x8 {
3519 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x4\nas little endian bits of U16x8."]
3520 #[inline(always)]
3521 fn from(x: U32x4) -> U16x8 {
3522 Self({
3523 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3525 })
3526 }
3527}
3528impl From<U64x2> for U16x8 {
3529 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x2\nas little endian bits of U16x8."]
3530 #[inline(always)]
3531 fn from(x: U64x2) -> U16x8 {
3532 Self({
3533 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3535 })
3536 }
3537}
3538impl crate::ExtendingCast<U8x16> for U16x8 {
3539 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U16x8\n # {\n U16x8::from([\n u16::from(vector.as_array()[0]),\n u16::from(vector.as_array()[1]),\n u16::from(vector.as_array()[2]),\n u16::from(vector.as_array()[3]),\n u16::from(vector.as_array()[4]),\n u16::from(vector.as_array()[5]),\n u16::from(vector.as_array()[6]),\n u16::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepu8_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepu8_epi16)\n\n\n * `PMOVZXBW xmm, xmm`\n </li>\n </ul>"]
3540 #[inline(always)]
3541 fn extending_cast_from(vector: U8x16) -> U16x8 {
3542 select_impl_block! { scalar { U16x8::from([ u16::from(vector.as_array()[0]), u16::from(vector.as_array()[1]), u16::from(vector.as_array()[2]), u16::from(vector.as_array()[3]), u16::from(vector.as_array()[4]), u16::from(vector.as_array()[5]), u16::from(vector.as_array()[6]), u16::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm_cvtepu8_epi16 (vector.0)) } }
3543 }
3544}
3545impl crate::SimdSaturatingArithmetic for U16x8 {
3546 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_adds_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_adds_epu16)\n\n\n * `PADDUSW xmm, xmm`\n </li>\n </ul>"]
3547 #[inline(always)]
3548 fn saturating_add(&self, other: U16x8) -> U16x8 {
3549 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm_adds_epu16 (self.0, other.0)) } }
3550 }
3551 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_subs_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_subs_epu16)\n\n\n * `PSUBUSW xmm, xmm`\n </li>\n </ul>"]
3552 #[inline(always)]
3553 fn saturating_sub(&self, other: U16x8) -> U16x8 {
3554 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm_subs_epu16 (self.0, other.0)) } }
3555 }
3556} impl ShlAssign<u64> for U16x8 {
3558 #[inline(always)]
3559 fn shl_assign(&mut self, amount: u64) {
3560 *self = (*self) << amount;
3561 }
3562}
3563impl Shl<u64> for U16x8 {
3564 type Output = Self;
3565 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x8\n # {\n if amount >= 16 {\n U16x8::ZERO\n } else {\n U16x8::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_sll_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi16)\n\n\n * `PSLLW xmm, xmm`\n </li>\n </ul>"]
3566 #[inline(always)]
3567 fn shl(self, amount: u64) -> U16x8 {
3568 select_impl_block! { scalar { if amount >= 16 { U16x8::ZERO } else { U16x8::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_sll_epi16 (self.0, amount)) } }
3569 }
3570} impl ShlAssign<U16x8> for U16x8 {
3572 #[inline(always)]
3573 fn shl_assign(&mut self, amount: U16x8) {
3574 *self = (*self) << amount;
3575 }
3576}
3577impl Shl<U16x8> for U16x8 {
3578 type Output = Self;
3579 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x8 ,\n # ) -> U16x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U16x8::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3580 #[inline(always)]
3581 fn shl(self, amount: U16x8) -> U16x8 {
3582 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } U16x8::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } U16x8::from(out) } }
3583 }
3584} impl ShrAssign<u64> for U16x8 {
3586 #[inline(always)]
3587 fn shr_assign(&mut self, amount: u64) {
3588 *self = (*self) >> amount;
3589 }
3590}
3591impl Shr<u64> for U16x8 {
3592 type Output = Self;
3593 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x8\n # {\n if amount >= 16 {\n U16x8::ZERO\n } else {\n U16x8::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_srl_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srl_epi16)\n\n\n * `PSRLW xmm, xmm`\n </li>\n </ul>"]
3594 #[inline(always)]
3595 fn shr(self, amount: u64) -> U16x8 {
3596 select_impl_block! { scalar { if amount >= 16 { U16x8::ZERO } else { U16x8::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_srl_epi16 (self.0, amount)) } }
3597 }
3598} impl ShrAssign<U16x8> for U16x8 {
3600 #[inline(always)]
3601 fn shr_assign(&mut self, amount: U16x8) {
3602 *self = (*self) >> amount;
3603 }
3604}
3605impl Shr<U16x8> for U16x8 {
3606 type Output = Self;
3607 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x8 ,\n # ) -> U16x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U16x8::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3608 #[inline(always)]
3609 fn shr(self, amount: U16x8) -> U16x8 {
3610 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else { 0 }; } U16x8::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else { 0 }; } U16x8::from(out) } }
3611 }
3612}
3613impl SimdBase for U16x8 {
3614 type Scalar = u16;
3615 type Array = [u16; 8];
3616 type Signed = I16x8;
3617 type Unsigned = U16x8;
3618 const LANES: usize = 8;
3619 const ZERO: Self = Self::from_array([0; 8]);
3620 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
3621 #[inline(always)]
3622 fn is_zero(&self) -> bool {
3623 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
3624 }
3625 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u16 ,\n # ) -> U16x8\n # {\n let mut out = [0; 8];\n out[0] = scalar;\n U16x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3626 #[inline(always)]
3627 fn set_lo(scalar: u16) -> U16x8 {
3628 select_impl_block! { scalar { let mut out = [0; 8]; out[0] = scalar; U16x8::from(out) } avx2 { Self( avx2::_mm_set_epi16 ( 0, 0, 0, 0, 0, 0, 0, scalar as i16, )) } }
3629 }
3630 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u16\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u16\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi16)\n\n\n * `PEXTRW r32, xmm, imm8`\n </li>\n </ul>"]
3631 #[inline(always)]
3632 fn extract<const I: usize>(&self) -> u16 {
3633 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi16 ::<I>(self.0) as u16 } }
3634 }
3635 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u16 ,\n # ) -> U16x8\n # {\n U16x8::from([scalar; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3636 #[inline(always)]
3637 fn broadcast(scalar: u16) -> U16x8 {
3638 select_impl_block! { scalar { U16x8::from([scalar; 8]) } avx2 { Self( avx2::_mm_set1_epi16 (scalar as i16)) } }
3639 }
3640 type BroadcastLoInput = U16x8;
3641 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([vector.as_array()[0]; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastw_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastw_epi16)\n\n\n * `VPBROADCASTW xmm, xmm`\n </li>\n </ul>"]
3642 #[inline(always)]
3643 fn broadcast_lo(vector: U16x8) -> U16x8 {
3644 select_impl_block! { scalar { U16x8::from([vector.as_array()[0]; 8]) } avx2 { Self( avx2::_mm_broadcastw_epi16 (vector.0)) } }
3645 }
3646 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n if self.as_array()[0] == other.as_array()[0] { u16::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u16::MAX } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { u16::MAX } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { u16::MAX } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { u16::MAX } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { u16::MAX } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { u16::MAX } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { u16::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi16)\n\n\n * `PCMPEQW xmm, xmm`\n </li>\n </ul>"]
3647 #[inline(always)]
3648 fn cmp_eq(&self, other: U16x8) -> U16x8 {
3649 select_impl_block! { scalar { U16x8::from([ if self.as_array()[0] == other.as_array()[0] { u16::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u16::MAX } else { 0 }, if self.as_array()[2] == other.as_array()[2] { u16::MAX } else { 0 }, if self.as_array()[3] == other.as_array()[3] { u16::MAX } else { 0 }, if self.as_array()[4] == other.as_array()[4] { u16::MAX } else { 0 }, if self.as_array()[5] == other.as_array()[5] { u16::MAX } else { 0 }, if self.as_array()[6] == other.as_array()[6] { u16::MAX } else { 0 }, if self.as_array()[7] == other.as_array()[7] { u16::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi16 (self.0, other.0)) } }
3650 }
3651 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
3652 #[inline(always)]
3653 fn and_not(&self, other: U16x8) -> U16x8 {
3654 select_impl_block! { scalar { U16x8::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
3655 }
3656 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n if self.as_array()[0] > other.as_array()[0] { u16::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u16::MAX } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { u16::MAX } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { u16::MAX } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { u16::MAX } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { u16::MAX } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { u16::MAX } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { u16::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 15);\n Self::from(I16x8::from(*self ^ sign_bit).cmp_gt(\n I16x8::from(other ^ sign_bit)\n ))\n ```"]
3657 #[inline(always)]
3658 fn cmp_gt(&self, other: U16x8) -> U16x8 {
3659 select_impl_block! { scalar { U16x8::from([ if self.as_array()[0] > other.as_array()[0] { u16::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u16::MAX } else { 0 }, if self.as_array()[2] > other.as_array()[2] { u16::MAX } else { 0 }, if self.as_array()[3] > other.as_array()[3] { u16::MAX } else { 0 }, if self.as_array()[4] > other.as_array()[4] { u16::MAX } else { 0 }, if self.as_array()[5] > other.as_array()[5] { u16::MAX } else { 0 }, if self.as_array()[6] > other.as_array()[6] { u16::MAX } else { 0 }, if self.as_array()[7] > other.as_array()[7] { u16::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 15); Self::from(I16x8::from(*self ^ sign_bit).cmp_gt( I16x8::from(other ^ sign_bit) )) } }
3661 }
3662 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U16x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi16)\n\n\n * `PSLLW xmm, imm8`\n </li>\n </ul>"]
3663 #[inline(always)]
3664 fn shift_left<const BITS: usize>(&self) -> U16x8 {
3665 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U16x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_slli_epi16 ::<BITS>(self.0)) } }
3666 }
3667 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U16x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srli_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi16)\n\n\n * `PSRLW xmm, imm8`\n </li>\n </ul>"]
3668 #[inline(always)]
3669 fn shift_right<const BITS: usize>(&self) -> U16x8 {
3670 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U16x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_srli_epi16 ::<BITS>(self.0)) } }
3671 }
3672 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi16)\n\n\n * `PUNPCKLWD xmm, xmm`\n </li>\n </ul>"]
3673 #[inline(always)]
3674 fn unpack_lo(&self, other: U16x8) -> U16x8 {
3675 select_impl_block! { scalar { U16x8::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], ]) } avx2 { Self( avx2::_mm_unpacklo_epi16 (self.0, other.0)) } }
3677 }
3678 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n // Lane# 0\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi16)\n\n\n * `PUNPCKHWD xmm, xmm`\n </li>\n </ul>"]
3679 #[inline(always)]
3680 fn unpack_hi(&self, other: U16x8) -> U16x8 {
3681 select_impl_block! { scalar { U16x8::from([ self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], ]) } avx2 { Self( avx2::_mm_unpackhi_epi16 (self.0, other.0)) } }
3683 }
3684 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_max_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu16)\n\n\n * `PMAXUW xmm, xmm`\n </li>\n </ul>"]
3685 #[inline(always)]
3686 fn max(&self, other: U16x8) -> U16x8 {
3687 select_impl_block! { scalar { U16x8::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm_max_epu16 (self.0, other.0)) } }
3688 }
3689 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_min_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epu16)\n\n\n * `PMINUW xmm, xmm`\n </li>\n </ul>"]
3690 #[inline(always)]
3691 fn min(&self, other: U16x8) -> U16x8 {
3692 select_impl_block! { scalar { U16x8::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm_min_epu16 (self.0, other.0)) } }
3693 }
3694}
3695impl crate::SimdBase16 for U16x8 {
3696 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # {\n U16x8::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 8],\n self.as_array()[I1 + 0 * 8],\n self.as_array()[I2 + 0 * 8],\n self.as_array()[I3 + 0 * 8],\n self.as_array()[4 + 0 * 8],\n self.as_array()[5 + 0 * 8],\n self.as_array()[6 + 0 * 8],\n self.as_array()[7 + 0 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shufflelo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shufflelo_epi16)\n\n\n * `PSHUFLW xmm, xmm, imm8`\n </li>\n </ul>"]
3697 #[inline(always)]
3698 fn shuffle_lo<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
3699 &self,
3700 ) -> U16x8 {
3701 select_impl_block! { scalar { U16x8::from([ self.as_array()[I0 + 0 * 8], self.as_array()[I1 + 0 * 8], self.as_array()[I2 + 0 * 8], self.as_array()[I3 + 0 * 8], self.as_array()[4 + 0 * 8], self.as_array()[5 + 0 * 8], self.as_array()[6 + 0 * 8], self.as_array()[7 + 0 * 8], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm_shufflelo_epi16 ::<I3, I2, I1, I0>(self.0)) } }
3703 }
3704 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x8\n # {\n U16x8::from([\n // 128-bit Lane #0\n self.as_array()[0 + 0 * 8],\n self.as_array()[1 + 0 * 8],\n self.as_array()[2 + 0 * 8],\n self.as_array()[3 + 0 * 8],\n self.as_array()[I0 + 4 + 0 * 8],\n self.as_array()[I1 + 4 + 0 * 8],\n self.as_array()[I2 + 4 + 0 * 8],\n self.as_array()[I3 + 4 + 0 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shufflehi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shufflehi_epi16)\n\n\n * `PSHUFHW xmm, xmm, imm8`\n </li>\n </ul>"]
3705 #[inline(always)]
3706 fn shuffle_hi<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
3707 &self,
3708 ) -> U16x8 {
3709 select_impl_block! { scalar { U16x8::from([ self.as_array()[0 + 0 * 8], self.as_array()[1 + 0 * 8], self.as_array()[2 + 0 * 8], self.as_array()[3 + 0 * 8], self.as_array()[I0 + 4 + 0 * 8], self.as_array()[I1 + 4 + 0 * 8], self.as_array()[I2 + 4 + 0 * 8], self.as_array()[I3 + 4 + 0 * 8], ]) } avx2 { if I0 > 4 { panic!("I0 ({I0}) > 4"); } if I1 > 4 { panic!("I1 ({I1}) > 4"); } if I2 > 4 { panic!("I2 ({I2}) > 4"); } if I3 > 4 { panic!("I3 ({I3}) > 4"); } Self( avx2::_mm_shufflehi_epi16 ::<I3, I2, I1, I0>(self.0)) } }
3711 }
3712}
3713impl crate::SimdBase8x for U16x8 {
3714 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U16x8 ,\n # ) -> U16x8\n # ;}\n # impl SomeTraitForDoc for U16x8 {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U16x8 ,\n # ) -> U16x8\n # {\n U16x8::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n (if B4 { if_true } else { *self }).as_array()[4],\n (if B5 { if_true } else { *self }).as_array()[5],\n (if B6 { if_true } else { *self }).as_array()[6],\n (if B7 { if_true } else { *self }).as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_blend_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blend_epi16)\n\n\n * `PBLENDW xmm, xmm, imm8`\n </li>\n </ul>"]
3715 #[inline(always)]
3716 fn blend<
3717 const B7: bool,
3718 const B6: bool,
3719 const B5: bool,
3720 const B4: bool,
3721 const B3: bool,
3722 const B2: bool,
3723 const B1: bool,
3724 const B0: bool,
3725 >(
3726 &self,
3727 if_true: U16x8,
3728 ) -> U16x8 {
3729 select_impl_block! { scalar { U16x8::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], (if B4 { if_true } else { *self }).as_array()[4], (if B5 { if_true } else { *self }).as_array()[5], (if B6 { if_true } else { *self }).as_array()[6], (if B7 { if_true } else { *self }).as_array()[7], ]) } avx2 { Self( avx2::_mm_blend_epi16 ::<B7, B6, B5, B4, B3, B2, B1, B0>(self.0, if_true.0)) } }
3730 }
3731}
3732#[doc = "`[u16; 16]` as a vector."]
3733#[repr(transparent)]
3734#[derive(Clone, Copy)]
3735pub struct U16x16(U16x16Internal);
3736unsafe impl bytemuck::Pod for U16x16 {}
3737unsafe impl bytemuck::Zeroable for U16x16 {}
3738impl PartialEq for U16x16 {
3739 #[inline(always)]
3740 fn eq(&self, other: &Self) -> bool {
3741 ((*self) ^ (*other)).is_zero()
3742 }
3743}
3744impl Eq for U16x16 {}
3745impl Default for U16x16 {
3746 #[doc = "The zero vector."]
3747 #[inline(always)]
3748 fn default() -> Self {
3749 Self::ZERO
3750 }
3751}
3752impl std::hash::Hash for U16x16 {
3753 #[inline]
3754 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
3755 bytemuck::bytes_of(self).hash(state);
3756 }
3757}
3758impl std::fmt::Debug for U16x16 {
3759 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3760 write!(f, "U16x16({:?})", <[u16; 16]>::from(*self))
3761 }
3762}
3763impl subtle::ConstantTimeEq for U16x16 {
3764 fn ct_eq(&self, other: &Self) -> subtle::Choice {
3765 self.as_array().ct_eq(&other.as_array())
3766 }
3767}
3768impl subtle::ConditionallySelectable for U16x16 {
3769 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
3770 let mut out = [0; 16];
3771 for (out, (a, b)) in out
3772 .iter_mut()
3773 .zip(a.as_array().iter().zip(b.as_array().iter()))
3774 {
3775 *out = <u16 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
3776 }
3777 Self::from(out)
3778 }
3779}
3780impl rand::distributions::Distribution<U16x16> for rand::distributions::Standard {
3781 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U16x16 {
3782 let mut out = U16x16::ZERO;
3783 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
3784 out
3785 }
3786}
3787impl AsRef<[u16]> for U16x16 {
3788 fn as_ref(&self) -> &[u16] {
3789 let arr: &[u16; 16] = bytemuck::cast_ref(self);
3790 arr
3791 }
3792}
3793impl AsMut<[u16]> for U16x16 {
3794 fn as_mut(&mut self) -> &mut [u16] {
3795 let arr: &mut [u16; 16] = bytemuck::cast_mut(self);
3796 arr
3797 }
3798}
3799impl From<I8x32> for U16x16 {
3800 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x32\nas little endian bits of U16x16."]
3801 #[inline(always)]
3802 fn from(x: I8x32) -> U16x16 {
3803 Self({
3804 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3806 })
3807 }
3808}
3809impl From<I16x16> for U16x16 {
3810 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x16\nas little endian bits of U16x16."]
3811 #[inline(always)]
3812 fn from(x: I16x16) -> U16x16 {
3813 Self({
3814 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3816 })
3817 }
3818}
3819impl From<I32x8> for U16x16 {
3820 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x8\nas little endian bits of U16x16."]
3821 #[inline(always)]
3822 fn from(x: I32x8) -> U16x16 {
3823 Self({
3824 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3826 })
3827 }
3828}
3829impl From<I64x4> for U16x16 {
3830 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x4\nas little endian bits of U16x16."]
3831 #[inline(always)]
3832 fn from(x: I64x4) -> U16x16 {
3833 Self({
3834 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3836 })
3837 }
3838}
3839impl From<U8x32> for U16x16 {
3840 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x32\nas little endian bits of U16x16."]
3841 #[inline(always)]
3842 fn from(x: U8x32) -> U16x16 {
3843 Self({
3844 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3846 })
3847 }
3848}
3849impl From<U32x8> for U16x16 {
3850 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x8\nas little endian bits of U16x16."]
3851 #[inline(always)]
3852 fn from(x: U32x8) -> U16x16 {
3853 Self({
3854 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3856 })
3857 }
3858}
3859impl From<U64x4> for U16x16 {
3860 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x4\nas little endian bits of U16x16."]
3861 #[inline(always)]
3862 fn from(x: U64x4) -> U16x16 {
3863 Self({
3864 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
3866 })
3867 }
3868}
3869impl From<U8x16> for U16x16 {
3870 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n u16::from(vector.as_array()[0]),\n u16::from(vector.as_array()[1]),\n u16::from(vector.as_array()[2]),\n u16::from(vector.as_array()[3]),\n u16::from(vector.as_array()[4]),\n u16::from(vector.as_array()[5]),\n u16::from(vector.as_array()[6]),\n u16::from(vector.as_array()[7]),\n u16::from(vector.as_array()[8]),\n u16::from(vector.as_array()[9]),\n u16::from(vector.as_array()[10]),\n u16::from(vector.as_array()[11]),\n u16::from(vector.as_array()[12]),\n u16::from(vector.as_array()[13]),\n u16::from(vector.as_array()[14]),\n u16::from(vector.as_array()[15]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu8_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu8_epi16)\n\n\n * `VPMOVZXBW ymm, xmm`\n </li>\n </ul>"]
3871 #[inline(always)]
3872 fn from(vector: U8x16) -> U16x16 {
3873 select_impl_block! { scalar { U16x16::from([ u16::from(vector.as_array()[0]), u16::from(vector.as_array()[1]), u16::from(vector.as_array()[2]), u16::from(vector.as_array()[3]), u16::from(vector.as_array()[4]), u16::from(vector.as_array()[5]), u16::from(vector.as_array()[6]), u16::from(vector.as_array()[7]), u16::from(vector.as_array()[8]), u16::from(vector.as_array()[9]), u16::from(vector.as_array()[10]), u16::from(vector.as_array()[11]), u16::from(vector.as_array()[12]), u16::from(vector.as_array()[13]), u16::from(vector.as_array()[14]), u16::from(vector.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_cvtepu8_epi16 (vector.0)) } }
3874 }
3875}
3876impl crate::ExtendingCast<U8x16> for U16x16 {
3877 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n u16::from(vector.as_array()[0]),\n u16::from(vector.as_array()[1]),\n u16::from(vector.as_array()[2]),\n u16::from(vector.as_array()[3]),\n u16::from(vector.as_array()[4]),\n u16::from(vector.as_array()[5]),\n u16::from(vector.as_array()[6]),\n u16::from(vector.as_array()[7]),\n u16::from(vector.as_array()[8]),\n u16::from(vector.as_array()[9]),\n u16::from(vector.as_array()[10]),\n u16::from(vector.as_array()[11]),\n u16::from(vector.as_array()[12]),\n u16::from(vector.as_array()[13]),\n u16::from(vector.as_array()[14]),\n u16::from(vector.as_array()[15]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu8_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu8_epi16)\n\n\n * `VPMOVZXBW ymm, xmm`\n </li>\n </ul>"]
3878 #[inline(always)]
3879 fn extending_cast_from(vector: U8x16) -> U16x16 {
3880 select_impl_block! { scalar { U16x16::from([ u16::from(vector.as_array()[0]), u16::from(vector.as_array()[1]), u16::from(vector.as_array()[2]), u16::from(vector.as_array()[3]), u16::from(vector.as_array()[4]), u16::from(vector.as_array()[5]), u16::from(vector.as_array()[6]), u16::from(vector.as_array()[7]), u16::from(vector.as_array()[8]), u16::from(vector.as_array()[9]), u16::from(vector.as_array()[10]), u16::from(vector.as_array()[11]), u16::from(vector.as_array()[12]), u16::from(vector.as_array()[13]), u16::from(vector.as_array()[14]), u16::from(vector.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_cvtepu8_epi16 (vector.0)) } }
3881 }
3882}
3883impl From<U16x8> for U16x16 {
3884 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U16x16\n # {\n let mut out = [0; 16];\n out[0..8].copy_from_slice(&vector.as_array());\n U16x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
3885 #[inline(always)]
3886 fn from(vector: U16x8) -> U16x16 {
3887 select_impl_block! { scalar { let mut out = [0; 16]; out[0..8].copy_from_slice(&vector.as_array()); U16x16::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
3888 }
3889}
3890impl From<[U16x8; 2]> for U16x16 {
3891 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [U16x8; 2] ,\n # ) -> U16x16\n # {\n let mut out = [0; 16];\n out[0..8].copy_from_slice(&vectors[0].as_array());\n out[8..].copy_from_slice(&vectors[1].as_array());\n U16x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
3892 #[inline(always)]
3893 fn from(vectors: [U16x8; 2]) -> U16x16 {
3894 select_impl_block! { scalar { let mut out = [0; 16]; out[0..8].copy_from_slice(&vectors[0].as_array()); out[8..].copy_from_slice(&vectors[1].as_array()); U16x16::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
3895 }
3896} impl From<U16x16> for [U16x8; 2] {
3898 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x16 ,\n # ) -> [U16x8; 2]\n # {\n let mut lo = [0; 8];\n let mut hi = [0; 8];\n lo.copy_from_slice(&vector.as_array()[0..8]);\n hi.copy_from_slice(&vector.as_array()[8..]);\n [U16x8::from(lo), U16x8::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
3899 #[inline(always)]
3900 fn from(vector: U16x16) -> [U16x8; 2] {
3901 select_impl_block! { scalar { let mut lo = [0; 8]; let mut hi = [0; 8]; lo.copy_from_slice(&vector.as_array()[0..8]); hi.copy_from_slice(&vector.as_array()[8..]); [U16x8::from(lo), U16x8::from(hi)] } avx2 { [ U16x8( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), U16x8( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
3902 }
3903}
3904impl crate::SimdSaturatingArithmetic for U16x16 {
3905 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_add(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_adds_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_adds_epu16)\n\n\n * `VPADDUSW ymm, ymm, ymm`\n </li>\n </ul>"]
3906 #[inline(always)]
3907 fn saturating_add(&self, other: U16x16) -> U16x16 {
3908 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_add(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_adds_epu16 (self.0, other.0)) } }
3909 }
3910 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n let mut out = self.as_array();\n for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {\n *dst = dst.saturating_sub(*src);\n }\n Self::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_subs_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_subs_epu16)\n\n\n * `VPSUBUSW ymm, ymm, ymm`\n </li>\n </ul>"]
3911 #[inline(always)]
3912 fn saturating_sub(&self, other: U16x16) -> U16x16 {
3913 select_impl_block! { scalar { let mut out = self.as_array(); for (dst, src) in out.iter_mut().zip(other.as_array().iter()) { *dst = dst.saturating_sub(*src); } Self::from(out) } avx2 { Self( avx2::_mm256_subs_epu16 (self.0, other.0)) } }
3914 }
3915} impl ShlAssign<u64> for U16x16 {
3917 #[inline(always)]
3918 fn shl_assign(&mut self, amount: u64) {
3919 *self = (*self) << amount;
3920 }
3921}
3922impl Shl<u64> for U16x16 {
3923 type Output = Self;
3924 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x16\n # {\n if amount >= 16 {\n U16x16::ZERO\n } else {\n U16x16::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n self.as_array()[8] << amount,\n self.as_array()[9] << amount,\n self.as_array()[10] << amount,\n self.as_array()[11] << amount,\n self.as_array()[12] << amount,\n self.as_array()[13] << amount,\n self.as_array()[14] << amount,\n self.as_array()[15] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sll_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sll_epi16)\n\n\n * `VPSLLW ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3925 #[inline(always)]
3926 fn shl(self, amount: u64) -> U16x16 {
3927 select_impl_block! { scalar { if amount >= 16 { U16x16::ZERO } else { U16x16::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, self.as_array()[8] << amount, self.as_array()[9] << amount, self.as_array()[10] << amount, self.as_array()[11] << amount, self.as_array()[12] << amount, self.as_array()[13] << amount, self.as_array()[14] << amount, self.as_array()[15] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_sll_epi16 (self.0, amount)) } }
3928 }
3929} impl ShlAssign<U16x16> for U16x16 {
3931 #[inline(always)]
3932 fn shl_assign(&mut self, amount: U16x16) {
3933 *self = (*self) << amount;
3934 }
3935}
3936impl Shl<U16x16> for U16x16 {
3937 type Output = Self;
3938 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x16 ,\n # ) -> U16x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U16x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3939 #[inline(always)]
3940 fn shl(self, amount: U16x16) -> U16x16 {
3941 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } U16x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x << amm } else { 0 }; } U16x16::from(out) } }
3942 }
3943} impl ShrAssign<u64> for U16x16 {
3945 #[inline(always)]
3946 fn shr_assign(&mut self, amount: u64) {
3947 *self = (*self) >> amount;
3948 }
3949}
3950impl Shr<u64> for U16x16 {
3951 type Output = Self;
3952 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U16x16\n # {\n if amount >= 16 {\n U16x16::ZERO\n } else {\n U16x16::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n self.as_array()[8] >> amount,\n self.as_array()[9] >> amount,\n self.as_array()[10] >> amount,\n self.as_array()[11] >> amount,\n self.as_array()[12] >> amount,\n self.as_array()[13] >> amount,\n self.as_array()[14] >> amount,\n self.as_array()[15] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srl_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srl_epi16)\n\n\n * `VPSRLW ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3953 #[inline(always)]
3954 fn shr(self, amount: u64) -> U16x16 {
3955 select_impl_block! { scalar { if amount >= 16 { U16x16::ZERO } else { U16x16::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, self.as_array()[8] >> amount, self.as_array()[9] >> amount, self.as_array()[10] >> amount, self.as_array()[11] >> amount, self.as_array()[12] >> amount, self.as_array()[13] >> amount, self.as_array()[14] >> amount, self.as_array()[15] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_srl_epi16 (self.0, amount)) } }
3956 }
3957} impl ShrAssign<U16x16> for U16x16 {
3959 #[inline(always)]
3960 fn shr_assign(&mut self, amount: U16x16) {
3961 *self = (*self) >> amount;
3962 }
3963}
3964impl Shr<U16x16> for U16x16 {
3965 type Output = Self;
3966 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U16x16 ,\n # ) -> U16x16\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..16).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U16x16::from(out)\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
3967 #[inline(always)]
3968 fn shr(self, amount: U16x16) -> U16x16 {
3969 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else { 0 }; } U16x16::from(out) } avx2 { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..16).contains(&amm) { *x >> amm } else { 0 }; } U16x16::from(out) } }
3970 }
3971}
3972impl SimdBase for U16x16 {
3973 type Scalar = u16;
3974 type Array = [u16; 16];
3975 type Signed = I16x16;
3976 type Unsigned = U16x16;
3977 const LANES: usize = 16;
3978 const ZERO: Self = Self::from_array([0; 16]);
3979 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
3980 #[inline(always)]
3981 fn is_zero(&self) -> bool {
3982 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
3983 }
3984 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u16 ,\n # ) -> U16x16\n # {\n let mut out = [0; 16];\n out[0] = scalar;\n U16x16::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3985 #[inline(always)]
3986 fn set_lo(scalar: u16) -> U16x16 {
3987 select_impl_block! { scalar { let mut out = [0; 16]; out[0] = scalar; U16x16::from(out) } avx2 { Self( avx2::_mm256_set_epi16 ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, scalar as i16, )) } }
3988 }
3989 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u16\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3990 #[inline(always)]
3991 fn extract<const I: usize>(&self) -> u16 {
3992 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi16 ::<I>(self.0) as u16 } }
3993 }
3994 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u16 ,\n # ) -> U16x16\n # {\n U16x16::from([scalar; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi16)\n\n\n Instruction sequence.\n </li>\n </ul>"]
3995 #[inline(always)]
3996 fn broadcast(scalar: u16) -> U16x16 {
3997 select_impl_block! { scalar { U16x16::from([scalar; 16]) } avx2 { Self( avx2::_mm256_set1_epi16 (scalar as i16)) } }
3998 }
3999 type BroadcastLoInput = U16x8;
4000 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U16x16\n # {\n U16x16::from([vector.as_array()[0]; 16])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastw_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastw_epi16)\n\n\n * `VPBROADCASTW ymm, xmm`\n </li>\n </ul>"]
4001 #[inline(always)]
4002 fn broadcast_lo(vector: U16x8) -> U16x16 {
4003 select_impl_block! { scalar { U16x16::from([vector.as_array()[0]; 16]) } avx2 { Self( avx2::_mm256_broadcastw_epi16 (vector.0)) } }
4004 }
4005 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n if self.as_array()[0] == other.as_array()[0] { u16::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u16::MAX } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { u16::MAX } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { u16::MAX } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { u16::MAX } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { u16::MAX } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { u16::MAX } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { u16::MAX } else { 0 },\n if self.as_array()[8] == other.as_array()[8] { u16::MAX } else { 0 },\n if self.as_array()[9] == other.as_array()[9] { u16::MAX } else { 0 },\n if self.as_array()[10] == other.as_array()[10] { u16::MAX } else { 0 },\n if self.as_array()[11] == other.as_array()[11] { u16::MAX } else { 0 },\n if self.as_array()[12] == other.as_array()[12] { u16::MAX } else { 0 },\n if self.as_array()[13] == other.as_array()[13] { u16::MAX } else { 0 },\n if self.as_array()[14] == other.as_array()[14] { u16::MAX } else { 0 },\n if self.as_array()[15] == other.as_array()[15] { u16::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi16)\n\n\n * `VPCMPEQW ymm, ymm, ymm`\n </li>\n </ul>"]
4006 #[inline(always)]
4007 fn cmp_eq(&self, other: U16x16) -> U16x16 {
4008 select_impl_block! { scalar { U16x16::from([ if self.as_array()[0] == other.as_array()[0] { u16::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u16::MAX } else { 0 }, if self.as_array()[2] == other.as_array()[2] { u16::MAX } else { 0 }, if self.as_array()[3] == other.as_array()[3] { u16::MAX } else { 0 }, if self.as_array()[4] == other.as_array()[4] { u16::MAX } else { 0 }, if self.as_array()[5] == other.as_array()[5] { u16::MAX } else { 0 }, if self.as_array()[6] == other.as_array()[6] { u16::MAX } else { 0 }, if self.as_array()[7] == other.as_array()[7] { u16::MAX } else { 0 }, if self.as_array()[8] == other.as_array()[8] { u16::MAX } else { 0 }, if self.as_array()[9] == other.as_array()[9] { u16::MAX } else { 0 }, if self.as_array()[10] == other.as_array()[10] { u16::MAX } else { 0 }, if self.as_array()[11] == other.as_array()[11] { u16::MAX } else { 0 }, if self.as_array()[12] == other.as_array()[12] { u16::MAX } else { 0 }, if self.as_array()[13] == other.as_array()[13] { u16::MAX } else { 0 }, if self.as_array()[14] == other.as_array()[14] { u16::MAX } else { 0 }, if self.as_array()[15] == other.as_array()[15] { u16::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi16 (self.0, other.0)) } }
4009 }
4010 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n self.as_array()[8] & (!other.as_array()[8]),\n self.as_array()[9] & (!other.as_array()[9]),\n self.as_array()[10] & (!other.as_array()[10]),\n self.as_array()[11] & (!other.as_array()[11]),\n self.as_array()[12] & (!other.as_array()[12]),\n self.as_array()[13] & (!other.as_array()[13]),\n self.as_array()[14] & (!other.as_array()[14]),\n self.as_array()[15] & (!other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
4011 #[inline(always)]
4012 fn and_not(&self, other: U16x16) -> U16x16 {
4013 select_impl_block! { scalar { U16x16::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), self.as_array()[8] & (!other.as_array()[8]), self.as_array()[9] & (!other.as_array()[9]), self.as_array()[10] & (!other.as_array()[10]), self.as_array()[11] & (!other.as_array()[11]), self.as_array()[12] & (!other.as_array()[12]), self.as_array()[13] & (!other.as_array()[13]), self.as_array()[14] & (!other.as_array()[14]), self.as_array()[15] & (!other.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
4014 }
4015 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n if self.as_array()[0] > other.as_array()[0] { u16::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u16::MAX } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { u16::MAX } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { u16::MAX } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { u16::MAX } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { u16::MAX } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { u16::MAX } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { u16::MAX } else { 0 },\n if self.as_array()[8] > other.as_array()[8] { u16::MAX } else { 0 },\n if self.as_array()[9] > other.as_array()[9] { u16::MAX } else { 0 },\n if self.as_array()[10] > other.as_array()[10] { u16::MAX } else { 0 },\n if self.as_array()[11] > other.as_array()[11] { u16::MAX } else { 0 },\n if self.as_array()[12] > other.as_array()[12] { u16::MAX } else { 0 },\n if self.as_array()[13] > other.as_array()[13] { u16::MAX } else { 0 },\n if self.as_array()[14] > other.as_array()[14] { u16::MAX } else { 0 },\n if self.as_array()[15] > other.as_array()[15] { u16::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 15);\n Self::from(I16x16::from(*self ^ sign_bit).cmp_gt(\n I16x16::from(other ^ sign_bit)\n ))\n ```"]
4016 #[inline(always)]
4017 fn cmp_gt(&self, other: U16x16) -> U16x16 {
4018 select_impl_block! { scalar { U16x16::from([ if self.as_array()[0] > other.as_array()[0] { u16::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u16::MAX } else { 0 }, if self.as_array()[2] > other.as_array()[2] { u16::MAX } else { 0 }, if self.as_array()[3] > other.as_array()[3] { u16::MAX } else { 0 }, if self.as_array()[4] > other.as_array()[4] { u16::MAX } else { 0 }, if self.as_array()[5] > other.as_array()[5] { u16::MAX } else { 0 }, if self.as_array()[6] > other.as_array()[6] { u16::MAX } else { 0 }, if self.as_array()[7] > other.as_array()[7] { u16::MAX } else { 0 }, if self.as_array()[8] > other.as_array()[8] { u16::MAX } else { 0 }, if self.as_array()[9] > other.as_array()[9] { u16::MAX } else { 0 }, if self.as_array()[10] > other.as_array()[10] { u16::MAX } else { 0 }, if self.as_array()[11] > other.as_array()[11] { u16::MAX } else { 0 }, if self.as_array()[12] > other.as_array()[12] { u16::MAX } else { 0 }, if self.as_array()[13] > other.as_array()[13] { u16::MAX } else { 0 }, if self.as_array()[14] > other.as_array()[14] { u16::MAX } else { 0 }, if self.as_array()[15] > other.as_array()[15] { u16::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 15); Self::from(I16x16::from(*self ^ sign_bit).cmp_gt( I16x16::from(other ^ sign_bit) )) } }
4020 }
4021 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U16x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_epi16)\n\n\n * `VPSLLW ymm, ymm, imm8`\n </li>\n </ul>"]
4022 #[inline(always)]
4023 fn shift_left<const BITS: usize>(&self) -> U16x16 {
4024 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U16x16::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_slli_epi16 ::<BITS>(self.0)) } }
4025 }
4026 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U16x16::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srli_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srli_epi16)\n\n\n * `VPSRLW ymm, ymm, imm8`\n </li>\n </ul>"]
4027 #[inline(always)]
4028 fn shift_right<const BITS: usize>(&self) -> U16x16 {
4029 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U16x16::from(out) } avx2 { const USELESS_ARRAY: [u8; 16] = [0; 16]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_srli_epi16 ::<BITS>(self.0)) } }
4030 }
4031 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n // Lane# 1\n self.as_array()[8],\n other.as_array()[8],\n self.as_array()[9],\n other.as_array()[9],\n self.as_array()[10],\n other.as_array()[10],\n self.as_array()[11],\n other.as_array()[11],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi16)\n\n\n * `VPUNPCKLWD ymm, ymm, ymm`\n </li>\n </ul>"]
4032 #[inline(always)]
4033 fn unpack_lo(&self, other: U16x16) -> U16x16 {
4034 select_impl_block! { scalar { U16x16::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[8], other.as_array()[8], self.as_array()[9], other.as_array()[9], self.as_array()[10], other.as_array()[10], self.as_array()[11], other.as_array()[11], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi16 (self.0, other.0)) } }
4037 }
4038 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n // Lane# 0\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n // Lane# 1\n self.as_array()[12],\n other.as_array()[12],\n self.as_array()[13],\n other.as_array()[13],\n self.as_array()[14],\n other.as_array()[14],\n self.as_array()[15],\n other.as_array()[15],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi16)\n\n\n * `VPUNPCKHWD ymm, ymm, ymm`\n </li>\n </ul>"]
4039 #[inline(always)]
4040 fn unpack_hi(&self, other: U16x16) -> U16x16 {
4041 select_impl_block! { scalar { U16x16::from([ self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], self.as_array()[12], other.as_array()[12], self.as_array()[13], other.as_array()[13], self.as_array()[14], other.as_array()[14], self.as_array()[15], other.as_array()[15], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi16 (self.0, other.0)) } }
4044 }
4045 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n self.as_array()[8].max(other.as_array()[8]),\n self.as_array()[9].max(other.as_array()[9]),\n self.as_array()[10].max(other.as_array()[10]),\n self.as_array()[11].max(other.as_array()[11]),\n self.as_array()[12].max(other.as_array()[12]),\n self.as_array()[13].max(other.as_array()[13]),\n self.as_array()[14].max(other.as_array()[14]),\n self.as_array()[15].max(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_max_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_max_epu16)\n\n\n * `VPMAXUW ymm, ymm, ymm`\n </li>\n </ul>"]
4046 #[inline(always)]
4047 fn max(&self, other: U16x16) -> U16x16 {
4048 select_impl_block! { scalar { U16x16::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), self.as_array()[8].max(other.as_array()[8]), self.as_array()[9].max(other.as_array()[9]), self.as_array()[10].max(other.as_array()[10]), self.as_array()[11].max(other.as_array()[11]), self.as_array()[12].max(other.as_array()[12]), self.as_array()[13].max(other.as_array()[13]), self.as_array()[14].max(other.as_array()[14]), self.as_array()[15].max(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_max_epu16 (self.0, other.0)) } }
4049 }
4050 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U16x16 ,\n # ) -> U16x16\n # {\n U16x16::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n self.as_array()[8].min(other.as_array()[8]),\n self.as_array()[9].min(other.as_array()[9]),\n self.as_array()[10].min(other.as_array()[10]),\n self.as_array()[11].min(other.as_array()[11]),\n self.as_array()[12].min(other.as_array()[12]),\n self.as_array()[13].min(other.as_array()[13]),\n self.as_array()[14].min(other.as_array()[14]),\n self.as_array()[15].min(other.as_array()[15]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_min_epu16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_min_epu16)\n\n\n * `VPMINUW ymm, ymm, ymm`\n </li>\n </ul>"]
4051 #[inline(always)]
4052 fn min(&self, other: U16x16) -> U16x16 {
4053 select_impl_block! { scalar { U16x16::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), self.as_array()[8].min(other.as_array()[8]), self.as_array()[9].min(other.as_array()[9]), self.as_array()[10].min(other.as_array()[10]), self.as_array()[11].min(other.as_array()[11]), self.as_array()[12].min(other.as_array()[12]), self.as_array()[13].min(other.as_array()[13]), self.as_array()[14].min(other.as_array()[14]), self.as_array()[15].min(other.as_array()[15]), ]) } avx2 { Self( avx2::_mm256_min_epu16 (self.0, other.0)) } }
4054 }
4055}
4056impl crate::SimdBase16 for U16x16 {
4057 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # {\n U16x16::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 8],\n self.as_array()[I1 + 0 * 8],\n self.as_array()[I2 + 0 * 8],\n self.as_array()[I3 + 0 * 8],\n self.as_array()[4 + 0 * 8],\n self.as_array()[5 + 0 * 8],\n self.as_array()[6 + 0 * 8],\n self.as_array()[7 + 0 * 8],\n // 128-bit Lane #1\n self.as_array()[I0 + 1 * 8],\n self.as_array()[I1 + 1 * 8],\n self.as_array()[I2 + 1 * 8],\n self.as_array()[I3 + 1 * 8],\n self.as_array()[4 + 1 * 8],\n self.as_array()[5 + 1 * 8],\n self.as_array()[6 + 1 * 8],\n self.as_array()[7 + 1 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shufflelo_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shufflelo_epi16)\n\n\n * `VPSHUFLW ymm, ymm, imm8`\n </li>\n </ul>"]
4058 #[inline(always)]
4059 fn shuffle_lo<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
4060 &self,
4061 ) -> U16x16 {
4062 select_impl_block! { scalar { U16x16::from([ self.as_array()[I0 + 0 * 8], self.as_array()[I1 + 0 * 8], self.as_array()[I2 + 0 * 8], self.as_array()[I3 + 0 * 8], self.as_array()[4 + 0 * 8], self.as_array()[5 + 0 * 8], self.as_array()[6 + 0 * 8], self.as_array()[7 + 0 * 8], self.as_array()[I0 + 1 * 8], self.as_array()[I1 + 1 * 8], self.as_array()[I2 + 1 * 8], self.as_array()[I3 + 1 * 8], self.as_array()[4 + 1 * 8], self.as_array()[5 + 1 * 8], self.as_array()[6 + 1 * 8], self.as_array()[7 + 1 * 8], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm256_shufflelo_epi16 ::<I3, I2, I1, I0>(self.0)) } }
4065 }
4066 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # ;}\n # impl SomeTraitForDoc for U16x16 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U16x16\n # {\n U16x16::from([\n // 128-bit Lane #0\n self.as_array()[0 + 0 * 8],\n self.as_array()[1 + 0 * 8],\n self.as_array()[2 + 0 * 8],\n self.as_array()[3 + 0 * 8],\n self.as_array()[I0 + 4 + 0 * 8],\n self.as_array()[I1 + 4 + 0 * 8],\n self.as_array()[I2 + 4 + 0 * 8],\n self.as_array()[I3 + 4 + 0 * 8],\n // 128-bit Lane #1\n self.as_array()[0 + 1 * 8],\n self.as_array()[1 + 1 * 8],\n self.as_array()[2 + 1 * 8],\n self.as_array()[3 + 1 * 8],\n self.as_array()[I0 + 4 + 1 * 8],\n self.as_array()[I1 + 4 + 1 * 8],\n self.as_array()[I2 + 4 + 1 * 8],\n self.as_array()[I3 + 4 + 1 * 8],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shufflehi_epi16`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shufflehi_epi16)\n\n\n * `VPSHUFHW ymm, ymm, imm8`\n </li>\n </ul>"]
4067 #[inline(always)]
4068 fn shuffle_hi<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(
4069 &self,
4070 ) -> U16x16 {
4071 select_impl_block! { scalar { U16x16::from([ self.as_array()[0 + 0 * 8], self.as_array()[1 + 0 * 8], self.as_array()[2 + 0 * 8], self.as_array()[3 + 0 * 8], self.as_array()[I0 + 4 + 0 * 8], self.as_array()[I1 + 4 + 0 * 8], self.as_array()[I2 + 4 + 0 * 8], self.as_array()[I3 + 4 + 0 * 8], self.as_array()[0 + 1 * 8], self.as_array()[1 + 1 * 8], self.as_array()[2 + 1 * 8], self.as_array()[3 + 1 * 8], self.as_array()[I0 + 4 + 1 * 8], self.as_array()[I1 + 4 + 1 * 8], self.as_array()[I2 + 4 + 1 * 8], self.as_array()[I3 + 4 + 1 * 8], ]) } avx2 { if I0 > 4 { panic!("I0 ({I0}) > 4"); } if I1 > 4 { panic!("I1 ({I1}) > 4"); } if I2 > 4 { panic!("I2 ({I2}) > 4"); } if I3 > 4 { panic!("I3 ({I3}) > 4"); } Self( avx2::_mm256_shufflehi_epi16 ::<I3, I2, I1, I0>(self.0)) } }
4074 }
4075}
4076#[doc = "`[u32; 4]` as a vector."]
4077#[repr(transparent)]
4078#[derive(Clone, Copy)]
4079pub struct U32x4(U32x4Internal);
4080unsafe impl bytemuck::Pod for U32x4 {}
4081unsafe impl bytemuck::Zeroable for U32x4 {}
4082impl PartialEq for U32x4 {
4083 #[inline(always)]
4084 fn eq(&self, other: &Self) -> bool {
4085 ((*self) ^ (*other)).is_zero()
4086 }
4087}
4088impl Eq for U32x4 {}
4089impl Default for U32x4 {
4090 #[doc = "The zero vector."]
4091 #[inline(always)]
4092 fn default() -> Self {
4093 Self::ZERO
4094 }
4095}
4096impl std::hash::Hash for U32x4 {
4097 #[inline]
4098 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
4099 bytemuck::bytes_of(self).hash(state);
4100 }
4101}
4102impl std::fmt::Debug for U32x4 {
4103 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4104 write!(f, "U32x4({:?})", <[u32; 4]>::from(*self))
4105 }
4106}
4107impl subtle::ConstantTimeEq for U32x4 {
4108 fn ct_eq(&self, other: &Self) -> subtle::Choice {
4109 self.as_array().ct_eq(&other.as_array())
4110 }
4111}
4112impl subtle::ConditionallySelectable for U32x4 {
4113 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
4114 let mut out = [0; 4];
4115 for (out, (a, b)) in out
4116 .iter_mut()
4117 .zip(a.as_array().iter().zip(b.as_array().iter()))
4118 {
4119 *out = <u32 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
4120 }
4121 Self::from(out)
4122 }
4123}
4124impl rand::distributions::Distribution<U32x4> for rand::distributions::Standard {
4125 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U32x4 {
4126 let mut out = U32x4::ZERO;
4127 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
4128 out
4129 }
4130}
4131impl AsRef<[u32]> for U32x4 {
4132 fn as_ref(&self) -> &[u32] {
4133 let arr: &[u32; 4] = bytemuck::cast_ref(self);
4134 arr
4135 }
4136}
4137impl AsMut<[u32]> for U32x4 {
4138 fn as_mut(&mut self) -> &mut [u32] {
4139 let arr: &mut [u32; 4] = bytemuck::cast_mut(self);
4140 arr
4141 }
4142}
4143impl From<I8x16> for U32x4 {
4144 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x16\nas little endian bits of U32x4."]
4145 #[inline(always)]
4146 fn from(x: I8x16) -> U32x4 {
4147 Self({
4148 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4150 })
4151 }
4152}
4153impl From<I16x8> for U32x4 {
4154 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x8\nas little endian bits of U32x4."]
4155 #[inline(always)]
4156 fn from(x: I16x8) -> U32x4 {
4157 Self({
4158 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4160 })
4161 }
4162}
4163impl From<I32x4> for U32x4 {
4164 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x4\nas little endian bits of U32x4."]
4165 #[inline(always)]
4166 fn from(x: I32x4) -> U32x4 {
4167 Self({
4168 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4170 })
4171 }
4172}
4173impl From<I64x2> for U32x4 {
4174 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x2\nas little endian bits of U32x4."]
4175 #[inline(always)]
4176 fn from(x: I64x2) -> U32x4 {
4177 Self({
4178 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4180 })
4181 }
4182}
4183impl From<U8x16> for U32x4 {
4184 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x16\nas little endian bits of U32x4."]
4185 #[inline(always)]
4186 fn from(x: U8x16) -> U32x4 {
4187 Self({
4188 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4190 })
4191 }
4192}
4193impl From<U16x8> for U32x4 {
4194 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x8\nas little endian bits of U32x4."]
4195 #[inline(always)]
4196 fn from(x: U16x8) -> U32x4 {
4197 Self({
4198 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4200 })
4201 }
4202}
4203impl From<U64x2> for U32x4 {
4204 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x2\nas little endian bits of U32x4."]
4205 #[inline(always)]
4206 fn from(x: U64x2) -> U32x4 {
4207 Self({
4208 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4210 })
4211 }
4212}
4213impl crate::ExtendingCast<U8x16> for U32x4 {
4214 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U32x4\n # {\n U32x4::from([\n u32::from(vector.as_array()[0]),\n u32::from(vector.as_array()[1]),\n u32::from(vector.as_array()[2]),\n u32::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepu8_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepu8_epi32)\n\n\n * `PMOVZXBD xmm, xmm`\n </li>\n </ul>"]
4215 #[inline(always)]
4216 fn extending_cast_from(vector: U8x16) -> U32x4 {
4217 select_impl_block! { scalar { U32x4::from([ u32::from(vector.as_array()[0]), u32::from(vector.as_array()[1]), u32::from(vector.as_array()[2]), u32::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm_cvtepu8_epi32 (vector.0)) } }
4218 }
4219}
4220impl crate::ExtendingCast<U16x8> for U32x4 {
4221 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U32x4\n # {\n U32x4::from([\n u32::from(vector.as_array()[0]),\n u32::from(vector.as_array()[1]),\n u32::from(vector.as_array()[2]),\n u32::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepu16_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepu16_epi32)\n\n\n * `PMOVZXWD xmm, xmm`\n </li>\n </ul>"]
4222 #[inline(always)]
4223 fn extending_cast_from(vector: U16x8) -> U32x4 {
4224 select_impl_block! { scalar { U32x4::from([ u32::from(vector.as_array()[0]), u32::from(vector.as_array()[1]), u32::from(vector.as_array()[2]), u32::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm_cvtepu16_epi32 (vector.0)) } }
4225 }
4226}
4227#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
4228impl crate::SimdBaseGatherable<I32x4> for U32x4 {
4229 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : I32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_i32gather_epi32)\n\n\n * `VPGATHERDD xmm, vm32x, xmm`\n </li>\n </ul>"]
4230 #[inline(always)]
4231 unsafe fn gather(base: *const u32, indices: I32x4) -> U32x4 {
4232 select_impl_block! { scalar { U32x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm_i32gather_epi32 ::<4>(base as *const i32, indices.0)) } }
4233 }
4234 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : I32x4 ,\n # mask : U32x4 ,\n # src : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n if (mask.as_array()[0] >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if (mask.as_array()[2] >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if (mask.as_array()[3] >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mask_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i32gather_epi32)\n\n\n * `VPGATHERDD xmm, vm32x, xmm`\n </li>\n </ul>"]
4235 #[inline(always)]
4236 unsafe fn gather_masked(base: *const u32, indices: I32x4, mask: U32x4, src: U32x4) -> U32x4 {
4237 select_impl_block! { scalar { U32x4::from([ if (mask.as_array()[0] >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if (mask.as_array()[2] >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if (mask.as_array()[3] >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm_mask_i32gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
4238 }
4239}
4240#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
4241impl crate::SimdBaseGatherable<U64x4> for U32x4 {
4242 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : U64x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
4243 #[inline(always)]
4244 unsafe fn gather(base: *const u32, indices: U64x4) -> U32x4 {
4245 select_impl_block! { scalar { U32x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi32 ::<4>(base as *const i32, indices.0)) } }
4246 }
4247 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : U64x4 ,\n # mask : U32x4 ,\n # src : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n if (mask.as_array()[0] >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if (mask.as_array()[2] >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if (mask.as_array()[3] >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
4248 #[inline(always)]
4249 unsafe fn gather_masked(base: *const u32, indices: U64x4, mask: U32x4, src: U32x4) -> U32x4 {
4250 select_impl_block! { scalar { U32x4::from([ if (mask.as_array()[0] >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if (mask.as_array()[2] >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if (mask.as_array()[3] >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
4251 }
4252}
4253#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
4254impl crate::SimdBaseGatherable<I64x4> for U32x4 {
4255 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : I64x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
4256 #[inline(always)]
4257 unsafe fn gather(base: *const u32, indices: I64x4) -> U32x4 {
4258 select_impl_block! { scalar { U32x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi32 ::<4>(base as *const i32, indices.0)) } }
4259 }
4260 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : I64x4 ,\n # mask : U32x4 ,\n # src : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n if (mask.as_array()[0] >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if (mask.as_array()[2] >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if (mask.as_array()[3] >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi32)\n\n\n * `VPGATHERQD xmm, vm64y, xmm`\n </li>\n </ul>"]
4261 #[inline(always)]
4262 unsafe fn gather_masked(base: *const u32, indices: I64x4, mask: U32x4, src: U32x4) -> U32x4 {
4263 select_impl_block! { scalar { U32x4::from([ if (mask.as_array()[0] >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if (mask.as_array()[2] >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if (mask.as_array()[3] >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
4264 }
4265} impl ShlAssign<u64> for U32x4 {
4267 #[inline(always)]
4268 fn shl_assign(&mut self, amount: u64) {
4269 *self = (*self) << amount;
4270 }
4271}
4272impl Shl<u64> for U32x4 {
4273 type Output = Self;
4274 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x4\n # {\n if amount >= 32 {\n U32x4::ZERO\n } else {\n U32x4::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_sll_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi32)\n\n\n * `PSLLD xmm, xmm`\n </li>\n </ul>"]
4275 #[inline(always)]
4276 fn shl(self, amount: u64) -> U32x4 {
4277 select_impl_block! { scalar { if amount >= 32 { U32x4::ZERO } else { U32x4::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_sll_epi32 (self.0, amount)) } }
4278 }
4279} impl ShlAssign<U32x4> for U32x4 {
4281 #[inline(always)]
4282 fn shl_assign(&mut self, amount: U32x4) {
4283 *self = (*self) << amount;
4284 }
4285}
4286impl Shl<U32x4> for U32x4 {
4287 type Output = Self;
4288 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x4 ,\n # ) -> U32x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_sllv_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sllv_epi32)\n\n\n * `VPSLLVD xmm, xmm, xmm`\n </li>\n </ul>"]
4289 #[inline(always)]
4290 fn shl(self, amount: U32x4) -> U32x4 {
4291 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x << amm } else { 0 }; } U32x4::from(out) } avx2 { Self( avx2::_mm_sllv_epi32 (self.0, amount.0)) } }
4292 }
4293} impl ShrAssign<u64> for U32x4 {
4295 #[inline(always)]
4296 fn shr_assign(&mut self, amount: u64) {
4297 *self = (*self) >> amount;
4298 }
4299}
4300impl Shr<u64> for U32x4 {
4301 type Output = Self;
4302 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x4\n # {\n if amount >= 32 {\n U32x4::ZERO\n } else {\n U32x4::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_srl_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srl_epi32)\n\n\n * `PSRLD xmm, xmm`\n </li>\n </ul>"]
4303 #[inline(always)]
4304 fn shr(self, amount: u64) -> U32x4 {
4305 select_impl_block! { scalar { if amount >= 32 { U32x4::ZERO } else { U32x4::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_srl_epi32 (self.0, amount)) } }
4306 }
4307} impl ShrAssign<U32x4> for U32x4 {
4309 #[inline(always)]
4310 fn shr_assign(&mut self, amount: U32x4) {
4311 *self = (*self) >> amount;
4312 }
4313}
4314impl Shr<U32x4> for U32x4 {
4315 type Output = Self;
4316 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x4 ,\n # ) -> U32x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srlv_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srlv_epi32)\n\n\n * `VPSRLVD xmm, xmm, xmm`\n </li>\n </ul>"]
4317 #[inline(always)]
4318 fn shr(self, amount: U32x4) -> U32x4 {
4319 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x >> amm } else { 0 }; } U32x4::from(out) } avx2 { Self( avx2::_mm_srlv_epi32 (self.0, amount.0)) } }
4320 }
4321}
4322impl SimdBase for U32x4 {
4323 type Scalar = u32;
4324 type Array = [u32; 4];
4325 type Signed = I32x4;
4326 type Unsigned = U32x4;
4327 const LANES: usize = 4;
4328 const ZERO: Self = Self::from_array([0; 4]);
4329 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
4330 #[inline(always)]
4331 fn is_zero(&self) -> bool {
4332 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
4333 }
4334 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u32 ,\n # ) -> U32x4\n # {\n let mut out = [0; 4];\n out[0] = scalar;\n U32x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
4335 #[inline(always)]
4336 fn set_lo(scalar: u32) -> U32x4 {
4337 select_impl_block! { scalar { let mut out = [0; 4]; out[0] = scalar; U32x4::from(out) } avx2 { Self( avx2::_mm_set_epi32 ( 0, 0, 0, scalar as i32, )) } }
4338 }
4339 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u32\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u32\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi32)\n\n\n * `PEXTRD r32, xmm, imm8`\n </li>\n </ul>"]
4340 #[inline(always)]
4341 fn extract<const I: usize>(&self) -> u32 {
4342 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi32 ::<I>(self.0) as u32 } }
4343 }
4344 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u32 ,\n # ) -> U32x4\n # {\n U32x4::from([scalar; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
4345 #[inline(always)]
4346 fn broadcast(scalar: u32) -> U32x4 {
4347 select_impl_block! { scalar { U32x4::from([scalar; 4]) } avx2 { Self( avx2::_mm_set1_epi32 (scalar as i32)) } }
4348 }
4349 type BroadcastLoInput = U32x4;
4350 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([vector.as_array()[0]; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastd_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastd_epi32)\n\n\n * `VPBROADCASTD xmm, xmm`\n </li>\n </ul>"]
4351 #[inline(always)]
4352 fn broadcast_lo(vector: U32x4) -> U32x4 {
4353 select_impl_block! { scalar { U32x4::from([vector.as_array()[0]; 4]) } avx2 { Self( avx2::_mm_broadcastd_epi32 (vector.0)) } }
4354 }
4355 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n if self.as_array()[0] == other.as_array()[0] { u32::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u32::MAX } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { u32::MAX } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { u32::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi32)\n\n\n * `PCMPEQD xmm, xmm`\n </li>\n </ul>"]
4356 #[inline(always)]
4357 fn cmp_eq(&self, other: U32x4) -> U32x4 {
4358 select_impl_block! { scalar { U32x4::from([ if self.as_array()[0] == other.as_array()[0] { u32::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u32::MAX } else { 0 }, if self.as_array()[2] == other.as_array()[2] { u32::MAX } else { 0 }, if self.as_array()[3] == other.as_array()[3] { u32::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi32 (self.0, other.0)) } }
4359 }
4360 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
4361 #[inline(always)]
4362 fn and_not(&self, other: U32x4) -> U32x4 {
4363 select_impl_block! { scalar { U32x4::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
4364 }
4365 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n if self.as_array()[0] > other.as_array()[0] { u32::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u32::MAX } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { u32::MAX } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { u32::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 31);\n Self::from(I32x4::from(*self ^ sign_bit).cmp_gt(\n I32x4::from(other ^ sign_bit)\n ))\n ```"]
4366 #[inline(always)]
4367 fn cmp_gt(&self, other: U32x4) -> U32x4 {
4368 select_impl_block! { scalar { U32x4::from([ if self.as_array()[0] > other.as_array()[0] { u32::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u32::MAX } else { 0 }, if self.as_array()[2] > other.as_array()[2] { u32::MAX } else { 0 }, if self.as_array()[3] > other.as_array()[3] { u32::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 31); Self::from(I32x4::from(*self ^ sign_bit).cmp_gt( I32x4::from(other ^ sign_bit) )) } }
4370 }
4371 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi32)\n\n\n * `PSLLD xmm, imm8`\n </li>\n </ul>"]
4372 #[inline(always)]
4373 fn shift_left<const BITS: usize>(&self) -> U32x4 {
4374 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U32x4::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_slli_epi32 ::<BITS>(self.0)) } }
4375 }
4376 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U32x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srli_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi32)\n\n\n * `PSRLD xmm, imm8`\n </li>\n </ul>"]
4377 #[inline(always)]
4378 fn shift_right<const BITS: usize>(&self) -> U32x4 {
4379 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U32x4::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_srli_epi32 ::<BITS>(self.0)) } }
4380 }
4381 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi32)\n\n\n * `PUNPCKLDQ xmm, xmm`\n </li>\n </ul>"]
4382 #[inline(always)]
4383 fn unpack_lo(&self, other: U32x4) -> U32x4 {
4384 select_impl_block! { scalar { U32x4::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], ]) } avx2 { Self( avx2::_mm_unpacklo_epi32 (self.0, other.0)) } }
4386 }
4387 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n // Lane# 0\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi32)\n\n\n * `PUNPCKHDQ xmm, xmm`\n </li>\n </ul>"]
4388 #[inline(always)]
4389 fn unpack_hi(&self, other: U32x4) -> U32x4 {
4390 select_impl_block! { scalar { U32x4::from([ self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], ]) } avx2 { Self( avx2::_mm_unpackhi_epi32 (self.0, other.0)) } }
4392 }
4393 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_max_epu32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu32)\n\n\n * `PMAXUD xmm, xmm`\n </li>\n </ul>"]
4394 #[inline(always)]
4395 fn max(&self, other: U32x4) -> U32x4 {
4396 select_impl_block! { scalar { U32x4::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), ]) } avx2 { Self( avx2::_mm_max_epu32 (self.0, other.0)) } }
4397 }
4398 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_min_epu32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epu32)\n\n\n * `PMINUD xmm, xmm`\n </li>\n </ul>"]
4399 #[inline(always)]
4400 fn min(&self, other: U32x4) -> U32x4 {
4401 select_impl_block! { scalar { U32x4::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), ]) } avx2 { Self( avx2::_mm_min_epu32 (self.0, other.0)) } }
4402 }
4403}
4404impl crate::SimdBase32 for U32x4 {
4405 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U32x4\n # {\n U32x4::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 4],\n self.as_array()[I1 + 0 * 4],\n self.as_array()[I2 + 0 * 4],\n self.as_array()[I3 + 0 * 4],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_shuffle_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_epi32)\n\n\n * `PSHUFD xmm, xmm, imm8`\n </li>\n </ul>"]
4406 #[inline(always)]
4407 fn shuffle<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(&self) -> U32x4 {
4408 select_impl_block! { scalar { U32x4::from([ self.as_array()[I0 + 0 * 4], self.as_array()[I1 + 0 * 4], self.as_array()[I2 + 0 * 4], self.as_array()[I3 + 0 * 4], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm_shuffle_epi32 ::<I3, I2, I1, I0>(self.0)) } }
4410 }
4411}
4412impl crate::SimdBase4x for U32x4 {
4413 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U32x4 ,\n # ) -> U32x4\n # ;}\n # impl SomeTraitForDoc for U32x4 {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U32x4 ,\n # ) -> U32x4\n # {\n U32x4::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_blend_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blend_epi32)\n\n\n * `VPBLENDD xmm, xmm, xmm, imm8`\n </li>\n </ul>"]
4414 #[inline(always)]
4415 fn blend<const B3: bool, const B2: bool, const B1: bool, const B0: bool>(
4416 &self,
4417 if_true: U32x4,
4418 ) -> U32x4 {
4419 select_impl_block! { scalar { U32x4::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], ]) } avx2 { Self( avx2::_mm_blend_epi32 ::<B3, B2, B1, B0>(self.0, if_true.0)) } }
4420 }
4421}
4422#[doc = "`[u32; 8]` as a vector."]
4423#[repr(transparent)]
4424#[derive(Clone, Copy)]
4425pub struct U32x8(U32x8Internal);
4426unsafe impl bytemuck::Pod for U32x8 {}
4427unsafe impl bytemuck::Zeroable for U32x8 {}
4428impl PartialEq for U32x8 {
4429 #[inline(always)]
4430 fn eq(&self, other: &Self) -> bool {
4431 ((*self) ^ (*other)).is_zero()
4432 }
4433}
4434impl Eq for U32x8 {}
4435impl Default for U32x8 {
4436 #[doc = "The zero vector."]
4437 #[inline(always)]
4438 fn default() -> Self {
4439 Self::ZERO
4440 }
4441}
4442impl std::hash::Hash for U32x8 {
4443 #[inline]
4444 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
4445 bytemuck::bytes_of(self).hash(state);
4446 }
4447}
4448impl std::fmt::Debug for U32x8 {
4449 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4450 write!(f, "U32x8({:?})", <[u32; 8]>::from(*self))
4451 }
4452}
4453impl subtle::ConstantTimeEq for U32x8 {
4454 fn ct_eq(&self, other: &Self) -> subtle::Choice {
4455 self.as_array().ct_eq(&other.as_array())
4456 }
4457}
4458impl subtle::ConditionallySelectable for U32x8 {
4459 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
4460 let mut out = [0; 8];
4461 for (out, (a, b)) in out
4462 .iter_mut()
4463 .zip(a.as_array().iter().zip(b.as_array().iter()))
4464 {
4465 *out = <u32 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
4466 }
4467 Self::from(out)
4468 }
4469}
4470impl rand::distributions::Distribution<U32x8> for rand::distributions::Standard {
4471 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U32x8 {
4472 let mut out = U32x8::ZERO;
4473 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
4474 out
4475 }
4476}
4477impl AsRef<[u32]> for U32x8 {
4478 fn as_ref(&self) -> &[u32] {
4479 let arr: &[u32; 8] = bytemuck::cast_ref(self);
4480 arr
4481 }
4482}
4483impl AsMut<[u32]> for U32x8 {
4484 fn as_mut(&mut self) -> &mut [u32] {
4485 let arr: &mut [u32; 8] = bytemuck::cast_mut(self);
4486 arr
4487 }
4488}
4489impl From<I8x32> for U32x8 {
4490 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x32\nas little endian bits of U32x8."]
4491 #[inline(always)]
4492 fn from(x: I8x32) -> U32x8 {
4493 Self({
4494 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4496 })
4497 }
4498}
4499impl From<I16x16> for U32x8 {
4500 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x16\nas little endian bits of U32x8."]
4501 #[inline(always)]
4502 fn from(x: I16x16) -> U32x8 {
4503 Self({
4504 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4506 })
4507 }
4508}
4509impl From<I32x8> for U32x8 {
4510 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x8\nas little endian bits of U32x8."]
4511 #[inline(always)]
4512 fn from(x: I32x8) -> U32x8 {
4513 Self({
4514 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4516 })
4517 }
4518}
4519impl From<I64x4> for U32x8 {
4520 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x4\nas little endian bits of U32x8."]
4521 #[inline(always)]
4522 fn from(x: I64x4) -> U32x8 {
4523 Self({
4524 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4526 })
4527 }
4528}
4529impl From<U8x32> for U32x8 {
4530 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x32\nas little endian bits of U32x8."]
4531 #[inline(always)]
4532 fn from(x: U8x32) -> U32x8 {
4533 Self({
4534 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4536 })
4537 }
4538}
4539impl From<U16x16> for U32x8 {
4540 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x16\nas little endian bits of U32x8."]
4541 #[inline(always)]
4542 fn from(x: U16x16) -> U32x8 {
4543 Self({
4544 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4546 })
4547 }
4548}
4549impl From<U64x4> for U32x8 {
4550 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U64x4\nas little endian bits of U32x8."]
4551 #[inline(always)]
4552 fn from(x: U64x4) -> U32x8 {
4553 Self({
4554 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4556 })
4557 }
4558}
4559impl From<U16x8> for U32x8 {
4560 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n u32::from(vector.as_array()[0]),\n u32::from(vector.as_array()[1]),\n u32::from(vector.as_array()[2]),\n u32::from(vector.as_array()[3]),\n u32::from(vector.as_array()[4]),\n u32::from(vector.as_array()[5]),\n u32::from(vector.as_array()[6]),\n u32::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu16_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu16_epi32)\n\n\n * `VPMOVZXWD ymm, xmm`\n </li>\n </ul>"]
4561 #[inline(always)]
4562 fn from(vector: U16x8) -> U32x8 {
4563 select_impl_block! { scalar { U32x8::from([ u32::from(vector.as_array()[0]), u32::from(vector.as_array()[1]), u32::from(vector.as_array()[2]), u32::from(vector.as_array()[3]), u32::from(vector.as_array()[4]), u32::from(vector.as_array()[5]), u32::from(vector.as_array()[6]), u32::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_cvtepu16_epi32 (vector.0)) } }
4564 }
4565}
4566impl crate::ExtendingCast<U8x16> for U32x8 {
4567 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U32x8\n # {\n U32x8::from([\n u32::from(vector.as_array()[0]),\n u32::from(vector.as_array()[1]),\n u32::from(vector.as_array()[2]),\n u32::from(vector.as_array()[3]),\n u32::from(vector.as_array()[4]),\n u32::from(vector.as_array()[5]),\n u32::from(vector.as_array()[6]),\n u32::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu8_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu8_epi32)\n\n\n * `VPMOVZXBD ymm, xmm`\n </li>\n </ul>"]
4568 #[inline(always)]
4569 fn extending_cast_from(vector: U8x16) -> U32x8 {
4570 select_impl_block! { scalar { U32x8::from([ u32::from(vector.as_array()[0]), u32::from(vector.as_array()[1]), u32::from(vector.as_array()[2]), u32::from(vector.as_array()[3]), u32::from(vector.as_array()[4]), u32::from(vector.as_array()[5]), u32::from(vector.as_array()[6]), u32::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_cvtepu8_epi32 (vector.0)) } }
4571 }
4572}
4573impl crate::ExtendingCast<U16x8> for U32x8 {
4574 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n u32::from(vector.as_array()[0]),\n u32::from(vector.as_array()[1]),\n u32::from(vector.as_array()[2]),\n u32::from(vector.as_array()[3]),\n u32::from(vector.as_array()[4]),\n u32::from(vector.as_array()[5]),\n u32::from(vector.as_array()[6]),\n u32::from(vector.as_array()[7]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu16_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu16_epi32)\n\n\n * `VPMOVZXWD ymm, xmm`\n </li>\n </ul>"]
4575 #[inline(always)]
4576 fn extending_cast_from(vector: U16x8) -> U32x8 {
4577 select_impl_block! { scalar { U32x8::from([ u32::from(vector.as_array()[0]), u32::from(vector.as_array()[1]), u32::from(vector.as_array()[2]), u32::from(vector.as_array()[3]), u32::from(vector.as_array()[4]), u32::from(vector.as_array()[5]), u32::from(vector.as_array()[6]), u32::from(vector.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_cvtepu16_epi32 (vector.0)) } }
4578 }
4579}
4580impl From<U32x4> for U32x8 {
4581 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U32x4 ,\n # ) -> U32x8\n # {\n let mut out = [0; 8];\n out[0..4].copy_from_slice(&vector.as_array());\n U32x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
4582 #[inline(always)]
4583 fn from(vector: U32x4) -> U32x8 {
4584 select_impl_block! { scalar { let mut out = [0; 8]; out[0..4].copy_from_slice(&vector.as_array()); U32x8::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
4585 }
4586}
4587impl From<[U32x4; 2]> for U32x8 {
4588 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [U32x4; 2] ,\n # ) -> U32x8\n # {\n let mut out = [0; 8];\n out[0..4].copy_from_slice(&vectors[0].as_array());\n out[4..].copy_from_slice(&vectors[1].as_array());\n U32x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
4589 #[inline(always)]
4590 fn from(vectors: [U32x4; 2]) -> U32x8 {
4591 select_impl_block! { scalar { let mut out = [0; 8]; out[0..4].copy_from_slice(&vectors[0].as_array()); out[4..].copy_from_slice(&vectors[1].as_array()); U32x8::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
4592 }
4593} impl From<U32x8> for [U32x4; 2] {
4595 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U32x8 ,\n # ) -> [U32x4; 2]\n # {\n let mut lo = [0; 4];\n let mut hi = [0; 4];\n lo.copy_from_slice(&vector.as_array()[0..4]);\n hi.copy_from_slice(&vector.as_array()[4..]);\n [U32x4::from(lo), U32x4::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
4596 #[inline(always)]
4597 fn from(vector: U32x8) -> [U32x4; 2] {
4598 select_impl_block! { scalar { let mut lo = [0; 4]; let mut hi = [0; 4]; lo.copy_from_slice(&vector.as_array()[0..4]); hi.copy_from_slice(&vector.as_array()[4..]); [U32x4::from(lo), U32x4::from(hi)] } avx2 { [ U32x4( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), U32x4( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
4599 }
4600}
4601#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
4602impl crate::SimdBaseGatherable<I32x8> for U32x8 {
4603 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : I32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n base.offset(indices.as_array()[4] as isize).read_unaligned(),\n base.offset(indices.as_array()[5] as isize).read_unaligned(),\n base.offset(indices.as_array()[6] as isize).read_unaligned(),\n base.offset(indices.as_array()[7] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i32gather_epi32)\n\n\n * `VPGATHERDD ymm, vm32x, ymm`\n </li>\n </ul>"]
4604 #[inline(always)]
4605 unsafe fn gather(base: *const u32, indices: I32x8) -> U32x8 {
4606 select_impl_block! { scalar { U32x8::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), base.offset(indices.as_array()[4] as isize).read_unaligned(), base.offset(indices.as_array()[5] as isize).read_unaligned(), base.offset(indices.as_array()[6] as isize).read_unaligned(), base.offset(indices.as_array()[7] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i32gather_epi32 ::<4>(base as *const i32, indices.0)) } }
4607 }
4608 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u32 ,\n # indices : I32x8 ,\n # mask : U32x8 ,\n # src : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n if (mask.as_array()[0] >> 31) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 31) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if (mask.as_array()[2] >> 31) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if (mask.as_array()[3] >> 31) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n if (mask.as_array()[4] >> 31) == 1 {\n base.offset(indices.as_array()[4] as isize).read_unaligned()\n } else {\n src.as_array()[4]\n },\n if (mask.as_array()[5] >> 31) == 1 {\n base.offset(indices.as_array()[5] as isize).read_unaligned()\n } else {\n src.as_array()[5]\n },\n if (mask.as_array()[6] >> 31) == 1 {\n base.offset(indices.as_array()[6] as isize).read_unaligned()\n } else {\n src.as_array()[6]\n },\n if (mask.as_array()[7] >> 31) == 1 {\n base.offset(indices.as_array()[7] as isize).read_unaligned()\n } else {\n src.as_array()[7]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i32gather_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i32gather_epi32)\n\n\n * `VPGATHERDD ymm, vm32x, ymm`\n </li>\n </ul>"]
4609 #[inline(always)]
4610 unsafe fn gather_masked(base: *const u32, indices: I32x8, mask: U32x8, src: U32x8) -> U32x8 {
4611 select_impl_block! { scalar { U32x8::from([ if (mask.as_array()[0] >> 31) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 31) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if (mask.as_array()[2] >> 31) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if (mask.as_array()[3] >> 31) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, if (mask.as_array()[4] >> 31) == 1 { base.offset(indices.as_array()[4] as isize).read_unaligned() } else { src.as_array()[4] }, if (mask.as_array()[5] >> 31) == 1 { base.offset(indices.as_array()[5] as isize).read_unaligned() } else { src.as_array()[5] }, if (mask.as_array()[6] >> 31) == 1 { base.offset(indices.as_array()[6] as isize).read_unaligned() } else { src.as_array()[6] }, if (mask.as_array()[7] >> 31) == 1 { base.offset(indices.as_array()[7] as isize).read_unaligned() } else { src.as_array()[7] }, ]) } avx2 { Self( avx2::_mm256_mask_i32gather_epi32 ::<4>( src.0, base as *const i32, indices.0, mask.0, )) } }
4612 }
4613} impl ShlAssign<u64> for U32x8 {
4615 #[inline(always)]
4616 fn shl_assign(&mut self, amount: u64) {
4617 *self = (*self) << amount;
4618 }
4619}
4620impl Shl<u64> for U32x8 {
4621 type Output = Self;
4622 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x8\n # {\n if amount >= 32 {\n U32x8::ZERO\n } else {\n U32x8::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n self.as_array()[4] << amount,\n self.as_array()[5] << amount,\n self.as_array()[6] << amount,\n self.as_array()[7] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sll_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sll_epi32)\n\n\n * `VPSLLD ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
4623 #[inline(always)]
4624 fn shl(self, amount: u64) -> U32x8 {
4625 select_impl_block! { scalar { if amount >= 32 { U32x8::ZERO } else { U32x8::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, self.as_array()[4] << amount, self.as_array()[5] << amount, self.as_array()[6] << amount, self.as_array()[7] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_sll_epi32 (self.0, amount)) } }
4626 }
4627} impl ShlAssign<U32x8> for U32x8 {
4629 #[inline(always)]
4630 fn shl_assign(&mut self, amount: U32x8) {
4631 *self = (*self) << amount;
4632 }
4633}
4634impl Shl<U32x8> for U32x8 {
4635 type Output = Self;
4636 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x8 ,\n # ) -> U32x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sllv_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sllv_epi32)\n\n\n * `VPSLLVD ymm, ymm, ymm`\n </li>\n </ul>"]
4637 #[inline(always)]
4638 fn shl(self, amount: U32x8) -> U32x8 {
4639 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x << amm } else { 0 }; } U32x8::from(out) } avx2 { Self( avx2::_mm256_sllv_epi32 (self.0, amount.0)) } }
4640 }
4641} impl ShrAssign<u64> for U32x8 {
4643 #[inline(always)]
4644 fn shr_assign(&mut self, amount: u64) {
4645 *self = (*self) >> amount;
4646 }
4647}
4648impl Shr<u64> for U32x8 {
4649 type Output = Self;
4650 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U32x8\n # {\n if amount >= 32 {\n U32x8::ZERO\n } else {\n U32x8::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n self.as_array()[4] >> amount,\n self.as_array()[5] >> amount,\n self.as_array()[6] >> amount,\n self.as_array()[7] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srl_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srl_epi32)\n\n\n * `VPSRLD ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
4651 #[inline(always)]
4652 fn shr(self, amount: u64) -> U32x8 {
4653 select_impl_block! { scalar { if amount >= 32 { U32x8::ZERO } else { U32x8::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, self.as_array()[4] >> amount, self.as_array()[5] >> amount, self.as_array()[6] >> amount, self.as_array()[7] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_srl_epi32 (self.0, amount)) } }
4654 }
4655} impl ShrAssign<U32x8> for U32x8 {
4657 #[inline(always)]
4658 fn shr_assign(&mut self, amount: U32x8) {
4659 *self = (*self) >> amount;
4660 }
4661}
4662impl Shr<U32x8> for U32x8 {
4663 type Output = Self;
4664 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U32x8 ,\n # ) -> U32x8\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..32).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srlv_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srlv_epi32)\n\n\n * `VPSRLVD ymm, ymm, ymm`\n </li>\n </ul>"]
4665 #[inline(always)]
4666 fn shr(self, amount: U32x8) -> U32x8 {
4667 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..32).contains(&amm) { *x >> amm } else { 0 }; } U32x8::from(out) } avx2 { Self( avx2::_mm256_srlv_epi32 (self.0, amount.0)) } }
4668 }
4669}
4670impl SimdBase for U32x8 {
4671 type Scalar = u32;
4672 type Array = [u32; 8];
4673 type Signed = I32x8;
4674 type Unsigned = U32x8;
4675 const LANES: usize = 8;
4676 const ZERO: Self = Self::from_array([0; 8]);
4677 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
4678 #[inline(always)]
4679 fn is_zero(&self) -> bool {
4680 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
4681 }
4682 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u32 ,\n # ) -> U32x8\n # {\n let mut out = [0; 8];\n out[0] = scalar;\n U32x8::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
4683 #[inline(always)]
4684 fn set_lo(scalar: u32) -> U32x8 {
4685 select_impl_block! { scalar { let mut out = [0; 8]; out[0] = scalar; U32x8::from(out) } avx2 { Self( avx2::_mm256_set_epi32 ( 0, 0, 0, 0, 0, 0, 0, scalar as i32, )) } }
4686 }
4687 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u32\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u32\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
4688 #[inline(always)]
4689 fn extract<const I: usize>(&self) -> u32 {
4690 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi32 ::<I>(self.0) as u32 } }
4691 }
4692 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u32 ,\n # ) -> U32x8\n # {\n U32x8::from([scalar; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi32)\n\n\n Instruction sequence.\n </li>\n </ul>"]
4693 #[inline(always)]
4694 fn broadcast(scalar: u32) -> U32x8 {
4695 select_impl_block! { scalar { U32x8::from([scalar; 8]) } avx2 { Self( avx2::_mm256_set1_epi32 (scalar as i32)) } }
4696 }
4697 type BroadcastLoInput = U32x4;
4698 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U32x4 ,\n # ) -> U32x8\n # {\n U32x8::from([vector.as_array()[0]; 8])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastd_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastd_epi32)\n\n\n * `VPBROADCASTD ymm, xmm`\n </li>\n </ul>"]
4699 #[inline(always)]
4700 fn broadcast_lo(vector: U32x4) -> U32x8 {
4701 select_impl_block! { scalar { U32x8::from([vector.as_array()[0]; 8]) } avx2 { Self( avx2::_mm256_broadcastd_epi32 (vector.0)) } }
4702 }
4703 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n if self.as_array()[0] == other.as_array()[0] { u32::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u32::MAX } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { u32::MAX } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { u32::MAX } else { 0 },\n if self.as_array()[4] == other.as_array()[4] { u32::MAX } else { 0 },\n if self.as_array()[5] == other.as_array()[5] { u32::MAX } else { 0 },\n if self.as_array()[6] == other.as_array()[6] { u32::MAX } else { 0 },\n if self.as_array()[7] == other.as_array()[7] { u32::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi32)\n\n\n * `VPCMPEQD ymm, ymm, ymm`\n </li>\n </ul>"]
4704 #[inline(always)]
4705 fn cmp_eq(&self, other: U32x8) -> U32x8 {
4706 select_impl_block! { scalar { U32x8::from([ if self.as_array()[0] == other.as_array()[0] { u32::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u32::MAX } else { 0 }, if self.as_array()[2] == other.as_array()[2] { u32::MAX } else { 0 }, if self.as_array()[3] == other.as_array()[3] { u32::MAX } else { 0 }, if self.as_array()[4] == other.as_array()[4] { u32::MAX } else { 0 }, if self.as_array()[5] == other.as_array()[5] { u32::MAX } else { 0 }, if self.as_array()[6] == other.as_array()[6] { u32::MAX } else { 0 }, if self.as_array()[7] == other.as_array()[7] { u32::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi32 (self.0, other.0)) } }
4707 }
4708 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n self.as_array()[4] & (!other.as_array()[4]),\n self.as_array()[5] & (!other.as_array()[5]),\n self.as_array()[6] & (!other.as_array()[6]),\n self.as_array()[7] & (!other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
4709 #[inline(always)]
4710 fn and_not(&self, other: U32x8) -> U32x8 {
4711 select_impl_block! { scalar { U32x8::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), self.as_array()[4] & (!other.as_array()[4]), self.as_array()[5] & (!other.as_array()[5]), self.as_array()[6] & (!other.as_array()[6]), self.as_array()[7] & (!other.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
4712 }
4713 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n if self.as_array()[0] > other.as_array()[0] { u32::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u32::MAX } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { u32::MAX } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { u32::MAX } else { 0 },\n if self.as_array()[4] > other.as_array()[4] { u32::MAX } else { 0 },\n if self.as_array()[5] > other.as_array()[5] { u32::MAX } else { 0 },\n if self.as_array()[6] > other.as_array()[6] { u32::MAX } else { 0 },\n if self.as_array()[7] > other.as_array()[7] { u32::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 31);\n Self::from(I32x8::from(*self ^ sign_bit).cmp_gt(\n I32x8::from(other ^ sign_bit)\n ))\n ```"]
4714 #[inline(always)]
4715 fn cmp_gt(&self, other: U32x8) -> U32x8 {
4716 select_impl_block! { scalar { U32x8::from([ if self.as_array()[0] > other.as_array()[0] { u32::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u32::MAX } else { 0 }, if self.as_array()[2] > other.as_array()[2] { u32::MAX } else { 0 }, if self.as_array()[3] > other.as_array()[3] { u32::MAX } else { 0 }, if self.as_array()[4] > other.as_array()[4] { u32::MAX } else { 0 }, if self.as_array()[5] > other.as_array()[5] { u32::MAX } else { 0 }, if self.as_array()[6] > other.as_array()[6] { u32::MAX } else { 0 }, if self.as_array()[7] > other.as_array()[7] { u32::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 31); Self::from(I32x8::from(*self ^ sign_bit).cmp_gt( I32x8::from(other ^ sign_bit) )) } }
4718 }
4719 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_epi32)\n\n\n * `VPSLLD ymm, ymm, imm8`\n </li>\n </ul>"]
4720 #[inline(always)]
4721 fn shift_left<const BITS: usize>(&self) -> U32x8 {
4722 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U32x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_slli_epi32 ::<BITS>(self.0)) } }
4723 }
4724 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U32x8\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U32x8::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srli_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srli_epi32)\n\n\n * `VPSRLD ymm, ymm, imm8`\n </li>\n </ul>"]
4725 #[inline(always)]
4726 fn shift_right<const BITS: usize>(&self) -> U32x8 {
4727 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U32x8::from(out) } avx2 { const USELESS_ARRAY: [u8; 32] = [0; 32]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_srli_epi32 ::<BITS>(self.0)) } }
4728 }
4729 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n self.as_array()[1],\n other.as_array()[1],\n // Lane# 1\n self.as_array()[4],\n other.as_array()[4],\n self.as_array()[5],\n other.as_array()[5],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi32)\n\n\n * `VPUNPCKLDQ ymm, ymm, ymm`\n </li>\n </ul>"]
4730 #[inline(always)]
4731 fn unpack_lo(&self, other: U32x8) -> U32x8 {
4732 select_impl_block! { scalar { U32x8::from([ self.as_array()[0], other.as_array()[0], self.as_array()[1], other.as_array()[1], self.as_array()[4], other.as_array()[4], self.as_array()[5], other.as_array()[5], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi32 (self.0, other.0)) } }
4735 }
4736 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n // Lane# 0\n self.as_array()[2],\n other.as_array()[2],\n self.as_array()[3],\n other.as_array()[3],\n // Lane# 1\n self.as_array()[6],\n other.as_array()[6],\n self.as_array()[7],\n other.as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi32)\n\n\n * `VPUNPCKHDQ ymm, ymm, ymm`\n </li>\n </ul>"]
4737 #[inline(always)]
4738 fn unpack_hi(&self, other: U32x8) -> U32x8 {
4739 select_impl_block! { scalar { U32x8::from([ self.as_array()[2], other.as_array()[2], self.as_array()[3], other.as_array()[3], self.as_array()[6], other.as_array()[6], self.as_array()[7], other.as_array()[7], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi32 (self.0, other.0)) } }
4742 }
4743 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n self.as_array()[4].max(other.as_array()[4]),\n self.as_array()[5].max(other.as_array()[5]),\n self.as_array()[6].max(other.as_array()[6]),\n self.as_array()[7].max(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_max_epu32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_max_epu32)\n\n\n * `VPMAXUD ymm, ymm, ymm`\n </li>\n </ul>"]
4744 #[inline(always)]
4745 fn max(&self, other: U32x8) -> U32x8 {
4746 select_impl_block! { scalar { U32x8::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), self.as_array()[4].max(other.as_array()[4]), self.as_array()[5].max(other.as_array()[5]), self.as_array()[6].max(other.as_array()[6]), self.as_array()[7].max(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_max_epu32 (self.0, other.0)) } }
4747 }
4748 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n self.as_array()[4].min(other.as_array()[4]),\n self.as_array()[5].min(other.as_array()[5]),\n self.as_array()[6].min(other.as_array()[6]),\n self.as_array()[7].min(other.as_array()[7]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_min_epu32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_min_epu32)\n\n\n * `VPMINUD ymm, ymm, ymm`\n </li>\n </ul>"]
4749 #[inline(always)]
4750 fn min(&self, other: U32x8) -> U32x8 {
4751 select_impl_block! { scalar { U32x8::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), self.as_array()[4].min(other.as_array()[4]), self.as_array()[5].min(other.as_array()[5]), self.as_array()[6].min(other.as_array()[6]), self.as_array()[7].min(other.as_array()[7]), ]) } avx2 { Self( avx2::_mm256_min_epu32 (self.0, other.0)) } }
4752 }
4753}
4754impl crate::SimdBase32 for U32x8 {
4755 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U32x8\n # {\n U32x8::from([\n // 128-bit Lane #0\n self.as_array()[I0 + 0 * 4],\n self.as_array()[I1 + 0 * 4],\n self.as_array()[I2 + 0 * 4],\n self.as_array()[I3 + 0 * 4],\n // 128-bit Lane #1\n self.as_array()[I0 + 1 * 4],\n self.as_array()[I1 + 1 * 4],\n self.as_array()[I2 + 1 * 4],\n self.as_array()[I3 + 1 * 4],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_shuffle_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_shuffle_epi32)\n\n\n * `VPSHUFD ymm, ymm, imm8`\n </li>\n </ul>"]
4756 #[inline(always)]
4757 fn shuffle<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(&self) -> U32x8 {
4758 select_impl_block! { scalar { U32x8::from([ self.as_array()[I0 + 0 * 4], self.as_array()[I1 + 0 * 4], self.as_array()[I2 + 0 * 4], self.as_array()[I3 + 0 * 4], self.as_array()[I0 + 1 * 4], self.as_array()[I1 + 1 * 4], self.as_array()[I2 + 1 * 4], self.as_array()[I3 + 1 * 4], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm256_shuffle_epi32 ::<I3, I2, I1, I0>(self.0)) } }
4761 }
4762}
4763impl crate::SimdBase8x for U32x8 {
4764 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U32x8 ,\n # ) -> U32x8\n # ;}\n # impl SomeTraitForDoc for U32x8 {\n # fn the_doc_function\n # <\n # const B7: bool,\n # const B6: bool,\n # const B5: bool,\n # const B4: bool,\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U32x8 ,\n # ) -> U32x8\n # {\n U32x8::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n (if B4 { if_true } else { *self }).as_array()[4],\n (if B5 { if_true } else { *self }).as_array()[5],\n (if B6 { if_true } else { *self }).as_array()[6],\n (if B7 { if_true } else { *self }).as_array()[7],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_blend_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_blend_epi32)\n\n\n * `VPBLENDD ymm, ymm, ymm, imm8`\n </li>\n </ul>"]
4765 #[inline(always)]
4766 fn blend<
4767 const B7: bool,
4768 const B6: bool,
4769 const B5: bool,
4770 const B4: bool,
4771 const B3: bool,
4772 const B2: bool,
4773 const B1: bool,
4774 const B0: bool,
4775 >(
4776 &self,
4777 if_true: U32x8,
4778 ) -> U32x8 {
4779 select_impl_block! { scalar { U32x8::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], (if B4 { if_true } else { *self }).as_array()[4], (if B5 { if_true } else { *self }).as_array()[5], (if B6 { if_true } else { *self }).as_array()[6], (if B7 { if_true } else { *self }).as_array()[7], ]) } avx2 { Self( avx2::_mm256_blend_epi32 ::<B7, B6, B5, B4, B3, B2, B1, B0>(self.0, if_true.0)) } }
4780 }
4781}
4782#[doc = "`[u64; 2]` as a vector."]
4783#[repr(transparent)]
4784#[derive(Clone, Copy)]
4785pub struct U64x2(U64x2Internal);
4786unsafe impl bytemuck::Pod for U64x2 {}
4787unsafe impl bytemuck::Zeroable for U64x2 {}
4788impl PartialEq for U64x2 {
4789 #[inline(always)]
4790 fn eq(&self, other: &Self) -> bool {
4791 ((*self) ^ (*other)).is_zero()
4792 }
4793}
4794impl Eq for U64x2 {}
4795impl Default for U64x2 {
4796 #[doc = "The zero vector."]
4797 #[inline(always)]
4798 fn default() -> Self {
4799 Self::ZERO
4800 }
4801}
4802impl std::hash::Hash for U64x2 {
4803 #[inline]
4804 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
4805 bytemuck::bytes_of(self).hash(state);
4806 }
4807}
4808impl std::fmt::Debug for U64x2 {
4809 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4810 write!(f, "U64x2({:?})", <[u64; 2]>::from(*self))
4811 }
4812}
4813impl subtle::ConstantTimeEq for U64x2 {
4814 fn ct_eq(&self, other: &Self) -> subtle::Choice {
4815 self.as_array().ct_eq(&other.as_array())
4816 }
4817}
4818impl subtle::ConditionallySelectable for U64x2 {
4819 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
4820 let mut out = [0; 2];
4821 for (out, (a, b)) in out
4822 .iter_mut()
4823 .zip(a.as_array().iter().zip(b.as_array().iter()))
4824 {
4825 *out = <u64 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
4826 }
4827 Self::from(out)
4828 }
4829}
4830impl rand::distributions::Distribution<U64x2> for rand::distributions::Standard {
4831 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U64x2 {
4832 let mut out = U64x2::ZERO;
4833 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
4834 out
4835 }
4836}
4837impl AsRef<[u64]> for U64x2 {
4838 fn as_ref(&self) -> &[u64] {
4839 let arr: &[u64; 2] = bytemuck::cast_ref(self);
4840 arr
4841 }
4842}
4843impl AsMut<[u64]> for U64x2 {
4844 fn as_mut(&mut self) -> &mut [u64] {
4845 let arr: &mut [u64; 2] = bytemuck::cast_mut(self);
4846 arr
4847 }
4848}
4849impl From<I8x16> for U64x2 {
4850 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x16\nas little endian bits of U64x2."]
4851 #[inline(always)]
4852 fn from(x: I8x16) -> U64x2 {
4853 Self({
4854 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4856 })
4857 }
4858}
4859impl From<I16x8> for U64x2 {
4860 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x8\nas little endian bits of U64x2."]
4861 #[inline(always)]
4862 fn from(x: I16x8) -> U64x2 {
4863 Self({
4864 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4866 })
4867 }
4868}
4869impl From<I32x4> for U64x2 {
4870 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x4\nas little endian bits of U64x2."]
4871 #[inline(always)]
4872 fn from(x: I32x4) -> U64x2 {
4873 Self({
4874 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4876 })
4877 }
4878}
4879impl From<I64x2> for U64x2 {
4880 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x2\nas little endian bits of U64x2."]
4881 #[inline(always)]
4882 fn from(x: I64x2) -> U64x2 {
4883 Self({
4884 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4886 })
4887 }
4888}
4889impl From<U8x16> for U64x2 {
4890 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x16\nas little endian bits of U64x2."]
4891 #[inline(always)]
4892 fn from(x: U8x16) -> U64x2 {
4893 Self({
4894 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4896 })
4897 }
4898}
4899impl From<U16x8> for U64x2 {
4900 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x8\nas little endian bits of U64x2."]
4901 #[inline(always)]
4902 fn from(x: U16x8) -> U64x2 {
4903 Self({
4904 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4906 })
4907 }
4908}
4909impl From<U32x4> for U64x2 {
4910 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x4\nas little endian bits of U64x2."]
4911 #[inline(always)]
4912 fn from(x: U32x4) -> U64x2 {
4913 Self({
4914 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
4916 })
4917 }
4918}
4919impl crate::ExtendingCast<U8x16> for U64x2 {
4920 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U64x2\n # {\n U64x2::from([\n u64::from(vector.as_array()[0]),\n u64::from(vector.as_array()[1]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepu8_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepu8_epi64)\n\n\n * `PMOVZXBQ xmm, xmm`\n </li>\n </ul>"]
4921 #[inline(always)]
4922 fn extending_cast_from(vector: U8x16) -> U64x2 {
4923 select_impl_block! { scalar { U64x2::from([ u64::from(vector.as_array()[0]), u64::from(vector.as_array()[1]), ]) } avx2 { Self( avx2::_mm_cvtepu8_epi64 (vector.0)) } }
4924 }
4925}
4926impl crate::ExtendingCast<U16x8> for U64x2 {
4927 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U64x2\n # {\n U64x2::from([\n u64::from(vector.as_array()[0]),\n u64::from(vector.as_array()[1]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepu16_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepu16_epi64)\n\n\n * `PMOVZXWQ xmm, xmm`\n </li>\n </ul>"]
4928 #[inline(always)]
4929 fn extending_cast_from(vector: U16x8) -> U64x2 {
4930 select_impl_block! { scalar { U64x2::from([ u64::from(vector.as_array()[0]), u64::from(vector.as_array()[1]), ]) } avx2 { Self( avx2::_mm_cvtepu16_epi64 (vector.0)) } }
4931 }
4932}
4933impl crate::ExtendingCast<U32x4> for U64x2 {
4934 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U32x4 ,\n # ) -> U64x2\n # {\n U64x2::from([\n u64::from(vector.as_array()[0]),\n u64::from(vector.as_array()[1]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cvtepu32_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepu32_epi64)\n\n\n * `PMOVZXDQ xmm, xmm`\n </li>\n </ul>"]
4935 #[inline(always)]
4936 fn extending_cast_from(vector: U32x4) -> U64x2 {
4937 select_impl_block! { scalar { U64x2::from([ u64::from(vector.as_array()[0]), u64::from(vector.as_array()[1]), ]) } avx2 { Self( avx2::_mm_cvtepu32_epi64 (vector.0)) } }
4938 }
4939}
4940#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
4941impl crate::SimdBaseGatherable<U64x2> for U64x2 {
4942 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
4943 #[inline(always)]
4944 unsafe fn gather(base: *const u64, indices: U64x2) -> U64x2 {
4945 select_impl_block! { scalar { U64x2::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
4946 }
4947 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : U64x2 ,\n # mask : U64x2 ,\n # src : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n if (mask.as_array()[0] >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
4948 #[inline(always)]
4949 unsafe fn gather_masked(base: *const u64, indices: U64x2, mask: U64x2, src: U64x2) -> U64x2 {
4950 select_impl_block! { scalar { U64x2::from([ if (mask.as_array()[0] >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, ]) } avx2 { Self( avx2::_mm_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
4951 }
4952}
4953#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
4954impl crate::SimdBaseGatherable<I64x2> for U64x2 {
4955 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : I64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
4956 #[inline(always)]
4957 unsafe fn gather(base: *const u64, indices: I64x2) -> U64x2 {
4958 select_impl_block! { scalar { U64x2::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
4959 }
4960 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : I64x2 ,\n # mask : U64x2 ,\n # src : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n if (mask.as_array()[0] >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ xmm, vm64x, xmm`\n </li>\n </ul>"]
4961 #[inline(always)]
4962 unsafe fn gather_masked(base: *const u64, indices: I64x2, mask: U64x2, src: U64x2) -> U64x2 {
4963 select_impl_block! { scalar { U64x2::from([ if (mask.as_array()[0] >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, ]) } avx2 { Self( avx2::_mm_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
4964 }
4965} impl ShlAssign<u64> for U64x2 {
4967 #[inline(always)]
4968 fn shl_assign(&mut self, amount: u64) {
4969 *self = (*self) << amount;
4970 }
4971}
4972impl Shl<u64> for U64x2 {
4973 type Output = Self;
4974 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x2\n # {\n if amount >= 64 {\n U64x2::ZERO\n } else {\n U64x2::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_sll_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi64)\n\n\n * `PSLLQ xmm, xmm`\n </li>\n </ul>"]
4975 #[inline(always)]
4976 fn shl(self, amount: u64) -> U64x2 {
4977 select_impl_block! { scalar { if amount >= 64 { U64x2::ZERO } else { U64x2::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_sll_epi64 (self.0, amount)) } }
4978 }
4979} impl ShlAssign<U64x2> for U64x2 {
4981 #[inline(always)]
4982 fn shl_assign(&mut self, amount: U64x2) {
4983 *self = (*self) << amount;
4984 }
4985}
4986impl Shl<U64x2> for U64x2 {
4987 type Output = Self;
4988 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x2 ,\n # ) -> U64x2\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U64x2::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_sllv_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sllv_epi64)\n\n\n * `VPSLLVQ xmm, xmm, xmm`\n </li>\n </ul>"]
4989 #[inline(always)]
4990 fn shl(self, amount: U64x2) -> U64x2 {
4991 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x << amm } else { 0 }; } U64x2::from(out) } avx2 { Self( avx2::_mm_sllv_epi64 (self.0, amount.0)) } }
4992 }
4993} impl ShrAssign<u64> for U64x2 {
4995 #[inline(always)]
4996 fn shr_assign(&mut self, amount: u64) {
4997 *self = (*self) >> amount;
4998 }
4999}
5000impl Shr<u64> for U64x2 {
5001 type Output = Self;
5002 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x2\n # {\n if amount >= 64 {\n U64x2::ZERO\n } else {\n U64x2::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n <li>\n\n [**`_mm_srl_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srl_epi64)\n\n\n * `PSRLQ xmm, xmm`\n </li>\n </ul>"]
5003 #[inline(always)]
5004 fn shr(self, amount: u64) -> U64x2 {
5005 select_impl_block! { scalar { if amount >= 64 { U64x2::ZERO } else { U64x2::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm_srl_epi64 (self.0, amount)) } }
5006 }
5007} impl ShrAssign<U64x2> for U64x2 {
5009 #[inline(always)]
5010 fn shr_assign(&mut self, amount: U64x2) {
5011 *self = (*self) >> amount;
5012 }
5013}
5014impl Shr<U64x2> for U64x2 {
5015 type Output = Self;
5016 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x2 ,\n # ) -> U64x2\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U64x2::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srlv_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srlv_epi64)\n\n\n * `VPSRLVQ xmm, xmm, xmm`\n </li>\n </ul>"]
5017 #[inline(always)]
5018 fn shr(self, amount: U64x2) -> U64x2 {
5019 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x >> amm } else { 0 }; } U64x2::from(out) } avx2 { Self( avx2::_mm_srlv_epi64 (self.0, amount.0)) } }
5020 }
5021}
5022impl SimdBase for U64x2 {
5023 type Scalar = u64;
5024 type Array = [u64; 2];
5025 type Signed = I64x2;
5026 type Unsigned = U64x2;
5027 const LANES: usize = 2;
5028 const ZERO: Self = Self::from_array([0; 2]);
5029 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_testz_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128)\n\n\n * `PTEST xmm, xmm`\n </li>\n </ul>"]
5030 #[inline(always)]
5031 fn is_zero(&self) -> bool {
5032 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm_testz_si128 (self.0, self.0) == 1 } }
5033 }
5034 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u64 ,\n # ) -> U64x2\n # {\n let mut out = [0; 2];\n out[0] = scalar;\n U64x2::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
5035 #[inline(always)]
5036 fn set_lo(scalar: u64) -> U64x2 {
5037 select_impl_block! { scalar { let mut out = [0; 2]; out[0] = scalar; U64x2::from(out) } avx2 { Self( avx2::_mm_set_epi64x ( 0, scalar as i64, )) } }
5038 }
5039 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u64\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u64\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_extract_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi64)\n\n\n * `PEXTRQ r64, xmm, imm8`\n </li>\n </ul>"]
5040 #[inline(always)]
5041 fn extract<const I: usize>(&self) -> u64 {
5042 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm_extract_epi64 ::<I>(self.0) as u64 } }
5043 }
5044 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u64 ,\n # ) -> U64x2\n # {\n U64x2::from([scalar; 2])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_set1_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
5045 #[inline(always)]
5046 fn broadcast(scalar: u64) -> U64x2 {
5047 select_impl_block! { scalar { U64x2::from([scalar; 2]) } avx2 { Self( avx2::_mm_set1_epi64x (scalar as i64)) } }
5048 }
5049 type BroadcastLoInput = U64x2;
5050 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([vector.as_array()[0]; 2])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_broadcastq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_broadcastq_epi64)\n\n\n * `VPBROADCASTQ xmm, xmm`\n </li>\n </ul>"]
5051 #[inline(always)]
5052 fn broadcast_lo(vector: U64x2) -> U64x2 {
5053 select_impl_block! { scalar { U64x2::from([vector.as_array()[0]; 2]) } avx2 { Self( avx2::_mm_broadcastq_epi64 (vector.0)) } }
5054 }
5055 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n if self.as_array()[0] == other.as_array()[0] { u64::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u64::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_cmpeq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_epi64)\n\n\n * `PCMPEQQ xmm, xmm`\n </li>\n </ul>"]
5056 #[inline(always)]
5057 fn cmp_eq(&self, other: U64x2) -> U64x2 {
5058 select_impl_block! { scalar { U64x2::from([ if self.as_array()[0] == other.as_array()[0] { u64::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u64::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm_cmpeq_epi64 (self.0, other.0)) } }
5059 }
5060 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_andnot_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_si128)\n\n\n * `PANDN xmm, xmm`\n </li>\n </ul>"]
5061 #[inline(always)]
5062 fn and_not(&self, other: U64x2) -> U64x2 {
5063 select_impl_block! { scalar { U64x2::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), ]) } avx2 { Self( avx2::_mm_andnot_si128 (other.0, self.0)) } }
5064 }
5065 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n if self.as_array()[0] > other.as_array()[0] { u64::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u64::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 63);\n Self::from(I64x2::from(*self ^ sign_bit).cmp_gt(\n I64x2::from(other ^ sign_bit)\n ))\n ```"]
5066 #[inline(always)]
5067 fn cmp_gt(&self, other: U64x2) -> U64x2 {
5068 select_impl_block! { scalar { U64x2::from([ if self.as_array()[0] > other.as_array()[0] { u64::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u64::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 63); Self::from(I64x2::from(*self ^ sign_bit).cmp_gt( I64x2::from(other ^ sign_bit) )) } }
5070 }
5071 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x2\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U64x2::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_slli_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi64)\n\n\n * `PSLLQ xmm, imm8`\n </li>\n </ul>"]
5072 #[inline(always)]
5073 fn shift_left<const BITS: usize>(&self) -> U64x2 {
5074 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U64x2::from(out) } avx2 { const USELESS_ARRAY: [u8; 64] = [0; 64]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_slli_epi64 ::<BITS>(self.0)) } }
5075 }
5076 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x2\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U64x2::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_srli_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi64)\n\n\n * `PSRLQ xmm, imm8`\n </li>\n </ul>"]
5077 #[inline(always)]
5078 fn shift_right<const BITS: usize>(&self) -> U64x2 {
5079 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U64x2::from(out) } avx2 { const USELESS_ARRAY: [u8; 64] = [0; 64]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm_srli_epi64 ::<BITS>(self.0)) } }
5080 }
5081 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpacklo_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpacklo_epi64)\n\n\n * `PUNPCKLQDQ xmm, xmm`\n </li>\n </ul>"]
5082 #[inline(always)]
5083 fn unpack_lo(&self, other: U64x2) -> U64x2 {
5084 select_impl_block! { scalar { U64x2::from([ self.as_array()[0], other.as_array()[0], ]) } avx2 { Self( avx2::_mm_unpacklo_epi64 (self.0, other.0)) } }
5086 }
5087 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n // Lane# 0\n self.as_array()[1],\n other.as_array()[1],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_unpackhi_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_unpackhi_epi64)\n\n\n * `PUNPCKHQDQ xmm, xmm`\n </li>\n </ul>"]
5088 #[inline(always)]
5089 fn unpack_hi(&self, other: U64x2) -> U64x2 {
5090 select_impl_block! { scalar { U64x2::from([ self.as_array()[1], other.as_array()[1], ]) } avx2 { Self( avx2::_mm_unpackhi_epi64 (self.0, other.0)) } }
5092 }
5093 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
5094 #[inline(always)]
5095 fn max(&self, other: U64x2) -> U64x2 {
5096 select_impl_block! { scalar { U64x2::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), ]) } avx2 { U64x2::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), ]) } }
5097 }
5098 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
5099 #[inline(always)]
5100 fn min(&self, other: U64x2) -> U64x2 {
5101 select_impl_block! { scalar { U64x2::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), ]) } avx2 { U64x2::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), ]) } }
5102 }
5103}
5104impl crate::SimdBase64 for U64x2 {
5105 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n U64x2::from([\n ((self.as_array()[0] as u32) as u64) * ((other.as_array()[0] as u32) as u64),\n ((self.as_array()[1] as u32) as u64) * ((other.as_array()[1] as u32) as u64),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_mul_epu32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mul_epu32)\n\n\n * `PMULUDQ xmm, xmm`\n </li>\n </ul>"]
5106 #[inline(always)]
5107 fn mul_lo(&self, other: U64x2) -> U64x2 {
5108 select_impl_block! { scalar { U64x2::from([ ((self.as_array()[0] as u32) as u64) * ((other.as_array()[0] as u32) as u64), ((self.as_array()[1] as u32) as u64) * ((other.as_array()[1] as u32) as u64), ]) } avx2 { Self( avx2::_mm_mul_epu32 (self.0, other.0)) } }
5109 }
5110}
5111#[doc = "`[u64; 4]` as a vector."]
5112#[repr(transparent)]
5113#[derive(Clone, Copy)]
5114pub struct U64x4(U64x4Internal);
5115unsafe impl bytemuck::Pod for U64x4 {}
5116unsafe impl bytemuck::Zeroable for U64x4 {}
5117impl PartialEq for U64x4 {
5118 #[inline(always)]
5119 fn eq(&self, other: &Self) -> bool {
5120 ((*self) ^ (*other)).is_zero()
5121 }
5122}
5123impl Eq for U64x4 {}
5124impl Default for U64x4 {
5125 #[doc = "The zero vector."]
5126 #[inline(always)]
5127 fn default() -> Self {
5128 Self::ZERO
5129 }
5130}
5131impl std::hash::Hash for U64x4 {
5132 #[inline]
5133 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
5134 bytemuck::bytes_of(self).hash(state);
5135 }
5136}
5137impl std::fmt::Debug for U64x4 {
5138 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5139 write!(f, "U64x4({:?})", <[u64; 4]>::from(*self))
5140 }
5141}
5142impl subtle::ConstantTimeEq for U64x4 {
5143 fn ct_eq(&self, other: &Self) -> subtle::Choice {
5144 self.as_array().ct_eq(&other.as_array())
5145 }
5146}
5147impl subtle::ConditionallySelectable for U64x4 {
5148 fn conditional_select(a: &Self, b: &Self, choice: subtle::Choice) -> Self {
5149 let mut out = [0; 4];
5150 for (out, (a, b)) in out
5151 .iter_mut()
5152 .zip(a.as_array().iter().zip(b.as_array().iter()))
5153 {
5154 *out = <u64 as subtle::ConditionallySelectable>::conditional_select(a, b, choice);
5155 }
5156 Self::from(out)
5157 }
5158}
5159impl rand::distributions::Distribution<U64x4> for rand::distributions::Standard {
5160 fn sample<R: rand::prelude::Rng + ?Sized>(&self, rng: &mut R) -> U64x4 {
5161 let mut out = U64x4::ZERO;
5162 rng.fill_bytes(bytemuck::bytes_of_mut(&mut out));
5163 out
5164 }
5165}
5166impl AsRef<[u64]> for U64x4 {
5167 fn as_ref(&self) -> &[u64] {
5168 let arr: &[u64; 4] = bytemuck::cast_ref(self);
5169 arr
5170 }
5171}
5172impl AsMut<[u64]> for U64x4 {
5173 fn as_mut(&mut self) -> &mut [u64] {
5174 let arr: &mut [u64; 4] = bytemuck::cast_mut(self);
5175 arr
5176 }
5177}
5178impl From<I8x32> for U64x4 {
5179 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I8x32\nas little endian bits of U64x4."]
5180 #[inline(always)]
5181 fn from(x: I8x32) -> U64x4 {
5182 Self({
5183 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
5185 })
5186 }
5187}
5188impl From<I16x16> for U64x4 {
5189 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I16x16\nas little endian bits of U64x4."]
5190 #[inline(always)]
5191 fn from(x: I16x16) -> U64x4 {
5192 Self({
5193 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
5195 })
5196 }
5197}
5198impl From<I32x8> for U64x4 {
5199 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I32x8\nas little endian bits of U64x4."]
5200 #[inline(always)]
5201 fn from(x: I32x8) -> U64x4 {
5202 Self({
5203 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
5205 })
5206 }
5207}
5208impl From<I64x4> for U64x4 {
5209 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of I64x4\nas little endian bits of U64x4."]
5210 #[inline(always)]
5211 fn from(x: I64x4) -> U64x4 {
5212 Self({
5213 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
5215 })
5216 }
5217}
5218impl From<U8x32> for U64x4 {
5219 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U8x32\nas little endian bits of U64x4."]
5220 #[inline(always)]
5221 fn from(x: U8x32) -> U64x4 {
5222 Self({
5223 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
5225 })
5226 }
5227}
5228impl From<U16x16> for U64x4 {
5229 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U16x16\nas little endian bits of U64x4."]
5230 #[inline(always)]
5231 fn from(x: U16x16) -> U64x4 {
5232 Self({
5233 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
5235 })
5236 }
5237}
5238impl From<U32x8> for U64x4 {
5239 #[doc = "This cast is 100% free. It reinterprets the little-endinan bits of U32x8\nas little endian bits of U64x4."]
5240 #[inline(always)]
5241 fn from(x: U32x8) -> U64x4 {
5242 Self({
5243 select_impl_block! { scalar { #[cfg(target_endian="little")] bytemuck::cast(x.0) } avx2 { x.0 } }
5245 })
5246 }
5247}
5248impl From<U32x4> for U64x4 {
5249 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U32x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n u64::from(vector.as_array()[0]),\n u64::from(vector.as_array()[1]),\n u64::from(vector.as_array()[2]),\n u64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu32_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu32_epi64)\n\n\n * `VPMOVZXDQ ymm, xmm`\n </li>\n </ul>"]
5250 #[inline(always)]
5251 fn from(vector: U32x4) -> U64x4 {
5252 select_impl_block! { scalar { U64x4::from([ u64::from(vector.as_array()[0]), u64::from(vector.as_array()[1]), u64::from(vector.as_array()[2]), u64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepu32_epi64 (vector.0)) } }
5253 }
5254}
5255impl crate::ExtendingCast<U8x16> for U64x4 {
5256 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U8x16 ,\n # ) -> U64x4\n # {\n U64x4::from([\n u64::from(vector.as_array()[0]),\n u64::from(vector.as_array()[1]),\n u64::from(vector.as_array()[2]),\n u64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu8_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu8_epi64)\n\n\n * `VPMOVZXBQ ymm, xmm`\n </li>\n </ul>"]
5257 #[inline(always)]
5258 fn extending_cast_from(vector: U8x16) -> U64x4 {
5259 select_impl_block! { scalar { U64x4::from([ u64::from(vector.as_array()[0]), u64::from(vector.as_array()[1]), u64::from(vector.as_array()[2]), u64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepu8_epi64 (vector.0)) } }
5260 }
5261}
5262impl crate::ExtendingCast<U16x8> for U64x4 {
5263 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U16x8 ,\n # ) -> U64x4\n # {\n U64x4::from([\n u64::from(vector.as_array()[0]),\n u64::from(vector.as_array()[1]),\n u64::from(vector.as_array()[2]),\n u64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu16_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu16_epi64)\n\n\n * `VPMOVZXWQ ymm, xmm`\n </li>\n </ul>"]
5264 #[inline(always)]
5265 fn extending_cast_from(vector: U16x8) -> U64x4 {
5266 select_impl_block! { scalar { U64x4::from([ u64::from(vector.as_array()[0]), u64::from(vector.as_array()[1]), u64::from(vector.as_array()[2]), u64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepu16_epi64 (vector.0)) } }
5267 }
5268}
5269impl crate::ExtendingCast<U32x4> for U64x4 {
5270 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U32x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n u64::from(vector.as_array()[0]),\n u64::from(vector.as_array()[1]),\n u64::from(vector.as_array()[2]),\n u64::from(vector.as_array()[3]),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cvtepu32_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtepu32_epi64)\n\n\n * `VPMOVZXDQ ymm, xmm`\n </li>\n </ul>"]
5271 #[inline(always)]
5272 fn extending_cast_from(vector: U32x4) -> U64x4 {
5273 select_impl_block! { scalar { U64x4::from([ u64::from(vector.as_array()[0]), u64::from(vector.as_array()[1]), u64::from(vector.as_array()[2]), u64::from(vector.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_cvtepu32_epi64 (vector.0)) } }
5274 }
5275}
5276impl From<U64x2> for U64x4 {
5277 #[doc = " NOTE: this will _zero_ the upper bits of the destination. Other\n intrinsics are more effcient, but leave the upper bits undefined.\n At present, these more effcient intrinsics are not exposed.\n\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U64x2 ,\n # ) -> U64x4\n # {\n let mut out = [0; 4];\n out[0..2].copy_from_slice(&vector.as_array());\n U64x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_zextsi128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_zextsi128_si256)\n\n\n </li>\n </ul>"]
5278 #[inline(always)]
5279 fn from(vector: U64x2) -> U64x4 {
5280 select_impl_block! { scalar { let mut out = [0; 4]; out[0..2].copy_from_slice(&vector.as_array()); U64x4::from(out) } avx2 { Self( avx2::_mm256_zextsi128_si256 (vector.0)) } }
5281 }
5282}
5283impl From<[U64x2; 2]> for U64x4 {
5284 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vectors : [U64x2; 2] ,\n # ) -> U64x4\n # {\n let mut out = [0; 4];\n out[0..2].copy_from_slice(&vectors[0].as_array());\n out[2..].copy_from_slice(&vectors[1].as_array());\n U64x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_m128i`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_m128i)\n\n\n * `VINSERTF128 ymm, ymm, xmm, imm8`\n </li>\n </ul>"]
5285 #[inline(always)]
5286 fn from(vectors: [U64x2; 2]) -> U64x4 {
5287 select_impl_block! { scalar { let mut out = [0; 4]; out[0..2].copy_from_slice(&vectors[0].as_array()); out[2..].copy_from_slice(&vectors[1].as_array()); U64x4::from(out) } avx2 { Self( avx2::_mm256_set_m128i (vectors[1].0, vectors[0].0)) } }
5288 }
5289} impl From<U64x4> for [U64x2; 2] {
5291 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U64x4 ,\n # ) -> [U64x2; 2]\n # {\n let mut lo = [0; 2];\n let mut hi = [0; 2];\n lo.copy_from_slice(&vector.as_array()[0..2]);\n hi.copy_from_slice(&vector.as_array()[2..]);\n [U64x2::from(lo), U64x2::from(hi)]\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extracti128_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extracti128_si256)\n\n\n * `VEXTRACTI128 xmm, ymm, imm8`\n </li>\n </ul>"]
5292 #[inline(always)]
5293 fn from(vector: U64x4) -> [U64x2; 2] {
5294 select_impl_block! { scalar { let mut lo = [0; 2]; let mut hi = [0; 2]; lo.copy_from_slice(&vector.as_array()[0..2]); hi.copy_from_slice(&vector.as_array()[2..]); [U64x2::from(lo), U64x2::from(hi)] } avx2 { [ U64x2( avx2::_mm256_extracti128_si256 ::<0>(vector.0)), U64x2( avx2::_mm256_extracti128_si256 ::<1>(vector.0)), ] } }
5295 }
5296}
5297#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
5298impl crate::SimdBaseGatherable<I32x4> for U64x4 {
5299 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : I32x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i32gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i32gather_epi64)\n\n\n * `VPGATHERDQ ymm, vm32x, ymm`\n </li>\n </ul>"]
5300 #[inline(always)]
5301 unsafe fn gather(base: *const u64, indices: I32x4) -> U64x4 {
5302 select_impl_block! { scalar { U64x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i32gather_epi64 ::<8>(base as *const i64, indices.0)) } }
5303 }
5304 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : I32x4 ,\n # mask : U64x4 ,\n # src : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n if (mask.as_array()[0] >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if (mask.as_array()[2] >> 63) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if (mask.as_array()[3] >> 63) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i32gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i32gather_epi64)\n\n\n * `VPGATHERDQ ymm, vm32x, ymm`\n </li>\n </ul>"]
5305 #[inline(always)]
5306 unsafe fn gather_masked(base: *const u64, indices: I32x4, mask: U64x4, src: U64x4) -> U64x4 {
5307 select_impl_block! { scalar { U64x4::from([ if (mask.as_array()[0] >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if (mask.as_array()[2] >> 63) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if (mask.as_array()[3] >> 63) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i32gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
5308 }
5309}
5310#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
5311impl crate::SimdBaseGatherable<U64x4> for U64x4 {
5312 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
5313 #[inline(always)]
5314 unsafe fn gather(base: *const u64, indices: U64x4) -> U64x4 {
5315 select_impl_block! { scalar { U64x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
5316 }
5317 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : U64x4 ,\n # mask : U64x4 ,\n # src : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n if (mask.as_array()[0] >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if (mask.as_array()[2] >> 63) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if (mask.as_array()[3] >> 63) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
5318 #[inline(always)]
5319 unsafe fn gather_masked(base: *const u64, indices: U64x4, mask: U64x4, src: U64x4) -> U64x4 {
5320 select_impl_block! { scalar { U64x4::from([ if (mask.as_array()[0] >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if (mask.as_array()[2] >> 63) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if (mask.as_array()[3] >> 63) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
5321 }
5322}
5323#[doc = "# Safety\n`base` does not need to be aligned. Forall `i`, `base + indices[i]` must meet\nthe safety requirements of [std::ptr::read_unaligned]"]
5324impl crate::SimdBaseGatherable<I64x4> for U64x4 {
5325 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : I64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n base.offset(indices.as_array()[0] as isize).read_unaligned(),\n base.offset(indices.as_array()[1] as isize).read_unaligned(),\n base.offset(indices.as_array()[2] as isize).read_unaligned(),\n base.offset(indices.as_array()[3] as isize).read_unaligned(),\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
5326 #[inline(always)]
5327 unsafe fn gather(base: *const u64, indices: I64x4) -> U64x4 {
5328 select_impl_block! { scalar { U64x4::from([ base.offset(indices.as_array()[0] as isize).read_unaligned(), base.offset(indices.as_array()[1] as isize).read_unaligned(), base.offset(indices.as_array()[2] as isize).read_unaligned(), base.offset(indices.as_array()[3] as isize).read_unaligned(), ]) } avx2 { Self( avx2::_mm256_i64gather_epi64 ::<8>(base as *const i64, indices.0)) } }
5329 }
5330 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # unsafe\n # fn the_doc_function\n # (\n # base : *const u64 ,\n # indices : I64x4 ,\n # mask : U64x4 ,\n # src : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n if (mask.as_array()[0] >> 63) == 1 {\n base.offset(indices.as_array()[0] as isize).read_unaligned()\n } else {\n src.as_array()[0]\n },\n if (mask.as_array()[1] >> 63) == 1 {\n base.offset(indices.as_array()[1] as isize).read_unaligned()\n } else {\n src.as_array()[1]\n },\n if (mask.as_array()[2] >> 63) == 1 {\n base.offset(indices.as_array()[2] as isize).read_unaligned()\n } else {\n src.as_array()[2]\n },\n if (mask.as_array()[3] >> 63) == 1 {\n base.offset(indices.as_array()[3] as isize).read_unaligned()\n } else {\n src.as_array()[3]\n },\n ])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mask_i64gather_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_epi64)\n\n\n * `VPGATHERQQ ymm, vm64x, ymm`\n </li>\n </ul>"]
5331 #[inline(always)]
5332 unsafe fn gather_masked(base: *const u64, indices: I64x4, mask: U64x4, src: U64x4) -> U64x4 {
5333 select_impl_block! { scalar { U64x4::from([ if (mask.as_array()[0] >> 63) == 1 { base.offset(indices.as_array()[0] as isize).read_unaligned() } else { src.as_array()[0] }, if (mask.as_array()[1] >> 63) == 1 { base.offset(indices.as_array()[1] as isize).read_unaligned() } else { src.as_array()[1] }, if (mask.as_array()[2] >> 63) == 1 { base.offset(indices.as_array()[2] as isize).read_unaligned() } else { src.as_array()[2] }, if (mask.as_array()[3] >> 63) == 1 { base.offset(indices.as_array()[3] as isize).read_unaligned() } else { src.as_array()[3] }, ]) } avx2 { Self( avx2::_mm256_mask_i64gather_epi64 ::<8>( src.0, base as *const i64, indices.0, mask.0, )) } }
5334 }
5335} impl ShlAssign<u64> for U64x4 {
5337 #[inline(always)]
5338 fn shl_assign(&mut self, amount: u64) {
5339 *self = (*self) << amount;
5340 }
5341}
5342impl Shl<u64> for U64x4 {
5343 type Output = Self;
5344 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x4\n # {\n if amount >= 64 {\n U64x4::ZERO\n } else {\n U64x4::from([\n self.as_array()[0] << amount,\n self.as_array()[1] << amount,\n self.as_array()[2] << amount,\n self.as_array()[3] << amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sll_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sll_epi64)\n\n\n * `VPSLLQ ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
5345 #[inline(always)]
5346 fn shl(self, amount: u64) -> U64x4 {
5347 select_impl_block! { scalar { if amount >= 64 { U64x4::ZERO } else { U64x4::from([ self.as_array()[0] << amount, self.as_array()[1] << amount, self.as_array()[2] << amount, self.as_array()[3] << amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_sll_epi64 (self.0, amount)) } }
5348 }
5349} impl ShlAssign<U64x4> for U64x4 {
5351 #[inline(always)]
5352 fn shl_assign(&mut self, amount: U64x4) {
5353 *self = (*self) << amount;
5354 }
5355}
5356impl Shl<U64x4> for U64x4 {
5357 type Output = Self;
5358 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x4 ,\n # ) -> U64x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x << amm\n } else {\n 0\n };\n }\n U64x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_sllv_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_sllv_epi64)\n\n\n * `VPSLLVQ ymm, ymm, ymm`\n </li>\n </ul>"]
5359 #[inline(always)]
5360 fn shl(self, amount: U64x4) -> U64x4 {
5361 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x << amm } else { 0 }; } U64x4::from(out) } avx2 { Self( avx2::_mm256_sllv_epi64 (self.0, amount.0)) } }
5362 }
5363} impl ShrAssign<u64> for U64x4 {
5365 #[inline(always)]
5366 fn shr_assign(&mut self, amount: u64) {
5367 *self = (*self) >> amount;
5368 }
5369}
5370impl Shr<u64> for U64x4 {
5371 type Output = Self;
5372 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : u64 ,\n # ) -> U64x4\n # {\n if amount >= 64 {\n U64x4::ZERO\n } else {\n U64x4::from([\n self.as_array()[0] >> amount,\n self.as_array()[1] >> amount,\n self.as_array()[2] >> amount,\n self.as_array()[3] >> amount,\n ])\n }\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srl_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srl_epi64)\n\n\n * `VPSRLQ ymm, ymm, xmm`\n </li>\n <li>\n\n [**`_mm_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
5373 #[inline(always)]
5374 fn shr(self, amount: u64) -> U64x4 {
5375 select_impl_block! { scalar { if amount >= 64 { U64x4::ZERO } else { U64x4::from([ self.as_array()[0] >> amount, self.as_array()[1] >> amount, self.as_array()[2] >> amount, self.as_array()[3] >> amount, ]) } } avx2 { let amount = avx2::_mm_set_epi64x (0, amount as i64); Self( avx2::_mm256_srl_epi64 (self.0, amount)) } }
5376 }
5377} impl ShrAssign<U64x4> for U64x4 {
5379 #[inline(always)]
5380 fn shr_assign(&mut self, amount: U64x4) {
5381 *self = (*self) >> amount;
5382 }
5383}
5384impl Shr<U64x4> for U64x4 {
5385 type Output = Self;
5386 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # self ,\n # amount : U64x4 ,\n # ) -> U64x4\n # {\n let mut out = self.as_array();\n for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {\n *x = if (0..64).contains(&amm) {\n *x >> amm\n } else {\n 0\n };\n }\n U64x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srlv_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srlv_epi64)\n\n\n * `VPSRLVQ ymm, ymm, ymm`\n </li>\n </ul>"]
5387 #[inline(always)]
5388 fn shr(self, amount: U64x4) -> U64x4 {
5389 select_impl_block! { scalar { let mut out = self.as_array(); for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) { *x = if (0..64).contains(&amm) { *x >> amm } else { 0 }; } U64x4::from(out) } avx2 { Self( avx2::_mm256_srlv_epi64 (self.0, amount.0)) } }
5390 }
5391}
5392impl SimdBase for U64x4 {
5393 type Scalar = u64;
5394 type Array = [u64; 4];
5395 type Signed = I64x4;
5396 type Unsigned = U64x4;
5397 const LANES: usize = 4;
5398 const ZERO: Self = Self::from_array([0; 4]);
5399 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # ) -> bool\n # {\n self.as_array().iter().all(|x| *x == 0)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_testz_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_testz_si256)\n\n\n * `VPTEST ymm, ymm`\n </li>\n </ul>"]
5400 #[inline(always)]
5401 fn is_zero(&self) -> bool {
5402 select_impl_block! { scalar { self.as_array().iter().all(|x| *x == 0) } avx2 { avx2::_mm256_testz_si256 (self.0, self.0) == 1 } }
5403 }
5404 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u64 ,\n # ) -> U64x4\n # {\n let mut out = [0; 4];\n out[0] = scalar;\n U64x4::from(out)\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
5405 #[inline(always)]
5406 fn set_lo(scalar: u64) -> U64x4 {
5407 select_impl_block! { scalar { let mut out = [0; 4]; out[0] = scalar; U64x4::from(out) } avx2 { Self( avx2::_mm256_set_epi64x ( 0, 0, 0, scalar as i64, )) } }
5408 }
5409 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u64\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # <\n # const I: usize,\n # >\n # (\n # &self ,\n # ) -> u64\n # {\n self.as_array()[I]\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_extract_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_extract_epi64)\n\n\n Instruction sequence.\n </li>\n </ul>"]
5410 #[inline(always)]
5411 fn extract<const I: usize>(&self) -> u64 {
5412 select_impl_block! { scalar { self.as_array()[I] } avx2 { avx2::_mm256_extract_epi64 ::<I>(self.0) as u64 } }
5413 }
5414 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # scalar : u64 ,\n # ) -> U64x4\n # {\n U64x4::from([scalar; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_set1_epi64x`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi64x)\n\n\n Instruction sequence.\n </li>\n </ul>"]
5415 #[inline(always)]
5416 fn broadcast(scalar: u64) -> U64x4 {
5417 select_impl_block! { scalar { U64x4::from([scalar; 4]) } avx2 { Self( avx2::_mm256_set1_epi64x (scalar as i64)) } }
5418 }
5419 type BroadcastLoInput = U64x2;
5420 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # fn the_doc_function\n # (\n # vector : U64x2 ,\n # ) -> U64x4\n # {\n U64x4::from([vector.as_array()[0]; 4])\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_broadcastq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_broadcastq_epi64)\n\n\n * `VPBROADCASTQ ymm, xmm`\n </li>\n </ul>"]
5421 #[inline(always)]
5422 fn broadcast_lo(vector: U64x2) -> U64x4 {
5423 select_impl_block! { scalar { U64x4::from([vector.as_array()[0]; 4]) } avx2 { Self( avx2::_mm256_broadcastq_epi64 (vector.0)) } }
5424 }
5425 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n if self.as_array()[0] == other.as_array()[0] { u64::MAX } else { 0 },\n if self.as_array()[1] == other.as_array()[1] { u64::MAX } else { 0 },\n if self.as_array()[2] == other.as_array()[2] { u64::MAX } else { 0 },\n if self.as_array()[3] == other.as_array()[3] { u64::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_cmpeq_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cmpeq_epi64)\n\n\n * `VPCMPEQQ ymm, ymm, ymm`\n </li>\n </ul>"]
5426 #[inline(always)]
5427 fn cmp_eq(&self, other: U64x4) -> U64x4 {
5428 select_impl_block! { scalar { U64x4::from([ if self.as_array()[0] == other.as_array()[0] { u64::MAX } else { 0 }, if self.as_array()[1] == other.as_array()[1] { u64::MAX } else { 0 }, if self.as_array()[2] == other.as_array()[2] { u64::MAX } else { 0 }, if self.as_array()[3] == other.as_array()[3] { u64::MAX } else { 0 }, ]) } avx2 { Self( avx2::_mm256_cmpeq_epi64 (self.0, other.0)) } }
5429 }
5430 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n self.as_array()[0] & (!other.as_array()[0]),\n self.as_array()[1] & (!other.as_array()[1]),\n self.as_array()[2] & (!other.as_array()[2]),\n self.as_array()[3] & (!other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_andnot_si256`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_andnot_si256)\n\n\n * `VPANDN ymm, ymm, ymm`\n </li>\n </ul>"]
5431 #[inline(always)]
5432 fn and_not(&self, other: U64x4) -> U64x4 {
5433 select_impl_block! { scalar { U64x4::from([ self.as_array()[0] & (!other.as_array()[0]), self.as_array()[1] & (!other.as_array()[1]), self.as_array()[2] & (!other.as_array()[2]), self.as_array()[3] & (!other.as_array()[3]), ]) } avx2 { Self( avx2::_mm256_andnot_si256 (other.0, self.0)) } }
5434 }
5435 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n if self.as_array()[0] > other.as_array()[0] { u64::MAX } else { 0 },\n if self.as_array()[1] > other.as_array()[1] { u64::MAX } else { 0 },\n if self.as_array()[2] > other.as_array()[2] { u64::MAX } else { 0 },\n if self.as_array()[3] > other.as_array()[3] { u64::MAX } else { 0 },\n ])\n # }\n # }\n ```\n # Avx2\n **NOTE:** this implementation uses an efficient vector polyfill, though this operation is not natively supported.\n ```ignore\n // Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK\n let sign_bit = Self::broadcast(1 << 63);\n Self::from(I64x4::from(*self ^ sign_bit).cmp_gt(\n I64x4::from(other ^ sign_bit)\n ))\n ```"]
5436 #[inline(always)]
5437 fn cmp_gt(&self, other: U64x4) -> U64x4 {
5438 select_impl_block! { scalar { U64x4::from([ if self.as_array()[0] > other.as_array()[0] { u64::MAX } else { 0 }, if self.as_array()[1] > other.as_array()[1] { u64::MAX } else { 0 }, if self.as_array()[2] > other.as_array()[2] { u64::MAX } else { 0 }, if self.as_array()[3] > other.as_array()[3] { u64::MAX } else { 0 }, ]) } avx2 { let sign_bit = Self::broadcast(1 << 63); Self::from(I64x4::from(*self ^ sign_bit).cmp_gt( I64x4::from(other ^ sign_bit) )) } }
5440 }
5441 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x <<= BITS;\n }\n U64x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_slli_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_slli_epi64)\n\n\n * `VPSLLQ ymm, ymm, imm8`\n </li>\n </ul>"]
5442 #[inline(always)]
5443 fn shift_left<const BITS: usize>(&self) -> U64x4 {
5444 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x <<= BITS; } U64x4::from(out) } avx2 { const USELESS_ARRAY: [u8; 64] = [0; 64]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_slli_epi64 ::<BITS>(self.0)) } }
5445 }
5446 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # <\n # const BITS: usize,\n # >\n # (\n # &self ,\n # ) -> U64x4\n # {\n let mut out = self.as_array();\n for x in out.iter_mut() {\n *x >>= BITS;\n }\n U64x4::from(out)\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_srli_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_srli_epi64)\n\n\n * `VPSRLQ ymm, ymm, imm8`\n </li>\n </ul>"]
5447 #[inline(always)]
5448 fn shift_right<const BITS: usize>(&self) -> U64x4 {
5449 select_impl_block! { scalar { let mut out = self.as_array(); for x in out.iter_mut() { *x >>= BITS; } U64x4::from(out) } avx2 { const USELESS_ARRAY: [u8; 64] = [0; 64]; let _assert_bits_in_range: u8 = USELESS_ARRAY[BITS]; Self( avx2::_mm256_srli_epi64 ::<BITS>(self.0)) } }
5450 }
5451 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n // Lane# 0\n self.as_array()[0],\n other.as_array()[0],\n // Lane# 1\n self.as_array()[2],\n other.as_array()[2],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpacklo_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpacklo_epi64)\n\n\n * `VPUNPCKLQDQ ymm, ymm, ymm`\n </li>\n </ul>"]
5452 #[inline(always)]
5453 fn unpack_lo(&self, other: U64x4) -> U64x4 {
5454 select_impl_block! { scalar { U64x4::from([ self.as_array()[0], other.as_array()[0], self.as_array()[2], other.as_array()[2], ]) } avx2 { Self( avx2::_mm256_unpacklo_epi64 (self.0, other.0)) } }
5457 }
5458 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n // Lane# 0\n self.as_array()[1],\n other.as_array()[1],\n // Lane# 1\n self.as_array()[3],\n other.as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_unpackhi_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_unpackhi_epi64)\n\n\n * `VPUNPCKHQDQ ymm, ymm, ymm`\n </li>\n </ul>"]
5459 #[inline(always)]
5460 fn unpack_hi(&self, other: U64x4) -> U64x4 {
5461 select_impl_block! { scalar { U64x4::from([ self.as_array()[1], other.as_array()[1], self.as_array()[3], other.as_array()[3], ]) } avx2 { Self( avx2::_mm256_unpackhi_epi64 (self.0, other.0)) } }
5464 }
5465 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n self.as_array()[0].max(other.as_array()[0]),\n self.as_array()[1].max(other.as_array()[1]),\n self.as_array()[2].max(other.as_array()[2]),\n self.as_array()[3].max(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
5466 #[inline(always)]
5467 fn max(&self, other: U64x4) -> U64x4 {
5468 select_impl_block! { scalar { U64x4::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), ]) } avx2 { U64x4::from([ self.as_array()[0].max(other.as_array()[0]), self.as_array()[1].max(other.as_array()[1]), self.as_array()[2].max(other.as_array()[2]), self.as_array()[3].max(other.as_array()[3]), ]) } }
5469 }
5470 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n self.as_array()[0].min(other.as_array()[0]),\n self.as_array()[1].min(other.as_array()[1]),\n self.as_array()[2].min(other.as_array()[2]),\n self.as_array()[3].min(other.as_array()[3]),\n ])\n # }\n # }\n ```\n # Avx2\n **WARNING:** this implementation is a polyfill which executes the scalar implemenation."]
5471 #[inline(always)]
5472 fn min(&self, other: U64x4) -> U64x4 {
5473 select_impl_block! { scalar { U64x4::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), ]) } avx2 { U64x4::from([ self.as_array()[0].min(other.as_array()[0]), self.as_array()[1].min(other.as_array()[1]), self.as_array()[2].min(other.as_array()[2]), self.as_array()[3].min(other.as_array()[3]), ]) } }
5474 }
5475}
5476impl crate::SimdBase4x for U64x4 {
5477 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # <\n # const B3: bool,\n # const B2: bool,\n # const B1: bool,\n # const B0: bool,\n # >\n # (\n # &self ,\n # if_true : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n (if B0 { if_true } else { *self }).as_array()[0],\n (if B1 { if_true } else { *self }).as_array()[1],\n (if B2 { if_true } else { *self }).as_array()[2],\n (if B3 { if_true } else { *self }).as_array()[3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_blend_epi32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_blend_epi32)\n\n\n * `VPBLENDD ymm, ymm, ymm, imm8`\n </li>\n </ul>"]
5478 #[inline(always)]
5479 fn blend<const B3: bool, const B2: bool, const B1: bool, const B0: bool>(
5480 &self,
5481 if_true: U64x4,
5482 ) -> U64x4 {
5483 select_impl_block! { scalar { U64x4::from([ (if B0 { if_true } else { *self }).as_array()[0], (if B1 { if_true } else { *self }).as_array()[1], (if B2 { if_true } else { *self }).as_array()[2], (if B3 { if_true } else { *self }).as_array()[3], ]) } avx2 { Self( avx2::_mm256_blend_epi32 ::< B3, B3, B2, B2, B1, B1, B0, B0 >(self.0, if_true.0)) } }
5484 }
5485}
5486impl crate::SimdBase64 for U64x4 {
5487 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # (\n # &self ,\n # other : U64x4 ,\n # ) -> U64x4\n # {\n U64x4::from([\n ((self.as_array()[0] as u32) as u64) * ((other.as_array()[0] as u32) as u64),\n ((self.as_array()[1] as u32) as u64) * ((other.as_array()[1] as u32) as u64),\n ((self.as_array()[2] as u32) as u64) * ((other.as_array()[2] as u32) as u64),\n ((self.as_array()[3] as u32) as u64) * ((other.as_array()[3] as u32) as u64),\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_mul_epu32`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mul_epu32)\n\n\n * `VPMULUDQ ymm, ymm, ymm`\n </li>\n </ul>"]
5488 #[inline(always)]
5489 fn mul_lo(&self, other: U64x4) -> U64x4 {
5490 select_impl_block! { scalar { U64x4::from([ ((self.as_array()[0] as u32) as u64) * ((other.as_array()[0] as u32) as u64), ((self.as_array()[1] as u32) as u64) * ((other.as_array()[1] as u32) as u64), ((self.as_array()[2] as u32) as u64) * ((other.as_array()[2] as u32) as u64), ((self.as_array()[3] as u32) as u64) * ((other.as_array()[3] as u32) as u64), ]) } avx2 { Self( avx2::_mm256_mul_epu32 (self.0, other.0)) } }
5491 }
5492}
5493impl crate::SimdBase4x64 for U64x4 {
5494 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U64x4\n # ;}\n # impl SomeTraitForDoc for U64x4 {\n # fn the_doc_function\n # <\n # const I3: usize,\n # const I2: usize,\n # const I1: usize,\n # const I0: usize,\n # >\n # (\n # &self ,\n # ) -> U64x4\n # {\n U64x4::from([\n self.as_array()[I0],\n self.as_array()[I1],\n self.as_array()[I2],\n self.as_array()[I3],\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm256_permute4x64_epi64`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_permute4x64_epi64)\n\n\n * `VPERMQ ymm, ymm, imm8`\n </li>\n </ul>"]
5495 #[inline(always)]
5496 fn shuffle<const I3: usize, const I2: usize, const I1: usize, const I0: usize>(&self) -> U64x4 {
5497 select_impl_block! { scalar { U64x4::from([ self.as_array()[I0], self.as_array()[I1], self.as_array()[I2], self.as_array()[I3], ]) } avx2 { const USELESS_ARRAY: [u8; 4] = [0; 4]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I0]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I1]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I2]; let _assert_bits_in_range_i: u8 = USELESS_ARRAY[I3]; Self( avx2::_mm256_permute4x64_epi64 ::<I3, I2, I1, I0>(self.0)) } }
5498 }
5499}
5500impl U64x2 {
5501 #[doc = "\n # Scalar Equivalent:\n ```\n # use vectoreyes::*;\n # trait SomeTraitForDoc {\n # fn the_doc_function\n # <\n # const HI_OTHER: bool,\n # const HI_SELF: bool,\n # >\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # ;}\n # impl SomeTraitForDoc for U64x2 {\n # fn the_doc_function\n # <\n # const HI_OTHER: bool,\n # const HI_SELF: bool,\n # >\n # (\n # &self ,\n # other : U64x2 ,\n # ) -> U64x2\n # {\n let x = if HI_SELF { self.as_array()[1] } else { self.as_array()[0] };\n let y = if HI_OTHER { other.as_array()[1] } else { other.as_array()[0] };\n // This software carryless-multplication implementation is from https://github.com/RustCrypto/universal-hashes/blob/2e8a948dbb25bc2ac6c712b4bdc21b158527ca70/polyval/src/backend/soft64.rs\n // That code is MIT/Apache dual-licensed.\n #[inline(always)]\n fn bmul64(x: u64, y: u64) -> u64 {\n use std::num::Wrapping;\n let x0 = Wrapping(x & 0x1111_1111_1111_1111);\n let x1 = Wrapping(x & 0x2222_2222_2222_2222);\n let x2 = Wrapping(x & 0x4444_4444_4444_4444);\n let x3 = Wrapping(x & 0x8888_8888_8888_8888);\n let y0 = Wrapping(y & 0x1111_1111_1111_1111);\n let y1 = Wrapping(y & 0x2222_2222_2222_2222);\n let y2 = Wrapping(y & 0x4444_4444_4444_4444);\n let y3 = Wrapping(y & 0x8888_8888_8888_8888);\n let mut z0 = ((x0 * y0) ^ (x1 * y3) ^ (x2 * y2) ^ (x3 * y1)).0;\n let mut z1 = ((x0 * y1) ^ (x1 * y0) ^ (x2 * y3) ^ (x3 * y2)).0;\n let mut z2 = ((x0 * y2) ^ (x1 * y1) ^ (x2 * y0) ^ (x3 * y3)).0;\n let mut z3 = ((x0 * y3) ^ (x1 * y2) ^ (x2 * y1) ^ (x3 * y0)).0;\n z0 &= 0x1111_1111_1111_1111;\n z1 &= 0x2222_2222_2222_2222;\n z2 &= 0x4444_4444_4444_4444;\n z3 &= 0x8888_8888_8888_8888;\n z0 | z1 | z2 | z3\n }\n #[inline(always)]\n fn rev64(mut x: u64) -> u64 {\n x = ((x & 0x5555_5555_5555_5555) << 1) | ((x >> 1) & 0x5555_5555_5555_5555);\n x = ((x & 0x3333_3333_3333_3333) << 2) | ((x >> 2) & 0x3333_3333_3333_3333);\n x = ((x & 0x0f0f_0f0f_0f0f_0f0f) << 4) | ((x >> 4) & 0x0f0f_0f0f_0f0f_0f0f);\n x = ((x & 0x00ff_00ff_00ff_00ff) << 8) | ((x >> 8) & 0x00ff_00ff_00ff_00ff);\n x = ((x & 0xffff_0000_ffff) << 16) | ((x >> 16) & 0xffff_0000_ffff);\n x.rotate_right(32)\n }\n U64x2::from([\n bmul64(x, y),\n rev64(bmul64(rev64(x), rev64(y))) >> 1,\n ])\n # }\n # }\n ```\n # Avx2\n <ul>\n <li>\n\n [**`_mm_clmulepi64_si128`**](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_clmulepi64_si128)\n\n\n * `PCLMULQDQ xmm, xmm, imm8`\n </li>\n </ul>"]
5502 #[inline(always)]
5503 pub fn carryless_mul<const HI_OTHER: bool, const HI_SELF: bool>(&self, other: U64x2) -> U64x2 {
5504 select_impl_block! { scalar { let x = if HI_SELF { self.as_array()[1] } else { self.as_array()[0] }; let y = if HI_OTHER { other.as_array()[1] } else { other.as_array()[0] }; #[inline(always)] fn bmul64(x: u64, y: u64) -> u64 { use std::num::Wrapping; let x0 = Wrapping(x & 0x1111_1111_1111_1111); let x1 = Wrapping(x & 0x2222_2222_2222_2222); let x2 = Wrapping(x & 0x4444_4444_4444_4444); let x3 = Wrapping(x & 0x8888_8888_8888_8888); let y0 = Wrapping(y & 0x1111_1111_1111_1111); let y1 = Wrapping(y & 0x2222_2222_2222_2222); let y2 = Wrapping(y & 0x4444_4444_4444_4444); let y3 = Wrapping(y & 0x8888_8888_8888_8888); let mut z0 = ((x0 * y0) ^ (x1 * y3) ^ (x2 * y2) ^ (x3 * y1)).0; let mut z1 = ((x0 * y1) ^ (x1 * y0) ^ (x2 * y3) ^ (x3 * y2)).0; let mut z2 = ((x0 * y2) ^ (x1 * y1) ^ (x2 * y0) ^ (x3 * y3)).0; let mut z3 = ((x0 * y3) ^ (x1 * y2) ^ (x2 * y1) ^ (x3 * y0)).0; z0 &= 0x1111_1111_1111_1111; z1 &= 0x2222_2222_2222_2222; z2 &= 0x4444_4444_4444_4444; z3 &= 0x8888_8888_8888_8888; z0 | z1 | z2 | z3 } #[inline(always)] fn rev64(mut x: u64) -> u64 { x = ((x & 0x5555_5555_5555_5555) << 1) | ((x >> 1) & 0x5555_5555_5555_5555); x = ((x & 0x3333_3333_3333_3333) << 2) | ((x >> 2) & 0x3333_3333_3333_3333); x = ((x & 0x0f0f_0f0f_0f0f_0f0f) << 4) | ((x >> 4) & 0x0f0f_0f0f_0f0f_0f0f); x = ((x & 0x00ff_00ff_00ff_00ff) << 8) | ((x >> 8) & 0x00ff_00ff_00ff_00ff); x = ((x & 0xffff_0000_ffff) << 16) | ((x >> 16) & 0xffff_0000_ffff); x.rotate_right(32) } U64x2::from([ bmul64(x, y), rev64(bmul64(rev64(x), rev64(y))) >> 1, ]) } avx2 { Self( avx2::_mm_clmulepi64_si128 ::<HI_OTHER, HI_SELF>(self.0, other.0)) } }
5507 }
5508} select_impl! { scalar { } avx2 { mod avx2 { #![allow(non_upper_case_globals, non_snake_case)] #[inline(always)] pub(super) fn _mm256_adds_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_adds_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_adds_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_adds_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_adds_epu16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_adds_epu16(a, b) } } #[inline(always)] pub(super) fn _mm256_adds_epu8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_adds_epu8(a, b) } } #[inline(always)] pub(super) fn _mm256_andnot_si256( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_andnot_si256(a, b) } } #[inline(always)] pub(super) fn _mm256_blend_epi32<const B7: bool, const B6: bool, const B5: bool, const B4: bool, const B3: bool, const B2: bool, const B1: bool, const B0: bool>( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_blend_epi32 => (a, b, @@ [0..256] (((B0 as u8) << 0) | ((B1 as u8) << 1) | ((B2 as u8) << 2) | ((B3 as u8) << 3) | ((B4 as u8) << 4) | ((B5 as u8) << 5) | ((B6 as u8) << 6) | ((B7 as u8) << 7)) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm256_broadcastb_epi8( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_broadcastb_epi8(a) } } #[inline(always)] pub(super) fn _mm256_broadcastd_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_broadcastd_epi32(a) } } #[inline(always)] pub(super) fn _mm256_broadcastq_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_broadcastq_epi64(a) } } #[inline(always)] pub(super) fn _mm256_broadcastw_epi16( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_broadcastw_epi16(a) } } #[inline(always)] pub(super) fn _mm256_cmpeq_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpeq_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_cmpeq_epi32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpeq_epi32(a, b) } } #[inline(always)] pub(super) fn _mm256_cmpeq_epi64( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpeq_epi64(a, b) } } #[inline(always)] pub(super) fn _mm256_cmpeq_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpeq_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_cmpgt_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpgt_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_cmpgt_epi32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpgt_epi32(a, b) } } #[inline(always)] pub(super) fn _mm256_cmpgt_epi64( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpgt_epi64(a, b) } } #[inline(always)] pub(super) fn _mm256_cmpgt_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cmpgt_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_cvtepi16_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepi16_epi32(a) } } #[inline(always)] pub(super) fn _mm256_cvtepi16_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepi16_epi64(a) } } #[inline(always)] pub(super) fn _mm256_cvtepi32_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepi32_epi64(a) } } #[inline(always)] pub(super) fn _mm256_cvtepi8_epi16( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepi8_epi16(a) } } #[inline(always)] pub(super) fn _mm256_cvtepi8_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepi8_epi32(a) } } #[inline(always)] pub(super) fn _mm256_cvtepi8_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepi8_epi64(a) } } #[inline(always)] pub(super) fn _mm256_cvtepu16_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepu16_epi32(a) } } #[inline(always)] pub(super) fn _mm256_cvtepu16_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepu16_epi64(a) } } #[inline(always)] pub(super) fn _mm256_cvtepu32_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepu32_epi64(a) } } #[inline(always)] pub(super) fn _mm256_cvtepu8_epi16( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepu8_epi16(a) } } #[inline(always)] pub(super) fn _mm256_cvtepu8_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepu8_epi32(a) } } #[inline(always)] pub(super) fn _mm256_cvtepu8_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_cvtepu8_epi64(a) } } #[inline(always)] pub(super) fn _mm256_extract_epi16<const index: usize>( a: ::std::arch::x86_64::__m256i, ) -> i32 { unsafe { constify_imm!(::std::arch::x86_64::_mm256_extract_epi16 => (a, @@ [0..16] index as i32)) } } #[inline(always)] pub(super) fn _mm256_extract_epi32<const index: usize>( a: ::std::arch::x86_64::__m256i, ) -> i32 { unsafe { constify_imm!(::std::arch::x86_64::_mm256_extract_epi32 => (a, @@ [0..8] index as i32)) } } #[inline(always)] pub(super) fn _mm256_extract_epi64<const index: usize>( a: ::std::arch::x86_64::__m256i, ) -> i64 { unsafe { constify_imm!(::std::arch::x86_64::_mm256_extract_epi64 => (a, @@ [0..4] index as i32)) } } #[inline(always)] pub(super) fn _mm256_extract_epi8<const index: usize>( a: ::std::arch::x86_64::__m256i, ) -> i32 { unsafe { constify_imm!(::std::arch::x86_64::_mm256_extract_epi8 => (a, @@ [0..32] index as i32)) } } #[inline(always)] pub(super) fn _mm256_extracti128_si256<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_extracti128_si256 => (a, @@ [0..2] imm8 as i32)) } } #[inline(always)] pub(super) unsafe fn _mm256_i32gather_epi32<const scale: usize>( base_addr: *const i32, vindex: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { constify_imm!(::std::arch::x86_64::_mm256_i32gather_epi32 => (base_addr, vindex, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm256_i32gather_epi64<const scale: usize>( base_addr: *const i64, vindex: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { constify_imm!(::std::arch::x86_64::_mm256_i32gather_epi64 => (base_addr, vindex, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm256_i64gather_epi32<const scale: usize>( base_addr: *const i32, vindex: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m128i { constify_imm!(::std::arch::x86_64::_mm256_i64gather_epi32 => (base_addr, vindex, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm256_i64gather_epi64<const scale: usize>( base_addr: *const i64, vindex: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { constify_imm!(::std::arch::x86_64::_mm256_i64gather_epi64 => (base_addr, vindex, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm256_mask_i32gather_epi32<const scale: usize>( src: ::std::arch::x86_64::__m256i, base_addr: *const i32, vindex: ::std::arch::x86_64::__m256i, mask: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { constify_imm!(::std::arch::x86_64::_mm256_mask_i32gather_epi32 => (src, base_addr, vindex, mask, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm256_mask_i32gather_epi64<const scale: usize>( src: ::std::arch::x86_64::__m256i, base_addr: *const i64, vindex: ::std::arch::x86_64::__m128i, mask: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { constify_imm!(::std::arch::x86_64::_mm256_mask_i32gather_epi64 => (src, base_addr, vindex, mask, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm256_mask_i64gather_epi32<const scale: usize>( src: ::std::arch::x86_64::__m128i, base_addr: *const i32, vindex: ::std::arch::x86_64::__m256i, mask: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { constify_imm!(::std::arch::x86_64::_mm256_mask_i64gather_epi32 => (src, base_addr, vindex, mask, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm256_mask_i64gather_epi64<const scale: usize>( src: ::std::arch::x86_64::__m256i, base_addr: *const i64, vindex: ::std::arch::x86_64::__m256i, mask: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { constify_imm!(::std::arch::x86_64::_mm256_mask_i64gather_epi64 => (src, base_addr, vindex, mask, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) fn _mm256_max_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_max_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_max_epi32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_max_epi32(a, b) } } #[inline(always)] pub(super) fn _mm256_max_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_max_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_max_epu16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_max_epu16(a, b) } } #[inline(always)] pub(super) fn _mm256_max_epu32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_max_epu32(a, b) } } #[inline(always)] pub(super) fn _mm256_max_epu8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_max_epu8(a, b) } } #[inline(always)] pub(super) fn _mm256_min_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_min_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_min_epi32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_min_epi32(a, b) } } #[inline(always)] pub(super) fn _mm256_min_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_min_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_min_epu16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_min_epu16(a, b) } } #[inline(always)] pub(super) fn _mm256_min_epu32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_min_epu32(a, b) } } #[inline(always)] pub(super) fn _mm256_min_epu8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_min_epu8(a, b) } } #[inline(always)] pub(super) fn _mm256_movemask_epi8( a: ::std::arch::x86_64::__m256i, ) -> i32 { unsafe { ::std::arch::x86_64::_mm256_movemask_epi8(a) } } #[inline(always)] pub(super) fn _mm256_mul_epi32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_mul_epi32(a, b) } } #[inline(always)] pub(super) fn _mm256_mul_epu32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_mul_epu32(a, b) } } #[inline(always)] pub(super) fn _mm256_permute4x64_epi64<const I3: usize, const I2: usize, const I1: usize, const I0: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_permute4x64_epi64 => (a, @@ [0..256] ((I3 << 6) | (I2 << 4) | (I1 << 2) | I0) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm256_set1_epi16( a: i16, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set1_epi16(a) } } #[inline(always)] pub(super) fn _mm256_set1_epi32( a: i32, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set1_epi32(a) } } #[inline(always)] pub(super) fn _mm256_set1_epi64x( a: i64, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set1_epi64x(a) } } #[inline(always)] pub(super) fn _mm256_set1_epi8( a: i8, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set1_epi8(a) } } #[inline(always)] pub(super) fn _mm256_set_epi16( e15: i16, e14: i16, e13: i16, e12: i16, e11: i16, e10: i16, e9: i16, e8: i16, e7: i16, e6: i16, e5: i16, e4: i16, e3: i16, e2: i16, e1: i16, e0: i16, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set_epi16(e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4, e3, e2, e1, e0) } } #[inline(always)] pub(super) fn _mm256_set_epi32( e7: i32, e6: i32, e5: i32, e4: i32, e3: i32, e2: i32, e1: i32, e0: i32, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set_epi32(e7, e6, e5, e4, e3, e2, e1, e0) } } #[inline(always)] pub(super) fn _mm256_set_epi64x( e3: i64, e2: i64, e1: i64, e0: i64, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set_epi64x(e3, e2, e1, e0) } } #[inline(always)] pub(super) fn _mm256_set_epi8( e31: i8, e30: i8, e29: i8, e28: i8, e27: i8, e26: i8, e25: i8, e24: i8, e23: i8, e22: i8, e21: i8, e20: i8, e19: i8, e18: i8, e17: i8, e16: i8, e15: i8, e14: i8, e13: i8, e12: i8, e11: i8, e10: i8, e9: i8, e8: i8, e7: i8, e6: i8, e5: i8, e4: i8, e3: i8, e2: i8, e1: i8, e0: i8, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set_epi8(e31, e30, e29, e28, e27, e26, e25, e24, e23, e22, e21, e20, e19, e18, e17, e16, e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4, e3, e2, e1, e0) } } #[inline(always)] pub(super) fn _mm256_set_m128i( hi: ::std::arch::x86_64::__m128i, lo: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_set_m128i(hi, lo) } } #[inline(always)] pub(super) fn _mm256_shuffle_epi32<const I3: usize, const I2: usize, const I1: usize, const I0: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_shuffle_epi32 => (a, @@ [0..256] ((I3 << 6) | (I2 << 4) | (I1 << 2) | I0) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm256_shuffle_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_shuffle_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_shufflehi_epi16<const I3: usize, const I2: usize, const I1: usize, const I0: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_shufflehi_epi16 => (a, @@ [0..256] ((I3 << 6) | (I2 << 4) | (I1 << 2) | I0) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm256_shufflelo_epi16<const I3: usize, const I2: usize, const I1: usize, const I0: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_shufflelo_epi16 => (a, @@ [0..256] ((I3 << 6) | (I2 << 4) | (I1 << 2) | I0) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm256_sll_epi16( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_sll_epi16(a, count) } } #[inline(always)] pub(super) fn _mm256_sll_epi32( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_sll_epi32(a, count) } } #[inline(always)] pub(super) fn _mm256_sll_epi64( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_sll_epi64(a, count) } } #[inline(always)] pub(super) fn _mm256_slli_epi16<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_slli_epi16 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_slli_epi32<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_slli_epi32 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_slli_epi64<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_slli_epi64 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_slli_si256<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_slli_si256 => (a, @@ [0..32] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_sllv_epi32( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_sllv_epi32(a, count) } } #[inline(always)] pub(super) fn _mm256_sllv_epi64( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_sllv_epi64(a, count) } } #[inline(always)] pub(super) fn _mm256_sra_epi16( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_sra_epi16(a, count) } } #[inline(always)] pub(super) fn _mm256_sra_epi32( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_sra_epi32(a, count) } } #[inline(always)] pub(super) fn _mm256_srai_epi16<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_srai_epi16 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_srai_epi32<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_srai_epi32 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_srav_epi32( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_srav_epi32(a, count) } } #[inline(always)] pub(super) fn _mm256_srl_epi16( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_srl_epi16(a, count) } } #[inline(always)] pub(super) fn _mm256_srl_epi32( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_srl_epi32(a, count) } } #[inline(always)] pub(super) fn _mm256_srl_epi64( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_srl_epi64(a, count) } } #[inline(always)] pub(super) fn _mm256_srli_epi16<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_srli_epi16 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_srli_epi32<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_srli_epi32 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_srli_epi64<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_srli_epi64 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_srli_si256<const imm8: usize>( a: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { constify_imm!(::std::arch::x86_64::_mm256_srli_si256 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm256_srlv_epi32( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_srlv_epi32(a, count) } } #[inline(always)] pub(super) fn _mm256_srlv_epi64( a: ::std::arch::x86_64::__m256i, count: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_srlv_epi64(a, count) } } #[inline(always)] pub(super) fn _mm256_subs_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_subs_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_subs_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_subs_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_subs_epu16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_subs_epu16(a, b) } } #[inline(always)] pub(super) fn _mm256_subs_epu8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_subs_epu8(a, b) } } #[inline(always)] pub(super) fn _mm256_testz_si256( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> i32 { unsafe { ::std::arch::x86_64::_mm256_testz_si256(a, b) } } #[inline(always)] pub(super) fn _mm256_unpackhi_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpackhi_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_unpackhi_epi32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpackhi_epi32(a, b) } } #[inline(always)] pub(super) fn _mm256_unpackhi_epi64( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpackhi_epi64(a, b) } } #[inline(always)] pub(super) fn _mm256_unpackhi_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpackhi_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_unpacklo_epi16( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpacklo_epi16(a, b) } } #[inline(always)] pub(super) fn _mm256_unpacklo_epi32( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpacklo_epi32(a, b) } } #[inline(always)] pub(super) fn _mm256_unpacklo_epi64( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpacklo_epi64(a, b) } } #[inline(always)] pub(super) fn _mm256_unpacklo_epi8( a: ::std::arch::x86_64::__m256i, b: ::std::arch::x86_64::__m256i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_unpacklo_epi8(a, b) } } #[inline(always)] pub(super) fn _mm256_zextsi128_si256( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m256i { unsafe { ::std::arch::x86_64::_mm256_zextsi128_si256(a) } } #[inline(always)] pub(super) fn _mm_adds_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_adds_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_adds_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_adds_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_adds_epu16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_adds_epu16(a, b) } } #[inline(always)] pub(super) fn _mm_adds_epu8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_adds_epu8(a, b) } } #[inline(always)] pub(super) fn _mm_andnot_si128( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_andnot_si128(a, b) } } #[inline(always)] pub(super) fn _mm_blend_epi16<const B7: bool, const B6: bool, const B5: bool, const B4: bool, const B3: bool, const B2: bool, const B1: bool, const B0: bool>( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_blend_epi16 => (a, b, @@ [0..256] (((B0 as u8) << 0) | ((B1 as u8) << 1) | ((B2 as u8) << 2) | ((B3 as u8) << 3) | ((B4 as u8) << 4) | ((B5 as u8) << 5) | ((B6 as u8) << 6) | ((B7 as u8) << 7)) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm_blend_epi32<const B3: bool, const B2: bool, const B1: bool, const B0: bool>( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_blend_epi32 => (a, b, @@ [0..16] (((B0 as u8) << 0) | ((B1 as u8) << 1) | ((B2 as u8) << 2) | ((B3 as u8) << 3)) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm_broadcastb_epi8( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_broadcastb_epi8(a) } } #[inline(always)] pub(super) fn _mm_broadcastd_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_broadcastd_epi32(a) } } #[inline(always)] pub(super) fn _mm_broadcastq_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_broadcastq_epi64(a) } } #[inline(always)] pub(super) fn _mm_broadcastw_epi16( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_broadcastw_epi16(a) } } #[inline(always)] pub(super) fn _mm_clmulepi64_si128<const HI1: bool, const HI0: bool>( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_clmulepi64_si128 => (a, b, @@ [0..256] (((!((HI1 as u64).wrapping_sub(1))) & 0xf0) | ((!((HI0 as u64).wrapping_sub(1))) & 0x0f)) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm_cmpeq_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpeq_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_cmpeq_epi32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpeq_epi32(a, b) } } #[inline(always)] pub(super) fn _mm_cmpeq_epi64( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpeq_epi64(a, b) } } #[inline(always)] pub(super) fn _mm_cmpeq_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpeq_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_cmpgt_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpgt_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_cmpgt_epi32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpgt_epi32(a, b) } } #[inline(always)] pub(super) fn _mm_cmpgt_epi64( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpgt_epi64(a, b) } } #[inline(always)] pub(super) fn _mm_cmpgt_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cmpgt_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_cvtepi16_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepi16_epi32(a) } } #[inline(always)] pub(super) fn _mm_cvtepi16_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepi16_epi64(a) } } #[inline(always)] pub(super) fn _mm_cvtepi32_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepi32_epi64(a) } } #[inline(always)] pub(super) fn _mm_cvtepi8_epi16( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepi8_epi16(a) } } #[inline(always)] pub(super) fn _mm_cvtepi8_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepi8_epi32(a) } } #[inline(always)] pub(super) fn _mm_cvtepi8_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepi8_epi64(a) } } #[inline(always)] pub(super) fn _mm_cvtepu16_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepu16_epi32(a) } } #[inline(always)] pub(super) fn _mm_cvtepu16_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepu16_epi64(a) } } #[inline(always)] pub(super) fn _mm_cvtepu32_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepu32_epi64(a) } } #[inline(always)] pub(super) fn _mm_cvtepu8_epi16( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepu8_epi16(a) } } #[inline(always)] pub(super) fn _mm_cvtepu8_epi32( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepu8_epi32(a) } } #[inline(always)] pub(super) fn _mm_cvtepu8_epi64( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_cvtepu8_epi64(a) } } #[inline(always)] pub(super) fn _mm_extract_epi16<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> i32 { unsafe { constify_imm!(::std::arch::x86_64::_mm_extract_epi16 => (a, @@ [0..8] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_extract_epi32<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> i32 { unsafe { constify_imm!(::std::arch::x86_64::_mm_extract_epi32 => (a, @@ [0..4] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_extract_epi64<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> i64 { unsafe { constify_imm!(::std::arch::x86_64::_mm_extract_epi64 => (a, @@ [0..2] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_extract_epi8<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> i32 { unsafe { constify_imm!(::std::arch::x86_64::_mm_extract_epi8 => (a, @@ [0..16] imm8 as i32)) } } #[inline(always)] pub(super) unsafe fn _mm_i32gather_epi32<const scale: usize>( base_addr: *const i32, vindex: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { constify_imm!(::std::arch::x86_64::_mm_i32gather_epi32 => (base_addr, vindex, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm_i64gather_epi64<const scale: usize>( base_addr: *const i64, vindex: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { constify_imm!(::std::arch::x86_64::_mm_i64gather_epi64 => (base_addr, vindex, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm_mask_i32gather_epi32<const scale: usize>( src: ::std::arch::x86_64::__m128i, base_addr: *const i32, vindex: ::std::arch::x86_64::__m128i, mask: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { constify_imm!(::std::arch::x86_64::_mm_mask_i32gather_epi32 => (src, base_addr, vindex, mask, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) unsafe fn _mm_mask_i64gather_epi64<const scale: usize>( src: ::std::arch::x86_64::__m128i, base_addr: *const i64, vindex: ::std::arch::x86_64::__m128i, mask: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { constify_imm!(::std::arch::x86_64::_mm_mask_i64gather_epi64 => (src, base_addr, vindex, mask, @@ [[1, 2, 4, 8]] scale as i32)) } #[inline(always)] pub(super) fn _mm_max_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_max_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_max_epi32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_max_epi32(a, b) } } #[inline(always)] pub(super) fn _mm_max_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_max_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_max_epu16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_max_epu16(a, b) } } #[inline(always)] pub(super) fn _mm_max_epu32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_max_epu32(a, b) } } #[inline(always)] pub(super) fn _mm_max_epu8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_max_epu8(a, b) } } #[inline(always)] pub(super) fn _mm_min_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_min_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_min_epi32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_min_epi32(a, b) } } #[inline(always)] pub(super) fn _mm_min_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_min_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_min_epu16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_min_epu16(a, b) } } #[inline(always)] pub(super) fn _mm_min_epu32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_min_epu32(a, b) } } #[inline(always)] pub(super) fn _mm_min_epu8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_min_epu8(a, b) } } #[inline(always)] pub(super) fn _mm_movemask_epi8( a: ::std::arch::x86_64::__m128i, ) -> i32 { unsafe { ::std::arch::x86_64::_mm_movemask_epi8(a) } } #[inline(always)] pub(super) fn _mm_mul_epi32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_mul_epi32(a, b) } } #[inline(always)] pub(super) fn _mm_mul_epu32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_mul_epu32(a, b) } } #[inline(always)] pub(super) fn _mm_set1_epi16( a: i16, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set1_epi16(a) } } #[inline(always)] pub(super) fn _mm_set1_epi32( a: i32, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set1_epi32(a) } } #[inline(always)] pub(super) fn _mm_set1_epi64x( a: i64, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set1_epi64x(a) } } #[inline(always)] pub(super) fn _mm_set1_epi8( a: i8, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set1_epi8(a) } } #[inline(always)] pub(super) fn _mm_set_epi16( e7: i16, e6: i16, e5: i16, e4: i16, e3: i16, e2: i16, e1: i16, e0: i16, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set_epi16(e7, e6, e5, e4, e3, e2, e1, e0) } } #[inline(always)] pub(super) fn _mm_set_epi32( e3: i32, e2: i32, e1: i32, e0: i32, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set_epi32(e3, e2, e1, e0) } } #[inline(always)] pub(super) fn _mm_set_epi64x( e1: i64, e0: i64, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set_epi64x(e1, e0) } } #[inline(always)] pub(super) fn _mm_set_epi8( e15: i8, e14: i8, e13: i8, e12: i8, e11: i8, e10: i8, e9: i8, e8: i8, e7: i8, e6: i8, e5: i8, e4: i8, e3: i8, e2: i8, e1: i8, e0: i8, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_set_epi8(e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4, e3, e2, e1, e0) } } #[inline(always)] pub(super) fn _mm_shuffle_epi32<const I3: usize, const I2: usize, const I1: usize, const I0: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_shuffle_epi32 => (a, @@ [0..256] ((I3 << 6) | (I2 << 4) | (I1 << 2) | I0) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm_shuffle_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_shuffle_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_shufflehi_epi16<const I3: usize, const I2: usize, const I1: usize, const I0: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_shufflehi_epi16 => (a, @@ [0..256] ((I3 << 6) | (I2 << 4) | (I1 << 2) | I0) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm_shufflelo_epi16<const I3: usize, const I2: usize, const I1: usize, const I0: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_shufflelo_epi16 => (a, @@ [0..256] ((I3 << 6) | (I2 << 4) | (I1 << 2) | I0) as i32 as i32)) } } #[inline(always)] pub(super) fn _mm_sll_epi16( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_sll_epi16(a, count) } } #[inline(always)] pub(super) fn _mm_sll_epi32( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_sll_epi32(a, count) } } #[inline(always)] pub(super) fn _mm_sll_epi64( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_sll_epi64(a, count) } } #[inline(always)] pub(super) fn _mm_slli_epi16<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_slli_epi16 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_slli_epi32<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_slli_epi32 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_slli_epi64<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_slli_epi64 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_slli_si128<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_slli_si128 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_sllv_epi32( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_sllv_epi32(a, count) } } #[inline(always)] pub(super) fn _mm_sllv_epi64( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_sllv_epi64(a, count) } } #[inline(always)] pub(super) fn _mm_sra_epi16( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_sra_epi16(a, count) } } #[inline(always)] pub(super) fn _mm_sra_epi32( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_sra_epi32(a, count) } } #[inline(always)] pub(super) fn _mm_srai_epi16<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_srai_epi16 => (a, @@ [0..32] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_srai_epi32<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_srai_epi32 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_srav_epi32( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_srav_epi32(a, count) } } #[inline(always)] pub(super) fn _mm_srl_epi16( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_srl_epi16(a, count) } } #[inline(always)] pub(super) fn _mm_srl_epi32( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_srl_epi32(a, count) } } #[inline(always)] pub(super) fn _mm_srl_epi64( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_srl_epi64(a, count) } } #[inline(always)] pub(super) fn _mm_srli_epi16<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_srli_epi16 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_srli_epi32<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_srli_epi32 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_srli_epi64<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_srli_epi64 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_srli_si128<const imm8: usize>( a: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { constify_imm!(::std::arch::x86_64::_mm_srli_si128 => (a, @@ [0..256] imm8 as i32)) } } #[inline(always)] pub(super) fn _mm_srlv_epi32( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_srlv_epi32(a, count) } } #[inline(always)] pub(super) fn _mm_srlv_epi64( a: ::std::arch::x86_64::__m128i, count: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_srlv_epi64(a, count) } } #[inline(always)] pub(super) fn _mm_subs_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_subs_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_subs_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_subs_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_subs_epu16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_subs_epu16(a, b) } } #[inline(always)] pub(super) fn _mm_subs_epu8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_subs_epu8(a, b) } } #[inline(always)] pub(super) fn _mm_testz_si128( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> i32 { unsafe { ::std::arch::x86_64::_mm_testz_si128(a, b) } } #[inline(always)] pub(super) fn _mm_unpackhi_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpackhi_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_unpackhi_epi32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpackhi_epi32(a, b) } } #[inline(always)] pub(super) fn _mm_unpackhi_epi64( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpackhi_epi64(a, b) } } #[inline(always)] pub(super) fn _mm_unpackhi_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpackhi_epi8(a, b) } } #[inline(always)] pub(super) fn _mm_unpacklo_epi16( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpacklo_epi16(a, b) } } #[inline(always)] pub(super) fn _mm_unpacklo_epi32( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpacklo_epi32(a, b) } } #[inline(always)] pub(super) fn _mm_unpacklo_epi64( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpacklo_epi64(a, b) } } #[inline(always)] pub(super) fn _mm_unpacklo_epi8( a: ::std::arch::x86_64::__m128i, b: ::std::arch::x86_64::__m128i, ) -> ::std::arch::x86_64::__m128i { unsafe { ::std::arch::x86_64::_mm_unpacklo_epi8(a, b) } } } } }
5711impl crate::HasVector<16> for i8 {
5712 type Vector = I8x16;
5713}
5714impl crate::HasVector<32> for i8 {
5715 type Vector = I8x32;
5716}
5717impl crate::HasVector<8> for i16 {
5718 type Vector = I16x8;
5719}
5720impl crate::HasVector<16> for i16 {
5721 type Vector = I16x16;
5722}
5723impl crate::HasVector<4> for i32 {
5724 type Vector = I32x4;
5725}
5726impl crate::HasVector<8> for i32 {
5727 type Vector = I32x8;
5728}
5729impl crate::HasVector<2> for i64 {
5730 type Vector = I64x2;
5731}
5732impl crate::HasVector<4> for i64 {
5733 type Vector = I64x4;
5734}
5735impl crate::HasVector<16> for u8 {
5736 type Vector = U8x16;
5737}
5738impl crate::HasVector<32> for u8 {
5739 type Vector = U8x32;
5740}
5741impl crate::HasVector<8> for u16 {
5742 type Vector = U16x8;
5743}
5744impl crate::HasVector<16> for u16 {
5745 type Vector = U16x16;
5746}
5747impl crate::HasVector<4> for u32 {
5748 type Vector = U32x4;
5749}
5750impl crate::HasVector<8> for u32 {
5751 type Vector = U32x8;
5752}
5753impl crate::HasVector<2> for u64 {
5754 type Vector = U64x2;
5755}
5756impl crate::HasVector<4> for u64 {
5757 type Vector = U64x4;
5758}