/rust/registry/src/index.crates.io-1949cf8c6b5b557f/pulp-0.22.3/src/lib.rs
Line | Count | Source |
1 | | //! `pulp` is a safe abstraction over SIMD instructions, that allows you to write a function once |
2 | | //! and dispatch to equivalent vectorized versions based on the features detected at runtime. |
3 | | //! |
4 | | //! # Autovectorization example |
5 | | //! |
6 | | //! ``` |
7 | | //! use pulp::Arch; |
8 | | //! |
9 | | //! let mut v = (0..1000).map(|i| i as f64).collect::<Vec<_>>(); |
10 | | //! let arch = Arch::new(); |
11 | | //! |
12 | | //! arch.dispatch(|| { |
13 | | //! for x in &mut v { |
14 | | //! *x *= 2.0; |
15 | | //! } |
16 | | //! }); |
17 | | //! |
18 | | //! for (i, x) in v.into_iter().enumerate() { |
19 | | //! assert_eq!(x, 2.0 * i as f64); |
20 | | //! } |
21 | | //! ``` |
22 | | //! |
23 | | //! # Manual vectorization example |
24 | | //! |
25 | | //! ``` |
26 | | //! use pulp::{Arch, Simd, WithSimd}; |
27 | | //! |
28 | | //! struct TimesThree<'a>(&'a mut [f64]); |
29 | | //! impl<'a> WithSimd for TimesThree<'a> { |
30 | | //! type Output = (); |
31 | | //! |
32 | | //! #[inline(always)] |
33 | | //! fn with_simd<S: Simd>(self, simd: S) -> Self::Output { |
34 | | //! let v = self.0; |
35 | | //! let (head, tail) = S::as_mut_simd_f64s(v); |
36 | | //! |
37 | | //! let three = simd.splat_f64s(3.0); |
38 | | //! for x in head { |
39 | | //! *x = simd.mul_f64s(three, *x); |
40 | | //! } |
41 | | //! |
42 | | //! for x in tail { |
43 | | //! *x = *x * 3.0; |
44 | | //! } |
45 | | //! } |
46 | | //! } |
47 | | //! |
48 | | //! let mut v = (0..1000).map(|i| i as f64).collect::<Vec<_>>(); |
49 | | //! let arch = Arch::new(); |
50 | | //! |
51 | | //! arch.dispatch(TimesThree(&mut v)); |
52 | | //! |
53 | | //! for (i, x) in v.into_iter().enumerate() { |
54 | | //! assert_eq!(x, 3.0 * i as f64); |
55 | | //! } |
56 | | //! ``` |
57 | | |
58 | | // FIXME: replace x86 non-ieee min/max functions to propagate nans instead |
59 | | |
60 | | #![allow( |
61 | | non_camel_case_types, |
62 | | unknown_lints, |
63 | | clippy::zero_prefixed_literal, |
64 | | clippy::identity_op, |
65 | | clippy::too_many_arguments, |
66 | | clippy::type_complexity, |
67 | | clippy::missing_transmute_annotations, |
68 | | clippy::tabs_in_doc_comments, |
69 | | clippy::modulo_one, |
70 | | clippy::useless_transmute, |
71 | | clippy::not_unsafe_ptr_arg_deref, |
72 | | clippy::manual_is_multiple_of |
73 | | )] |
74 | | #![cfg_attr( |
75 | | all(feature = "nightly", any(target_arch = "aarch64")), |
76 | | feature(stdarch_neon_i8mm), |
77 | | feature(stdarch_neon_sm4), |
78 | | feature(stdarch_neon_ftts), |
79 | | feature(stdarch_neon_fcma), |
80 | | feature(stdarch_neon_dotprod) |
81 | | )] |
82 | | #![cfg_attr(not(feature = "std"), no_std)] |
83 | | #![cfg_attr(docsrs, feature(doc_cfg))] |
84 | | |
85 | | macro_rules! match_cfg { |
86 | | (item, match cfg!() { |
87 | | $( |
88 | | const { $i_meta:meta } => { $( $i_tokens:tt )* }, |
89 | | )* |
90 | | $(_ => { $( $e_tokens:tt )* },)? |
91 | | }) => { |
92 | | $crate::match_cfg! { |
93 | | @__items () ; |
94 | | $( |
95 | | (( $i_meta ) ( $( $i_tokens )* )) , |
96 | | )* |
97 | | $((() ( $( $e_tokens )* )),)? |
98 | | } |
99 | | }; |
100 | | |
101 | | (match cfg!() { |
102 | | $( |
103 | | const { $i_meta:meta } => $i_expr: expr, |
104 | | )* |
105 | | $(_ => $e_expr: expr,)? |
106 | | }) => { |
107 | | $crate::match_cfg! { |
108 | | @ __result @ __exprs (); |
109 | | $( |
110 | | (( $i_meta ) ( $i_expr )) , |
111 | | )* |
112 | | $((() ( $e_expr )),)? |
113 | | } |
114 | | }; |
115 | | |
116 | | // Internal and recursive macro to emit all the items |
117 | | // |
118 | | // Collects all the previous cfgs in a list at the beginning, so they can be |
119 | | // negated. After the semicolon are all the remaining items. |
120 | | (@__items ( $( $_:meta , )* ) ; ) => {}; |
121 | | ( |
122 | | @__items ( $( $no:meta , )* ) ; |
123 | | (( $( $yes:meta )? ) ( $( $tokens:tt )* )) , |
124 | | $( $rest:tt , )* |
125 | | ) => { |
126 | | // Emit all items within one block, applying an appropriate [cfg]. The |
127 | | // [cfg] will require all `$yes` matchers specified and must also negate |
128 | | // all previous matchers. |
129 | | #[cfg(all( |
130 | | $( $yes , )? |
131 | | not(any( $( $no ),* )) |
132 | | ))] |
133 | | $crate::match_cfg! { @__identity $( $tokens )* } |
134 | | |
135 | | // Recurse to emit all other items in `$rest`, and when we do so add all |
136 | | // our `$yes` matchers to the list of `$no` matchers as future emissions |
137 | | // will have to negate everything we just matched as well. |
138 | | $crate::match_cfg! { |
139 | | @__items ( $( $no , )* $( $yes , )? ) ; |
140 | | $( $rest , )* |
141 | | } |
142 | | }; |
143 | | |
144 | | // Internal and recursive macro to emit all the exprs |
145 | | // |
146 | | // Collects all the previous cfgs in a list at the beginning, so they can be |
147 | | // negated. After the semicolon are all the remaining exprs. |
148 | | (@ $ret: ident @ __exprs ( $( $_:meta , )* ) ; ) => { |
149 | | $ret |
150 | | }; |
151 | | |
152 | | ( |
153 | | @ $ret: ident @__exprs ( $( $no:meta , )* ) ; |
154 | | (( $( $yes:meta )? ) ( $( $tokens:tt )* )) , |
155 | | $( $rest:tt , )* |
156 | | ) => {{ |
157 | | // Emit all exprs within one block, applying an appropriate [cfg]. The |
158 | | // [cfg] will require all `$yes` matchers specified and must also negate |
159 | | // all previous matchers. |
160 | | #[cfg(all( |
161 | | $( $yes , )? |
162 | | not(any( $( $no ),* )) |
163 | | ))] |
164 | | let $ret = $crate::match_cfg! { @__identity $( $tokens )* }; |
165 | | |
166 | | // // Recurse to emit all other exprs in `$rest`, and when we do so add all |
167 | | // // our `$yes` matchers to the list of `$no` matchers as future emissions |
168 | | // // will have to negate everything we just matched as well. |
169 | | $crate::match_cfg! { |
170 | | @ $ret @ __exprs ( $( $no , )* $( $yes , )? ) ; |
171 | | $( $rest , )* |
172 | | } |
173 | | }}; |
174 | | |
175 | | // Internal macro to make __apply work out right for different match types, |
176 | | // because of how macros match/expand stuff. |
177 | | (@__identity $( $tokens:tt )* ) => { |
178 | | $( $tokens )* |
179 | | }; |
180 | | } |
181 | | |
182 | | const MAX_REGISTER_BYTES: usize = 256; |
183 | | |
184 | | use match_cfg; |
185 | | |
186 | | /// Safe transmute macro. |
187 | | /// |
188 | | /// This function asserts at compile time that the two types have the same size. |
189 | | #[macro_export] |
190 | | macro_rules! cast { |
191 | | ($val: expr $(,)?) => {{ |
192 | | let __val = $val; |
193 | | if const { false } { |
194 | | // checks type constraints |
195 | | $crate::cast(__val) |
196 | | } else { |
197 | | #[allow( |
198 | | unused_unsafe, |
199 | | unnecessary_transmutes, |
200 | | clippy::missing_transmute_annotations |
201 | | )] |
202 | | unsafe { |
203 | | ::core::mem::transmute(__val) |
204 | | } |
205 | | } |
206 | | }}; |
207 | | } |
208 | | |
209 | | use bytemuck::{AnyBitPattern, CheckedBitPattern, NoUninit, Pod, Zeroable, checked}; |
210 | | use core::fmt::Debug; |
211 | | use core::marker::PhantomData; |
212 | | use core::mem::MaybeUninit; |
213 | | use core::ops::*; |
214 | | use core::slice::{from_raw_parts, from_raw_parts_mut}; |
215 | | use num_complex::Complex; |
216 | | use paste::paste; |
217 | | use seal::Seal; |
218 | | |
219 | | /// Requires the first non-lifetime generic parameter, as well as the function's |
220 | | /// first input parameter to be the SIMD type. |
221 | | /// Also currently requires that all the lifetimes be explicitly specified. |
222 | | #[cfg(feature = "macro")] |
223 | | #[cfg_attr(docsrs, doc(cfg(feature = "macro")))] |
224 | | pub use pulp_macro::with_simd; |
225 | | |
226 | | pub use bytemuck; |
227 | | pub use num_complex; |
228 | | |
229 | | pub type c32 = Complex<f32>; |
230 | | pub type c64 = Complex<f64>; |
231 | | |
232 | | #[derive(Copy, Clone)] |
233 | | #[repr(transparent)] |
234 | | struct DebugCplx<T>(T); |
235 | | |
236 | | unsafe impl<T: Zeroable> Zeroable for DebugCplx<T> {} |
237 | | unsafe impl<T: Pod> Pod for DebugCplx<T> {} |
238 | | |
239 | | impl Debug for DebugCplx<c32> { |
240 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
241 | 0 | let c32 { re, im } = self.0; |
242 | 0 | re.fmt(f)?; |
243 | | |
244 | 0 | let sign = if im.is_sign_positive() { " + " } else { " - " }; |
245 | 0 | f.write_str(sign)?; |
246 | | |
247 | 0 | let im = f32::from_bits(im.to_bits() & (u32::MAX >> 1)); |
248 | 0 | im.abs().fmt(f)?; |
249 | | |
250 | 0 | f.write_str("i")?; |
251 | | |
252 | 0 | Ok(()) |
253 | 0 | } |
254 | | } |
255 | | |
256 | | impl Debug for DebugCplx<c64> { |
257 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
258 | 0 | let c64 { re, im } = self.0; |
259 | 0 | re.fmt(f)?; |
260 | | |
261 | 0 | let sign = if im.is_sign_positive() { " + " } else { " - " }; |
262 | 0 | f.write_str(sign)?; |
263 | | |
264 | 0 | let im = f64::from_bits(im.to_bits() & (u64::MAX >> 1)); |
265 | 0 | im.abs().fmt(f)?; |
266 | | |
267 | 0 | f.write_str("i")?; |
268 | | |
269 | 0 | Ok(()) |
270 | 0 | } |
271 | | } |
272 | | |
273 | | match_cfg!( |
274 | | item, |
275 | | match cfg!() { |
276 | | const { any(target_arch = "x86_64") } => { |
277 | | #[derive(Debug, Copy, Clone)] |
278 | | pub struct MemMask<T> { |
279 | | mask: T, |
280 | | load: Option<unsafe extern "C" fn()>, |
281 | | store: Option<unsafe extern "C" fn()>, |
282 | | } |
283 | | |
284 | | impl<T> MemMask<T> { |
285 | | #[inline] |
286 | 0 | pub fn new(mask: T) -> Self { |
287 | 0 | Self { |
288 | 0 | mask, |
289 | 0 | load: None, |
290 | 0 | store: None, |
291 | 0 | } |
292 | 0 | } |
293 | | } |
294 | | |
295 | | impl<T> From<T> for MemMask<T> { |
296 | | #[inline] |
297 | 0 | fn from(value: T) -> Self { |
298 | 0 | Self { |
299 | 0 | mask: value, |
300 | 0 | load: None, |
301 | 0 | store: None, |
302 | 0 | } |
303 | 0 | } |
304 | | } |
305 | | }, |
306 | | |
307 | | _ => { |
308 | | #[derive(Debug, Copy, Clone)] |
309 | | pub struct MemMask<T> { |
310 | | mask: T, |
311 | | } |
312 | | |
313 | | impl<T> MemMask<T> { |
314 | | #[inline] |
315 | | pub fn new(mask: T) -> Self { |
316 | | Self { mask } |
317 | | } |
318 | | } |
319 | | |
320 | | impl<T> From<T> for MemMask<T> { |
321 | | #[inline] |
322 | | fn from(value: T) -> Self { |
323 | | Self { mask: value } |
324 | | } |
325 | | } |
326 | | }, |
327 | | } |
328 | | ); |
329 | | |
330 | | impl<T: Copy> MemMask<T> { |
331 | | #[inline] |
332 | 0 | pub fn mask(self) -> T { |
333 | 0 | self.mask |
334 | 0 | } |
335 | | } |
336 | | |
337 | | mod seal { |
338 | | pub trait Seal {} |
339 | | } |
340 | | |
341 | | pub trait NullaryFnOnce { |
342 | | type Output; |
343 | | |
344 | | fn call(self) -> Self::Output; |
345 | | } |
346 | | |
347 | | impl<R, F: FnOnce() -> R> NullaryFnOnce for F { |
348 | | type Output = R; |
349 | | |
350 | | #[inline(always)] |
351 | 0 | fn call(self) -> Self::Output { |
352 | 0 | self() |
353 | 0 | } Unexecuted instantiation: <exr::compression::dwa::discrete_cosine_transform::x86::avx2::dct_forward_8x8_batch<&mut core::iter::adapters::flatten::FlatMap<core::slice::iter::IterMut<[[f32; 64]; 3]>, core::slice::iter::IterMut<[f32; 64]>, exr::compression::dwa::lossy_dct::encode_lossy_dct_group::{closure#1}>>::{closure#0} as pulp::NullaryFnOnce>::callUnexecuted instantiation: <exr::compression::dwa::discrete_cosine_transform::x86::avx2::dct_inverse_8x8_batch<&mut core::iter::adapters::filter_map::FilterMap<core::iter::adapters::flatten::FlatMap<core::iter::adapters::zip::Zip<core::slice::iter::IterMut<[[f32; 64]; 3]>, core::slice::iter::Iter<[bool; 3]>>, core::iter::adapters::zip::Zip<core::slice::iter::IterMut<[f32; 64]>, core::slice::iter::Iter<bool>>, exr::compression::dwa::lossy_dct::decode_lossy_dct_group::{closure#1}>, exr::compression::dwa::lossy_dct::decode_lossy_dct_group::{closure#2}>>::{closure#0} as pulp::NullaryFnOnce>::callUnexecuted instantiation: <_ as pulp::NullaryFnOnce>::call |
354 | | } |
355 | | |
356 | | pub trait WithSimd { |
357 | | type Output; |
358 | | |
359 | | fn with_simd<S: Simd>(self, simd: S) -> Self::Output; |
360 | | } |
361 | | |
362 | | impl<F: NullaryFnOnce> WithSimd for F { |
363 | | type Output = F::Output; |
364 | | |
365 | | #[inline(always)] |
366 | 0 | fn with_simd<S: Simd>(self, simd: S) -> Self::Output { |
367 | 0 | let _simd = &simd; |
368 | 0 | self.call() |
369 | 0 | } |
370 | | } |
371 | | |
372 | | #[inline(always)] |
373 | 0 | fn fma_f32(a: f32, b: f32, c: f32) -> f32 { |
374 | 0 | match_cfg!(match cfg!() { |
375 | 0 | const { feature = "std" } => f32::mul_add(a, b, c), |
376 | | _ => libm::fmaf(a, b, c), |
377 | | }) |
378 | 0 | } |
379 | | |
380 | | #[inline(always)] |
381 | 0 | fn fma_f64(a: f64, b: f64, c: f64) -> f64 { |
382 | 0 | match_cfg!(match cfg!() { |
383 | 0 | const { feature = "std" } => f64::mul_add(a, b, c), |
384 | | _ => libm::fma(a, b, c), |
385 | | }) |
386 | 0 | } |
387 | | |
388 | | #[inline(always)] |
389 | 0 | fn sqrt_f32(a: f32) -> f32 { |
390 | 0 | match_cfg!(match cfg!() { |
391 | 0 | const { feature = "std" } => f32::sqrt(a), |
392 | | _ => libm::sqrtf(a), |
393 | | }) |
394 | 0 | } |
395 | | |
396 | | #[inline(always)] |
397 | 0 | fn sqrt_f64(a: f64) -> f64 { |
398 | 0 | match_cfg!(match cfg!() { |
399 | 0 | const { feature = "std" } => f64::sqrt(a, ), |
400 | | _ => libm::sqrt(a), |
401 | | }) |
402 | 0 | } |
403 | | |
404 | | // a0,0 ... a0,m-1 |
405 | | // ... |
406 | | // an-1,0 ... an-1,m-1 |
407 | | #[inline(always)] |
408 | 0 | unsafe fn interleave_fallback<Unit: Pod, Reg: Pod, AosReg>(x: AosReg) -> AosReg { |
409 | 0 | assert!(core::mem::size_of::<AosReg>() % core::mem::size_of::<Reg>() == 0); |
410 | 0 | assert!(core::mem::size_of::<Reg>() % core::mem::size_of::<Unit>() == 0); |
411 | 0 | assert!(!core::mem::needs_drop::<AosReg>()); |
412 | | |
413 | | if const { core::mem::size_of::<AosReg>() == core::mem::size_of::<Reg>() } { |
414 | 0 | x |
415 | | } else { |
416 | 0 | let mut y = core::ptr::read(&x); |
417 | | |
418 | 0 | let n = const { core::mem::size_of::<AosReg>() / core::mem::size_of::<Reg>() }; |
419 | 0 | let m = const { core::mem::size_of::<Reg>() / core::mem::size_of::<Unit>() }; |
420 | | |
421 | | unsafe { |
422 | 0 | let y = (&mut y) as *mut _ as *mut Unit; |
423 | 0 | let x = (&x) as *const _ as *const Unit; |
424 | 0 | for j in 0..m { |
425 | 0 | for i in 0..n { |
426 | 0 | *y.add(i + n * j) = *x.add(j + i * m); |
427 | 0 | } |
428 | | } |
429 | | } |
430 | | |
431 | 0 | y |
432 | | } |
433 | 0 | } |
434 | | |
435 | | #[inline(always)] |
436 | 0 | unsafe fn deinterleave_fallback<Unit: Pod, Reg: Pod, SoaReg>(y: SoaReg) -> SoaReg { |
437 | 0 | assert!(core::mem::size_of::<SoaReg>() % core::mem::size_of::<Reg>() == 0); |
438 | 0 | assert!(core::mem::size_of::<Reg>() % core::mem::size_of::<Unit>() == 0); |
439 | 0 | assert!(!core::mem::needs_drop::<SoaReg>()); |
440 | | |
441 | | if const { core::mem::size_of::<SoaReg>() == core::mem::size_of::<Reg>() } { |
442 | 0 | y |
443 | | } else { |
444 | 0 | let mut x = core::ptr::read(&y); |
445 | | |
446 | 0 | let n = const { core::mem::size_of::<SoaReg>() / core::mem::size_of::<Reg>() }; |
447 | 0 | let m = const { core::mem::size_of::<Reg>() / core::mem::size_of::<Unit>() }; |
448 | | |
449 | | unsafe { |
450 | 0 | let y = (&y) as *const _ as *const Unit; |
451 | 0 | let x = (&mut x) as *mut _ as *mut Unit; |
452 | 0 | for j in 0..m { |
453 | 0 | for i in 0..n { |
454 | 0 | *x.add(j + i * m) = *y.add(i + n * j); |
455 | 0 | } |
456 | | } |
457 | | } |
458 | | |
459 | 0 | x |
460 | | } |
461 | 0 | } |
462 | | |
463 | | macro_rules! define_binop { |
464 | | ($func: ident, $ty: ident, $out: ident) => { |
465 | | paste! { |
466 | | fn [<$func _ $ty s>](self, a: Self::[<$ty s>], b: Self::[<$ty s>]) -> Self::[<$out s>]; |
467 | | } |
468 | | }; |
469 | | } |
470 | | |
471 | | macro_rules! define_binop_all { |
472 | | ($func: ident, $($ty: ident),*) => { |
473 | | $(define_binop!($func, $ty, $ty);)* |
474 | | }; |
475 | | ($func: ident, $($ty: ident => $out: ident),*) => { |
476 | | $(define_binop!($func, $ty, $out);)* |
477 | | }; |
478 | | } |
479 | | |
480 | | macro_rules! transmute_binop { |
481 | | ($func: ident, $ty: ident, $to: ident) => { |
482 | | paste! { |
483 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>], b: Self::[<$ty s>]) -> Self::[<$ty s>] { |
484 | 0 | self.[<transmute_ $ty s_ $to s>]( |
485 | 0 | self.[<$func _ $to s>](self.[<transmute_ $to s_ $ty s>](a), self.[<transmute_ $to s_ $ty s>](b)), |
486 | | ) |
487 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::or_i8s Unexecuted instantiation: <_ as pulp::Simd>::or_m8s Unexecuted instantiation: <_ as pulp::Simd>::add_i8s Unexecuted instantiation: <_ as pulp::Simd>::and_i8s Unexecuted instantiation: <_ as pulp::Simd>::and_m8s Unexecuted instantiation: <_ as pulp::Simd>::or_f32s Unexecuted instantiation: <_ as pulp::Simd>::or_f64s Unexecuted instantiation: <_ as pulp::Simd>::or_i16s Unexecuted instantiation: <_ as pulp::Simd>::or_i32s Unexecuted instantiation: <_ as pulp::Simd>::or_i64s Unexecuted instantiation: <_ as pulp::Simd>::or_m16s Unexecuted instantiation: <_ as pulp::Simd>::or_m32s Unexecuted instantiation: <_ as pulp::Simd>::or_m64s Unexecuted instantiation: <_ as pulp::Simd>::xor_i8s Unexecuted instantiation: <_ as pulp::Simd>::xor_m8s Unexecuted instantiation: <_ as pulp::Simd>::add_i16s Unexecuted instantiation: <_ as pulp::Simd>::add_i32s Unexecuted instantiation: <_ as pulp::Simd>::add_i64s Unexecuted instantiation: <_ as pulp::Simd>::and_f32s Unexecuted instantiation: <_ as pulp::Simd>::and_f64s Unexecuted instantiation: <_ as pulp::Simd>::and_i16s Unexecuted instantiation: <_ as pulp::Simd>::and_i32s Unexecuted instantiation: <_ as pulp::Simd>::and_i64s Unexecuted instantiation: <_ as pulp::Simd>::and_m16s Unexecuted instantiation: <_ as pulp::Simd>::and_m32s Unexecuted instantiation: <_ as pulp::Simd>::and_m64s Unexecuted instantiation: <_ as pulp::Simd>::xor_f32s Unexecuted instantiation: <_ as pulp::Simd>::xor_f64s Unexecuted instantiation: <_ as pulp::Simd>::xor_i16s Unexecuted instantiation: <_ as pulp::Simd>::xor_i32s Unexecuted instantiation: <_ as pulp::Simd>::xor_i64s Unexecuted instantiation: <_ as pulp::Simd>::xor_m16s Unexecuted instantiation: <_ as pulp::Simd>::xor_m32s Unexecuted instantiation: <_ as pulp::Simd>::xor_m64s |
488 | | } |
489 | | }; |
490 | | ($func: ident, $($ty: ident => $to: ident),*) => { |
491 | | $(transmute_binop!($func, $ty, $to);)* |
492 | | }; |
493 | | } |
494 | | |
495 | | macro_rules! define_unop { |
496 | | ($func: ident, $ty: ident, $out: ident) => { |
497 | | paste! { |
498 | | fn [<$func _ $ty s>](self, a: Self::[<$ty s>]) -> Self::[<$out s>]; |
499 | | } |
500 | | }; |
501 | | } |
502 | | |
503 | | macro_rules! define_unop_all { |
504 | | ($func: ident, $($ty: ident),*) => { |
505 | | $(define_unop!($func, $ty, $ty);)* |
506 | | }; |
507 | | ($func: ident, $($ty: ident => $out: ident),*) => { |
508 | | $(define_unop!($func, $ty, $out);)* |
509 | | }; |
510 | | } |
511 | | |
512 | | macro_rules! transmute_unop { |
513 | | ($func: ident, $ty: ident, $to: ident) => { |
514 | | paste! { |
515 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>]) -> Self::[<$ty s>] { |
516 | 0 | self.[<transmute_ $ty s_ $to s>]( |
517 | 0 | self.[<$func _ $to s>](self.[<transmute_ $to s_ $ty s>](a)), |
518 | | ) |
519 | 0 | } Unexecuted instantiation: <pulp::x86::v2::V2 as pulp::Simd>::not_f32s Unexecuted instantiation: <pulp::x86::v2::V2 as pulp::Simd>::not_f64s Unexecuted instantiation: <_ as pulp::Simd>::not_i8s Unexecuted instantiation: <_ as pulp::Simd>::not_i16s Unexecuted instantiation: <_ as pulp::Simd>::not_i32s Unexecuted instantiation: <_ as pulp::Simd>::not_i64s |
520 | | } |
521 | | }; |
522 | | ($func: ident, $($ty: ident => $to: ident),*) => { |
523 | | $(transmute_unop!($func, $ty, $to);)* |
524 | | }; |
525 | | } |
526 | | |
527 | | macro_rules! transmute_cmp { |
528 | | ($func: ident, $ty: ident, $to: ident, $out: ident) => { |
529 | | paste! { |
530 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>], b: Self::[<$ty s>]) -> Self::[<$out s>] { |
531 | 0 | self.[<$func _ $to s>](self.[<transmute_ $to s_ $ty s>](a), self.[<transmute_ $to s_ $ty s>](b)) |
532 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::equal_i16s Unexecuted instantiation: <_ as pulp::Simd>::equal_i32s Unexecuted instantiation: <_ as pulp::Simd>::equal_i64s Unexecuted instantiation: <_ as pulp::Simd>::equal_m16s Unexecuted instantiation: <_ as pulp::Simd>::equal_m32s Unexecuted instantiation: <_ as pulp::Simd>::equal_m64s Unexecuted instantiation: <_ as pulp::Simd>::equal_i8s Unexecuted instantiation: <_ as pulp::Simd>::equal_m8s |
533 | | } |
534 | | }; |
535 | | ($func: ident, $($ty: ident => $to: ident => $out: ident),*) => { |
536 | | $(transmute_cmp!($func, $ty, $to, $out);)* |
537 | | }; |
538 | | } |
539 | | |
540 | | macro_rules! define_splat { |
541 | | ($ty: ty) => { |
542 | | paste! { |
543 | | fn [<splat_ $ty s>](self, value: $ty) -> Self::[<$ty s>]; |
544 | | } |
545 | | }; |
546 | | ($($ty: ident),*) => { |
547 | | $(define_splat!($ty);)* |
548 | | }; |
549 | | } |
550 | | |
551 | | macro_rules! split_slice { |
552 | | ($ty: ident) => { |
553 | | paste! { |
554 | | #[inline(always)] |
555 | 0 | fn [<as_mut_rsimd_ $ty s>](slice: &mut [$ty]) -> (&mut [$ty], &mut [Self::[<$ty s>]]) { |
556 | 0 | unsafe { rsplit_mut_slice(slice) } |
557 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_i8s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_u8s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_c32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_c64s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_f32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_f64s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_i16s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_i32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_i64s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_u16s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_u32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_rsimd_u64s |
558 | | #[inline(always)] |
559 | 0 | fn [<as_rsimd_ $ty s>](slice: &[$ty]) -> (&[$ty], &[Self::[<$ty s>]]) { |
560 | 0 | unsafe { rsplit_slice(slice) } |
561 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_i8s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_u8s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_c32s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_c64s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_f32s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_f64s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_i16s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_i32s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_i64s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_u16s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_u32s Unexecuted instantiation: <_ as pulp::Simd>::as_rsimd_u64s |
562 | | #[inline(always)] |
563 | 0 | fn [<as_mut_simd_ $ty s>](slice: &mut [$ty]) -> (&mut [Self::[<$ty s>]], &mut [$ty]) { |
564 | 0 | unsafe { split_mut_slice(slice) } |
565 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_i8s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_u8s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_c32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_c64s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_f32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_f64s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_i16s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_i32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_i64s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_u16s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_u32s Unexecuted instantiation: <_ as pulp::Simd>::as_mut_simd_u64s |
566 | | #[inline(always)] |
567 | 0 | fn [<as_simd_ $ty s>](slice: &[$ty]) -> (&[Self::[<$ty s>]], &[$ty]) { |
568 | 0 | unsafe { split_slice(slice) } |
569 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::as_simd_i8s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_u8s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_c32s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_c64s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_f32s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_f64s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_i16s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_i32s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_i64s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_u16s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_u32s Unexecuted instantiation: <_ as pulp::Simd>::as_simd_u64s |
570 | | #[inline(always)] |
571 | 0 | fn [<as_uninit_mut_rsimd_ $ty s>]( |
572 | 0 | slice: &mut [MaybeUninit<$ty>], |
573 | 0 | ) -> (&mut [MaybeUninit<$ty>], &mut [MaybeUninit<Self::[<$ty s>]>]) { |
574 | 0 | unsafe { rsplit_mut_slice(slice) } |
575 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_i8s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_u8s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_c32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_c64s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_f32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_f64s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_i16s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_i32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_i64s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_u16s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_u32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_rsimd_u64s |
576 | | #[inline(always)] |
577 | 0 | fn [<as_uninit_mut_simd_ $ty s>]( |
578 | 0 | slice: &mut [MaybeUninit<$ty>], |
579 | 0 | ) -> (&mut [MaybeUninit<Self::[<$ty s>]>], &mut [MaybeUninit<$ty>]) { |
580 | 0 | unsafe { split_mut_slice(slice) } |
581 | 0 | } Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_i8s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_u8s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_c32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_c64s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_f32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_f64s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_i16s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_i32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_i64s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_u16s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_u32s Unexecuted instantiation: <_ as pulp::Simd>::as_uninit_mut_simd_u64s |
582 | | } |
583 | | }; |
584 | | ($($ty: ident),*) => { |
585 | | $(split_slice!($ty);)* |
586 | | }; |
587 | | } |
588 | | |
589 | | /// Types that allow \[de\]interleaving. |
590 | | /// |
591 | | /// # Safety |
592 | | /// Instances of this type passed to simd \[de\]interleave functions must be `Pod`. |
593 | | pub unsafe trait Interleave {} |
594 | | unsafe impl<T: Pod> Interleave for T {} |
595 | | |
596 | | pub trait Simd: Seal + Debug + Copy + Send + Sync + 'static { |
597 | | const IS_SCALAR: bool = false; |
598 | | |
599 | | const M64_LANES: usize = core::mem::size_of::<Self::m64s>() / core::mem::size_of::<m64>(); |
600 | | const U64_LANES: usize = core::mem::size_of::<Self::u64s>() / core::mem::size_of::<u64>(); |
601 | | const I64_LANES: usize = core::mem::size_of::<Self::i64s>() / core::mem::size_of::<i64>(); |
602 | | const F64_LANES: usize = core::mem::size_of::<Self::f64s>() / core::mem::size_of::<f64>(); |
603 | | const C64_LANES: usize = core::mem::size_of::<Self::c64s>() / core::mem::size_of::<c64>(); |
604 | | |
605 | | const M32_LANES: usize = core::mem::size_of::<Self::m32s>() / core::mem::size_of::<m32>(); |
606 | | const U32_LANES: usize = core::mem::size_of::<Self::u32s>() / core::mem::size_of::<u32>(); |
607 | | const I32_LANES: usize = core::mem::size_of::<Self::i32s>() / core::mem::size_of::<i32>(); |
608 | | const F32_LANES: usize = core::mem::size_of::<Self::f32s>() / core::mem::size_of::<f32>(); |
609 | | const C32_LANES: usize = core::mem::size_of::<Self::c32s>() / core::mem::size_of::<c32>(); |
610 | | |
611 | | const M16_LANES: usize = core::mem::size_of::<Self::m16s>() / core::mem::size_of::<m16>(); |
612 | | const U16_LANES: usize = core::mem::size_of::<Self::u16s>() / core::mem::size_of::<u16>(); |
613 | | const I16_LANES: usize = core::mem::size_of::<Self::i16s>() / core::mem::size_of::<i16>(); |
614 | | |
615 | | const M8_LANES: usize = core::mem::size_of::<Self::m8s>() / core::mem::size_of::<m8>(); |
616 | | const U8_LANES: usize = core::mem::size_of::<Self::u8s>() / core::mem::size_of::<u8>(); |
617 | | const I8_LANES: usize = core::mem::size_of::<Self::i8s>() / core::mem::size_of::<i8>(); |
618 | | |
619 | | const REGISTER_COUNT: usize; |
620 | | |
621 | | type m8s: Debug + Copy + Send + Sync + Zeroable + NoUninit + CheckedBitPattern + 'static; |
622 | | type i8s: Debug + Copy + Send + Sync + Pod + 'static; |
623 | | type u8s: Debug + Copy + Send + Sync + Pod + 'static; |
624 | | |
625 | | type m16s: Debug + Copy + Send + Sync + Zeroable + NoUninit + CheckedBitPattern + 'static; |
626 | | type i16s: Debug + Copy + Send + Sync + Pod + 'static; |
627 | | type u16s: Debug + Copy + Send + Sync + Pod + 'static; |
628 | | |
629 | | type m32s: Debug + Copy + Send + Sync + Zeroable + NoUninit + CheckedBitPattern + 'static; |
630 | | type f32s: Debug + Copy + Send + Sync + Pod + 'static; |
631 | | type c32s: Debug + Copy + Send + Sync + Pod + 'static; |
632 | | type i32s: Debug + Copy + Send + Sync + Pod + 'static; |
633 | | type u32s: Debug + Copy + Send + Sync + Pod + 'static; |
634 | | |
635 | | type m64s: Debug + Copy + Send + Sync + Zeroable + NoUninit + CheckedBitPattern + 'static; |
636 | | type f64s: Debug + Copy + Send + Sync + Pod + 'static; |
637 | | type c64s: Debug + Copy + Send + Sync + Pod + 'static; |
638 | | type i64s: Debug + Copy + Send + Sync + Pod + 'static; |
639 | | type u64s: Debug + Copy + Send + Sync + Pod + 'static; |
640 | | |
641 | | /// Contains the square of the norm in both the real and imaginary components. |
642 | | fn abs2_c32s(self, a: Self::c32s) -> Self::c32s; |
643 | | |
644 | | /// Contains the square of the norm in both the real and imaginary components. |
645 | | fn abs2_c64s(self, a: Self::c64s) -> Self::c64s; |
646 | | #[inline] |
647 | 0 | fn abs_f32s(self, a: Self::f32s) -> Self::f32s { |
648 | 0 | self.and_f32s(self.not_f32s(self.splat_f32s(-0.0)), a) |
649 | 0 | } |
650 | | #[inline] |
651 | 0 | fn abs_f64s(self, a: Self::f64s) -> Self::f64s { |
652 | 0 | self.and_f64s(self.not_f64s(self.splat_f64s(-0.0)), a) |
653 | 0 | } |
654 | | /// Contains the max norm in both the real and imaginary components. |
655 | | fn abs_max_c32s(self, a: Self::c32s) -> Self::c32s; |
656 | | /// Contains the max norm in both the real and imaginary components. |
657 | | fn abs_max_c64s(self, a: Self::c64s) -> Self::c64s; |
658 | | |
659 | | define_binop_all!(add, c32, c64, f32, f64, u8, u16, u32, u64); |
660 | | define_binop_all!( |
661 | | sub, c32, c64, f32, f64, u8, i8, u16, i16, u32, i32, u64, i64 |
662 | | ); |
663 | | define_binop_all!(mul, c32, c64, f32, f64, u16, i16, u32, i32, u64, i64); |
664 | | define_binop_all!(div, f32, f64); |
665 | | define_binop_all!(equal, u8 => m8, u16 => m16, u32 => m32, u64 => m64, c32 => m32, f32 => m32, c64 => m64, f64 => m64); |
666 | | define_binop_all!(greater_than, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
667 | | define_binop_all!(greater_than_or_equal, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
668 | | define_binop_all!(less_than_or_equal, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
669 | | define_binop_all!(less_than, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
670 | | |
671 | | define_binop_all!(and, u8, u16, u32, u64); |
672 | | define_binop_all!(or, u8, u16, u32, u64); |
673 | | define_binop_all!(xor, u8, u16, u32, u64); |
674 | | |
675 | | transmute_binop!(and, m8 => u8, i8 => u8, m16 => u16, i16 => u16, m32 => u32, i32 => u32, m64 => u64, i64 => u64, f32 => u32, f64 => u64); |
676 | | transmute_binop!(or, m8 => u8, i8 => u8, m16 => u16, i16 => u16, m32 => u32, i32 => u32, m64 => u64, i64 => u64, f32 => u32, f64 => u64); |
677 | | transmute_binop!(xor, m8 => u8, i8 => u8, m16 => u16, i16 => u16, m32 => u32, i32 => u32, m64 => u64, i64 => u64, f32 => u32, f64 => u64); |
678 | | |
679 | | transmute_binop!(add, i8 => u8, i16 => u16, i32 => u32, i64 => u64); |
680 | | transmute_cmp!(equal, m8 => u8 => m8, i8 => u8 => m8, m16 => u16 => m16, i16 => u16 => m16, m32 => u32 => m32, i32 => u32 => m32, m64 => u64 => m64, i64 => u64 => m64); |
681 | | |
682 | | define_binop_all!(min, f32, f64, u8, i8, u16, i16, u32, i32, u64, i64); |
683 | | define_binop_all!(max, f32, f64, u8, i8, u16, i16, u32, i32, u64, i64); |
684 | | |
685 | | define_unop_all!(neg, c32, c64); |
686 | | define_unop_all!(not, m8, u8, m16, u16, m32, u32, m64, u64); |
687 | | |
688 | | transmute_unop!(not, i8 => u8, i16 => u16, i32 => u32, i64 => u64, f32 => u32, f64 => u64); |
689 | | |
690 | | split_slice!(u8, i8, u16, i16, u32, i32, u64, i64, c32, f32, c64, f64); |
691 | | define_splat!(u8, i8, u16, i16, u32, i32, u64, i64, c32, f32, c64, f64); |
692 | | |
693 | | fn sqrt_f32s(self, a: Self::f32s) -> Self::f32s; |
694 | | fn sqrt_f64s(self, a: Self::f64s) -> Self::f64s; |
695 | | |
696 | | fn conj_c32s(self, a: Self::c32s) -> Self::c32s; |
697 | | fn conj_c64s(self, a: Self::c64s) -> Self::c64s; |
698 | | fn conj_mul_add_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s; |
699 | | fn conj_mul_add_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s; |
700 | | |
701 | | /// Computes `conj(a) * b + c` |
702 | | #[inline] |
703 | 0 | fn conj_mul_add_e_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
704 | 0 | self.conj_mul_add_c32s(a, b, c) |
705 | 0 | } |
706 | | /// Computes `conj(a) * b + c` |
707 | | #[inline] |
708 | 0 | fn conj_mul_add_e_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
709 | 0 | self.conj_mul_add_c64s(a, b, c) |
710 | 0 | } |
711 | | fn conj_mul_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s; |
712 | | |
713 | | fn conj_mul_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s; |
714 | | /// Computes `conj(a) * b` |
715 | | #[inline] |
716 | 0 | fn conj_mul_e_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s { |
717 | 0 | self.conj_mul_c32s(a, b) |
718 | 0 | } |
719 | | /// Computes `conj(a) * b` |
720 | | #[inline] |
721 | 0 | fn conj_mul_e_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s { |
722 | 0 | self.conj_mul_c64s(a, b) |
723 | 0 | } |
724 | | #[inline(always)] |
725 | 0 | fn deinterleave_shfl_f32s<T: Interleave>(self, values: T) -> T { |
726 | 0 | unsafe { deinterleave_fallback::<f32, Self::f32s, T>(values) } |
727 | 0 | } |
728 | | |
729 | | #[inline(always)] |
730 | 0 | fn deinterleave_shfl_f64s<T: Interleave>(self, values: T) -> T { |
731 | 0 | unsafe { deinterleave_fallback::<f64, Self::f64s, T>(values) } |
732 | 0 | } |
733 | | |
734 | | #[inline(always)] |
735 | 0 | fn first_true_m8s(self, mask: Self::m8s) -> usize { |
736 | | if const { core::mem::size_of::<Self::m8s>() == core::mem::size_of::<Self::u8s>() } { |
737 | 0 | let mask: Self::u8s = bytemuck::cast(mask); |
738 | 0 | let slice = bytemuck::cast_slice::<Self::u8s, u8>(core::slice::from_ref(&mask)); |
739 | 0 | let mut i = 0; |
740 | 0 | for &x in slice.iter() { |
741 | 0 | if x != 0 { |
742 | 0 | break; |
743 | 0 | } |
744 | 0 | i += 1; |
745 | | } |
746 | 0 | i |
747 | | } else if const { core::mem::size_of::<Self::m8s>() == core::mem::size_of::<u8>() } { |
748 | 0 | let mask: u8 = bytemuck::cast(mask); |
749 | 0 | mask.leading_zeros() as usize |
750 | | } else if const { core::mem::size_of::<Self::m8s>() == core::mem::size_of::<u16>() } { |
751 | 0 | let mask: u16 = bytemuck::cast(mask); |
752 | 0 | mask.leading_zeros() as usize |
753 | | } else { |
754 | 0 | panic!() |
755 | | } |
756 | 0 | } |
757 | | |
758 | | #[inline(always)] |
759 | 0 | fn first_true_m16s(self, mask: Self::m16s) -> usize { |
760 | | if const { core::mem::size_of::<Self::m16s>() == core::mem::size_of::<Self::u16s>() } { |
761 | 0 | let mask: Self::u16s = bytemuck::cast(mask); |
762 | 0 | let slice = bytemuck::cast_slice::<Self::u16s, u16>(core::slice::from_ref(&mask)); |
763 | 0 | let mut i = 0; |
764 | 0 | for &x in slice.iter() { |
765 | 0 | if x != 0 { |
766 | 0 | break; |
767 | 0 | } |
768 | 0 | i += 1; |
769 | | } |
770 | 0 | i |
771 | | } else if const { core::mem::size_of::<Self::m16s>() == core::mem::size_of::<u8>() } { |
772 | 0 | let mask: u8 = bytemuck::cast(mask); |
773 | 0 | mask.leading_zeros() as usize |
774 | | } else if const { core::mem::size_of::<Self::m16s>() == core::mem::size_of::<u16>() } { |
775 | 0 | let mask: u16 = bytemuck::cast(mask); |
776 | 0 | mask.leading_zeros() as usize |
777 | | } else { |
778 | 0 | panic!() |
779 | | } |
780 | 0 | } |
781 | | |
782 | | #[inline(always)] |
783 | 0 | fn first_true_m32s(self, mask: Self::m32s) -> usize { |
784 | | if const { core::mem::size_of::<Self::m32s>() == core::mem::size_of::<Self::u32s>() } { |
785 | 0 | let mask: Self::u32s = bytemuck::cast(mask); |
786 | 0 | let slice = bytemuck::cast_slice::<Self::u32s, u32>(core::slice::from_ref(&mask)); |
787 | 0 | let mut i = 0; |
788 | 0 | for &x in slice.iter() { |
789 | 0 | if x != 0 { |
790 | 0 | break; |
791 | 0 | } |
792 | 0 | i += 1; |
793 | | } |
794 | 0 | i |
795 | | } else if const { core::mem::size_of::<Self::m32s>() == core::mem::size_of::<u8>() } { |
796 | 0 | let mask: u8 = bytemuck::cast(mask); |
797 | 0 | mask.leading_zeros() as usize |
798 | | } else if const { core::mem::size_of::<Self::m32s>() == core::mem::size_of::<u16>() } { |
799 | 0 | let mask: u16 = bytemuck::cast(mask); |
800 | 0 | mask.leading_zeros() as usize |
801 | | } else { |
802 | 0 | panic!() |
803 | | } |
804 | 0 | } |
805 | | |
806 | | #[inline(always)] |
807 | 0 | fn first_true_m64s(self, mask: Self::m64s) -> usize { |
808 | | if const { core::mem::size_of::<Self::m64s>() == core::mem::size_of::<Self::u64s>() } { |
809 | 0 | let mask: Self::u64s = bytemuck::cast(mask); |
810 | 0 | let slice = bytemuck::cast_slice::<Self::u64s, u64>(core::slice::from_ref(&mask)); |
811 | 0 | let mut i = 0; |
812 | 0 | for &x in slice.iter() { |
813 | 0 | if x != 0 { |
814 | 0 | break; |
815 | 0 | } |
816 | 0 | i += 1; |
817 | | } |
818 | 0 | i |
819 | | } else if const { core::mem::size_of::<Self::m64s>() == core::mem::size_of::<u8>() } { |
820 | 0 | let mask: u8 = bytemuck::cast(mask); |
821 | 0 | mask.leading_zeros() as usize |
822 | | } else if const { core::mem::size_of::<Self::m64s>() == core::mem::size_of::<u16>() } { |
823 | 0 | let mask: u16 = bytemuck::cast(mask); |
824 | 0 | mask.leading_zeros() as usize |
825 | | } else { |
826 | 0 | panic!() |
827 | | } |
828 | 0 | } |
829 | | |
830 | | #[inline(always)] |
831 | 0 | fn interleave_shfl_f32s<T: Interleave>(self, values: T) -> T { |
832 | 0 | unsafe { interleave_fallback::<f32, Self::f32s, T>(values) } |
833 | 0 | } |
834 | | |
835 | | #[inline(always)] |
836 | 0 | fn interleave_shfl_f64s<T: Interleave>(self, values: T) -> T { |
837 | 0 | unsafe { interleave_fallback::<f64, Self::f64s, T>(values) } |
838 | 0 | } |
839 | | |
840 | | #[inline(always)] |
841 | 0 | fn mask_between_m8s(self, start: u8, end: u8) -> MemMask<Self::m8s> { |
842 | 0 | let iota: Self::u8s = const { |
843 | | unsafe { core::mem::transmute_copy(&iota_8::<u8, { MAX_REGISTER_BYTES / 1 }>()) } |
844 | | }; |
845 | 0 | self.and_m8s( |
846 | 0 | self.greater_than_or_equal_u8s(iota, self.splat_u8s(start)), |
847 | 0 | self.less_than_u8s(iota, self.splat_u8s(end)), |
848 | | ) |
849 | 0 | .into() |
850 | 0 | } |
851 | | |
852 | | #[inline(always)] |
853 | 0 | fn mask_between_m16s(self, start: u16, end: u16) -> MemMask<Self::m16s> { |
854 | 0 | let iota: Self::u16s = const { |
855 | | unsafe { core::mem::transmute_copy(&iota_16::<u16, { MAX_REGISTER_BYTES / 2 }>()) } |
856 | | }; |
857 | 0 | self.and_m16s( |
858 | 0 | self.greater_than_or_equal_u16s(iota, self.splat_u16s(start)), |
859 | 0 | self.less_than_u16s(iota, self.splat_u16s(end)), |
860 | | ) |
861 | 0 | .into() |
862 | 0 | } |
863 | | |
864 | | #[inline(always)] |
865 | 0 | fn mask_between_m32s(self, start: u32, end: u32) -> MemMask<Self::m32s> { |
866 | 0 | let iota: Self::u32s = const { |
867 | | unsafe { core::mem::transmute_copy(&iota_32::<u32, { MAX_REGISTER_BYTES / 4 }>()) } |
868 | | }; |
869 | 0 | self.and_m32s( |
870 | 0 | self.greater_than_or_equal_u32s(iota, self.splat_u32s(start)), |
871 | 0 | self.less_than_u32s(iota, self.splat_u32s(end)), |
872 | | ) |
873 | 0 | .into() |
874 | 0 | } |
875 | | |
876 | | #[inline(always)] |
877 | 0 | fn mask_between_m64s(self, start: u64, end: u64) -> MemMask<Self::m64s> { |
878 | 0 | let iota: Self::u64s = const { |
879 | | unsafe { core::mem::transmute_copy(&iota_64::<u64, { MAX_REGISTER_BYTES / 8 }>()) } |
880 | | }; |
881 | 0 | self.and_m64s( |
882 | 0 | self.greater_than_or_equal_u64s(iota, self.splat_u64s(start)), |
883 | 0 | self.less_than_u64s(iota, self.splat_u64s(end)), |
884 | | ) |
885 | 0 | .into() |
886 | 0 | } |
887 | | /// # Safety |
888 | | /// |
889 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
890 | | /// [`core::ptr::read`]. |
891 | | unsafe fn mask_load_ptr_c32s(self, mask: MemMask<Self::m32s>, ptr: *const c32) -> Self::c32s; |
892 | | /// # Safety |
893 | | /// |
894 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
895 | | /// [`core::ptr::read`]. |
896 | | unsafe fn mask_load_ptr_c64s(self, mask: MemMask<Self::m64s>, ptr: *const c64) -> Self::c64s; |
897 | | /// # Safety |
898 | | /// |
899 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
900 | | /// [`core::ptr::read`]. |
901 | | #[inline(always)] |
902 | 0 | unsafe fn mask_load_ptr_f32s(self, mask: MemMask<Self::m32s>, ptr: *const f32) -> Self::f32s { |
903 | 0 | self.transmute_f32s_u32s(self.mask_load_ptr_u32s(mask, ptr as *const u32)) |
904 | 0 | } |
905 | | |
906 | | /// # Safety |
907 | | /// |
908 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
909 | | /// [`core::ptr::read`]. |
910 | | #[inline(always)] |
911 | 0 | unsafe fn mask_load_ptr_f64s(self, mask: MemMask<Self::m64s>, ptr: *const f64) -> Self::f64s { |
912 | 0 | self.transmute_f64s_u64s(self.mask_load_ptr_u64s(mask, ptr as *const u64)) |
913 | 0 | } |
914 | | /// # Safety |
915 | | /// |
916 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
917 | | /// [`core::ptr::read`]. |
918 | | #[inline(always)] |
919 | 0 | unsafe fn mask_load_ptr_i8s(self, mask: MemMask<Self::m8s>, ptr: *const i8) -> Self::i8s { |
920 | 0 | self.transmute_i8s_u8s(self.mask_load_ptr_u8s(mask, ptr as *const u8)) |
921 | 0 | } |
922 | | /// # Safety |
923 | | /// |
924 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
925 | | /// [`core::ptr::read`]. |
926 | | #[inline(always)] |
927 | 0 | unsafe fn mask_load_ptr_i16s(self, mask: MemMask<Self::m16s>, ptr: *const i16) -> Self::i16s { |
928 | 0 | self.transmute_i16s_u16s(self.mask_load_ptr_u16s(mask, ptr as *const u16)) |
929 | 0 | } |
930 | | /// # Safety |
931 | | /// |
932 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
933 | | /// [`core::ptr::read`]. |
934 | | #[inline(always)] |
935 | 0 | unsafe fn mask_load_ptr_i32s(self, mask: MemMask<Self::m32s>, ptr: *const i32) -> Self::i32s { |
936 | 0 | self.transmute_i32s_u32s(self.mask_load_ptr_u32s(mask, ptr as *const u32)) |
937 | 0 | } |
938 | | /// # Safety |
939 | | /// |
940 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
941 | | /// [`core::ptr::read`]. |
942 | | #[inline(always)] |
943 | 0 | unsafe fn mask_load_ptr_i64s(self, mask: MemMask<Self::m64s>, ptr: *const i64) -> Self::i64s { |
944 | 0 | self.transmute_i64s_u64s(self.mask_load_ptr_u64s(mask, ptr as *const u64)) |
945 | 0 | } |
946 | | |
947 | | /// # Safety |
948 | | /// |
949 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
950 | | /// [`core::ptr::read`]. |
951 | | unsafe fn mask_load_ptr_u8s(self, mask: MemMask<Self::m8s>, ptr: *const u8) -> Self::u8s; |
952 | | |
953 | | /// # Safety |
954 | | /// |
955 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
956 | | /// [`core::ptr::read`]. |
957 | | unsafe fn mask_load_ptr_u16s(self, mask: MemMask<Self::m16s>, ptr: *const u16) -> Self::u16s; |
958 | | |
959 | | /// # Safety |
960 | | /// |
961 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
962 | | /// [`core::ptr::read`]. |
963 | | unsafe fn mask_load_ptr_u32s(self, mask: MemMask<Self::m32s>, ptr: *const u32) -> Self::u32s; |
964 | | |
965 | | /// # Safety |
966 | | /// |
967 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
968 | | /// [`core::ptr::read`]. |
969 | | unsafe fn mask_load_ptr_u64s(self, mask: MemMask<Self::m64s>, ptr: *const u64) -> Self::u64s; |
970 | | /// # Safety |
971 | | /// |
972 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
973 | | /// [`core::ptr::write`]. |
974 | | unsafe fn mask_store_ptr_c32s( |
975 | | self, |
976 | | mask: MemMask<Self::m32s>, |
977 | | ptr: *mut c32, |
978 | | values: Self::c32s, |
979 | | ); |
980 | | /// # Safety |
981 | | /// |
982 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
983 | | /// [`core::ptr::write`]. |
984 | | unsafe fn mask_store_ptr_c64s( |
985 | | self, |
986 | | mask: MemMask<Self::m64s>, |
987 | | ptr: *mut c64, |
988 | | values: Self::c64s, |
989 | | ); |
990 | | /// # Safety |
991 | | /// |
992 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
993 | | /// [`core::ptr::write`]. |
994 | | #[inline(always)] |
995 | 0 | unsafe fn mask_store_ptr_f32s( |
996 | 0 | self, |
997 | 0 | mask: MemMask<Self::m32s>, |
998 | 0 | ptr: *mut f32, |
999 | 0 | values: Self::f32s, |
1000 | 0 | ) { |
1001 | 0 | self.mask_store_ptr_u32s(mask, ptr as *mut u32, self.transmute_u32s_f32s(values)); |
1002 | 0 | } |
1003 | | |
1004 | | /// # Safety |
1005 | | /// |
1006 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1007 | | /// [`core::ptr::write`]. |
1008 | | #[inline(always)] |
1009 | 0 | unsafe fn mask_store_ptr_f64s( |
1010 | 0 | self, |
1011 | 0 | mask: MemMask<Self::m64s>, |
1012 | 0 | ptr: *mut f64, |
1013 | 0 | values: Self::f64s, |
1014 | 0 | ) { |
1015 | 0 | self.mask_store_ptr_u64s(mask, ptr as *mut u64, self.transmute_u64s_f64s(values)); |
1016 | 0 | } |
1017 | | /// # Safety |
1018 | | /// |
1019 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1020 | | /// [`core::ptr::write`]. |
1021 | | #[inline(always)] |
1022 | 0 | unsafe fn mask_store_ptr_i8s(self, mask: MemMask<Self::m8s>, ptr: *mut i8, values: Self::i8s) { |
1023 | 0 | self.mask_store_ptr_u8s(mask, ptr as *mut u8, self.transmute_u8s_i8s(values)); |
1024 | 0 | } |
1025 | | /// # Safety |
1026 | | /// |
1027 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1028 | | /// [`core::ptr::write`]. |
1029 | | #[inline(always)] |
1030 | 0 | unsafe fn mask_store_ptr_i16s( |
1031 | 0 | self, |
1032 | 0 | mask: MemMask<Self::m16s>, |
1033 | 0 | ptr: *mut i16, |
1034 | 0 | values: Self::i16s, |
1035 | 0 | ) { |
1036 | 0 | self.mask_store_ptr_u16s(mask, ptr as *mut u16, self.transmute_u16s_i16s(values)); |
1037 | 0 | } |
1038 | | /// # Safety |
1039 | | /// |
1040 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1041 | | /// [`core::ptr::write`]. |
1042 | | #[inline(always)] |
1043 | 0 | unsafe fn mask_store_ptr_i32s( |
1044 | 0 | self, |
1045 | 0 | mask: MemMask<Self::m32s>, |
1046 | 0 | ptr: *mut i32, |
1047 | 0 | values: Self::i32s, |
1048 | 0 | ) { |
1049 | 0 | self.mask_store_ptr_u32s(mask, ptr as *mut u32, self.transmute_u32s_i32s(values)); |
1050 | 0 | } |
1051 | | /// # Safety |
1052 | | /// |
1053 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1054 | | /// [`core::ptr::write`]. |
1055 | | #[inline(always)] |
1056 | 0 | unsafe fn mask_store_ptr_i64s( |
1057 | 0 | self, |
1058 | 0 | mask: MemMask<Self::m64s>, |
1059 | 0 | ptr: *mut i64, |
1060 | 0 | values: Self::i64s, |
1061 | 0 | ) { |
1062 | 0 | self.mask_store_ptr_u64s(mask, ptr as *mut u64, self.transmute_u64s_i64s(values)); |
1063 | 0 | } |
1064 | | |
1065 | | /// # Safety |
1066 | | /// |
1067 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1068 | | /// [`core::ptr::write`]. |
1069 | | unsafe fn mask_store_ptr_u8s(self, mask: MemMask<Self::m8s>, ptr: *mut u8, values: Self::u8s); |
1070 | | |
1071 | | /// # Safety |
1072 | | /// |
1073 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1074 | | /// [`core::ptr::write`]. |
1075 | | unsafe fn mask_store_ptr_u16s( |
1076 | | self, |
1077 | | mask: MemMask<Self::m16s>, |
1078 | | ptr: *mut u16, |
1079 | | values: Self::u16s, |
1080 | | ); |
1081 | | |
1082 | | /// # Safety |
1083 | | /// |
1084 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1085 | | /// [`core::ptr::write`]. |
1086 | | unsafe fn mask_store_ptr_u32s( |
1087 | | self, |
1088 | | mask: MemMask<Self::m32s>, |
1089 | | ptr: *mut u32, |
1090 | | values: Self::u32s, |
1091 | | ); |
1092 | | |
1093 | | /// # Safety |
1094 | | /// |
1095 | | /// Addresses corresponding to enabled lanes in the mask have the same restrictions as |
1096 | | /// [`core::ptr::write`]. |
1097 | | unsafe fn mask_store_ptr_u64s( |
1098 | | self, |
1099 | | mask: MemMask<Self::m64s>, |
1100 | | ptr: *mut u64, |
1101 | | values: Self::u64s, |
1102 | | ); |
1103 | | |
1104 | | fn mul_add_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s; |
1105 | | fn mul_add_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s; |
1106 | | /// Computes `a * b + c` |
1107 | | #[inline] |
1108 | 0 | fn mul_add_e_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
1109 | 0 | self.mul_add_c32s(a, b, c) |
1110 | 0 | } |
1111 | | /// Computes `a * b + c` |
1112 | | #[inline] |
1113 | 0 | fn mul_add_e_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
1114 | 0 | self.mul_add_c64s(a, b, c) |
1115 | 0 | } |
1116 | | fn mul_add_e_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s; |
1117 | | fn mul_add_e_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s; |
1118 | | fn mul_add_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s; |
1119 | | fn mul_add_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s; |
1120 | | |
1121 | | /// Computes `-a * b + c` |
1122 | | #[inline(always)] |
1123 | 0 | fn negate_mul_add_e_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
1124 | 0 | self.mul_add_e_f32s(self.neg_f32s(a), b, c) |
1125 | 0 | } |
1126 | | #[inline(always)] |
1127 | 0 | fn negate_mul_add_e_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
1128 | 0 | self.mul_add_e_f64s(self.neg_f64s(a), b, c) |
1129 | 0 | } |
1130 | | #[inline(always)] |
1131 | 0 | fn negate_mul_add_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
1132 | 0 | self.mul_add_f32s(self.neg_f32s(a), b, c) |
1133 | 0 | } |
1134 | | #[inline(always)] |
1135 | 0 | fn negate_mul_add_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
1136 | 0 | self.mul_add_f64s(self.neg_f64s(a), b, c) |
1137 | 0 | } |
1138 | | |
1139 | | /// Computes `a * b` |
1140 | | #[inline] |
1141 | 0 | fn mul_e_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s { |
1142 | 0 | self.mul_c32s(a, b) |
1143 | 0 | } |
1144 | | /// Computes `a * b` |
1145 | 0 | fn mul_e_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s { |
1146 | 0 | self.mul_c64s(a, b) |
1147 | 0 | } |
1148 | | |
1149 | | #[inline] |
1150 | 0 | fn neg_f32s(self, a: Self::f32s) -> Self::f32s { |
1151 | 0 | self.xor_f32s(self.splat_f32s(-0.0), a) |
1152 | 0 | } |
1153 | | #[inline] |
1154 | 0 | fn neg_f64s(self, a: Self::f64s) -> Self::f64s { |
1155 | 0 | self.xor_f64s(a, self.splat_f64s(-0.0)) |
1156 | 0 | } |
1157 | | |
1158 | | #[inline(always)] |
1159 | 0 | fn partial_load_c32s(self, slice: &[c32]) -> Self::c32s { |
1160 | 0 | cast(self.partial_load_f64s(bytemuck::cast_slice(slice))) |
1161 | 0 | } |
1162 | | #[inline(always)] |
1163 | 0 | fn partial_load_c64s(self, slice: &[c64]) -> Self::c64s { |
1164 | 0 | cast(self.partial_load_f64s(bytemuck::cast_slice(slice))) |
1165 | 0 | } |
1166 | | #[inline(always)] |
1167 | 0 | fn partial_load_f32s(self, slice: &[f32]) -> Self::f32s { |
1168 | 0 | cast(self.partial_load_u32s(bytemuck::cast_slice(slice))) |
1169 | 0 | } |
1170 | | #[inline(always)] |
1171 | 0 | fn partial_load_f64s(self, slice: &[f64]) -> Self::f64s { |
1172 | 0 | cast(self.partial_load_u64s(bytemuck::cast_slice(slice))) |
1173 | 0 | } |
1174 | | #[inline(always)] |
1175 | 0 | fn partial_load_i8s(self, slice: &[i8]) -> Self::i8s { |
1176 | 0 | cast(self.partial_load_u8s(bytemuck::cast_slice(slice))) |
1177 | 0 | } |
1178 | | #[inline(always)] |
1179 | 0 | fn partial_load_i16s(self, slice: &[i16]) -> Self::i16s { |
1180 | 0 | cast(self.partial_load_u16s(bytemuck::cast_slice(slice))) |
1181 | 0 | } |
1182 | | #[inline(always)] |
1183 | 0 | fn partial_load_i32s(self, slice: &[i32]) -> Self::i32s { |
1184 | 0 | cast(self.partial_load_u32s(bytemuck::cast_slice(slice))) |
1185 | 0 | } |
1186 | | #[inline(always)] |
1187 | 0 | fn partial_load_i64s(self, slice: &[i64]) -> Self::i64s { |
1188 | 0 | cast(self.partial_load_u64s(bytemuck::cast_slice(slice))) |
1189 | 0 | } |
1190 | | #[inline(always)] |
1191 | 0 | fn partial_load_u8s(self, slice: &[u8]) -> Self::u8s { |
1192 | | unsafe { |
1193 | 0 | self.mask_load_ptr_u8s(self.mask_between_m8s(0, slice.len() as u8), slice.as_ptr()) |
1194 | | } |
1195 | 0 | } |
1196 | | #[inline(always)] |
1197 | 0 | fn partial_load_u16s(self, slice: &[u16]) -> Self::u16s { |
1198 | | unsafe { |
1199 | 0 | self.mask_load_ptr_u16s( |
1200 | 0 | self.mask_between_m16s(0, slice.len() as u16), |
1201 | 0 | slice.as_ptr(), |
1202 | | ) |
1203 | | } |
1204 | 0 | } |
1205 | | #[inline(always)] |
1206 | 0 | fn partial_load_u32s(self, slice: &[u32]) -> Self::u32s { |
1207 | | unsafe { |
1208 | 0 | self.mask_load_ptr_u32s( |
1209 | 0 | self.mask_between_m32s(0, slice.len() as u32), |
1210 | 0 | slice.as_ptr(), |
1211 | | ) |
1212 | | } |
1213 | 0 | } |
1214 | | #[inline(always)] |
1215 | 0 | fn partial_load_u64s(self, slice: &[u64]) -> Self::u64s { |
1216 | | unsafe { |
1217 | 0 | self.mask_load_ptr_u64s( |
1218 | 0 | self.mask_between_m64s(0, slice.len() as u64), |
1219 | 0 | slice.as_ptr(), |
1220 | | ) |
1221 | | } |
1222 | 0 | } |
1223 | | |
1224 | | #[inline(always)] |
1225 | 0 | fn partial_store_c32s(self, slice: &mut [c32], values: Self::c32s) { |
1226 | 0 | self.partial_store_f64s(bytemuck::cast_slice_mut(slice), cast(values)) |
1227 | 0 | } |
1228 | | #[inline(always)] |
1229 | 0 | fn partial_store_c64s(self, slice: &mut [c64], values: Self::c64s) { |
1230 | 0 | self.partial_store_f64s(bytemuck::cast_slice_mut(slice), cast(values)) |
1231 | 0 | } |
1232 | | |
1233 | | #[inline(always)] |
1234 | 0 | fn partial_store_f32s(self, slice: &mut [f32], values: Self::f32s) { |
1235 | 0 | self.partial_store_u32s(bytemuck::cast_slice_mut(slice), cast(values)) |
1236 | 0 | } |
1237 | | #[inline(always)] |
1238 | 0 | fn partial_store_f64s(self, slice: &mut [f64], values: Self::f64s) { |
1239 | 0 | self.partial_store_u64s(bytemuck::cast_slice_mut(slice), cast(values)) |
1240 | 0 | } |
1241 | | #[inline(always)] |
1242 | 0 | fn partial_store_i8s(self, slice: &mut [i8], values: Self::i8s) { |
1243 | 0 | self.partial_store_u16s(bytemuck::cast_slice_mut(slice), cast(values)) |
1244 | 0 | } |
1245 | | #[inline(always)] |
1246 | 0 | fn partial_store_i16s(self, slice: &mut [i16], values: Self::i16s) { |
1247 | 0 | self.partial_store_u16s(bytemuck::cast_slice_mut(slice), cast(values)) |
1248 | 0 | } |
1249 | | #[inline(always)] |
1250 | 0 | fn partial_store_i32s(self, slice: &mut [i32], values: Self::i32s) { |
1251 | 0 | self.partial_store_u32s(bytemuck::cast_slice_mut(slice), cast(values)) |
1252 | 0 | } |
1253 | | #[inline(always)] |
1254 | 0 | fn partial_store_i64s(self, slice: &mut [i64], values: Self::i64s) { |
1255 | 0 | self.partial_store_u64s(bytemuck::cast_slice_mut(slice), cast(values)) |
1256 | 0 | } |
1257 | | #[inline(always)] |
1258 | 0 | fn partial_store_u8s(self, slice: &mut [u8], values: Self::u8s) { |
1259 | | unsafe { |
1260 | 0 | self.mask_store_ptr_u8s( |
1261 | 0 | self.mask_between_m8s(0, slice.len() as u8), |
1262 | 0 | slice.as_mut_ptr(), |
1263 | 0 | values, |
1264 | | ) |
1265 | | } |
1266 | 0 | } |
1267 | | #[inline(always)] |
1268 | 0 | fn partial_store_u16s(self, slice: &mut [u16], values: Self::u16s) { |
1269 | | unsafe { |
1270 | 0 | self.mask_store_ptr_u16s( |
1271 | 0 | self.mask_between_m16s(0, slice.len() as u16), |
1272 | 0 | slice.as_mut_ptr(), |
1273 | 0 | values, |
1274 | | ) |
1275 | | } |
1276 | 0 | } |
1277 | | #[inline(always)] |
1278 | 0 | fn partial_store_u32s(self, slice: &mut [u32], values: Self::u32s) { |
1279 | | unsafe { |
1280 | 0 | self.mask_store_ptr_u32s( |
1281 | 0 | self.mask_between_m32s(0, slice.len() as u32), |
1282 | 0 | slice.as_mut_ptr(), |
1283 | 0 | values, |
1284 | | ) |
1285 | | } |
1286 | 0 | } |
1287 | | #[inline(always)] |
1288 | 0 | fn partial_store_u64s(self, slice: &mut [u64], values: Self::u64s) { |
1289 | | unsafe { |
1290 | 0 | self.mask_store_ptr_u64s( |
1291 | 0 | self.mask_between_m64s(0, slice.len() as u64), |
1292 | 0 | slice.as_mut_ptr(), |
1293 | 0 | values, |
1294 | | ) |
1295 | | } |
1296 | 0 | } |
1297 | | fn reduce_max_c32s(self, a: Self::c32s) -> c32; |
1298 | | fn reduce_max_c64s(self, a: Self::c64s) -> c64; |
1299 | | fn reduce_max_f32s(self, a: Self::f32s) -> f32; |
1300 | | fn reduce_max_f64s(self, a: Self::f64s) -> f64; |
1301 | | fn reduce_min_c32s(self, a: Self::c32s) -> c32; |
1302 | | fn reduce_min_c64s(self, a: Self::c64s) -> c64; |
1303 | | fn reduce_min_f32s(self, a: Self::f32s) -> f32; |
1304 | | fn reduce_min_f64s(self, a: Self::f64s) -> f64; |
1305 | | |
1306 | | fn reduce_product_f32s(self, a: Self::f32s) -> f32; |
1307 | | fn reduce_product_f64s(self, a: Self::f64s) -> f64; |
1308 | | fn reduce_sum_c32s(self, a: Self::c32s) -> c32; |
1309 | | fn reduce_sum_c64s(self, a: Self::c64s) -> c64; |
1310 | | |
1311 | | fn reduce_sum_f32s(self, a: Self::f32s) -> f32; |
1312 | | fn reduce_sum_f64s(self, a: Self::f64s) -> f64; |
1313 | | #[inline(always)] |
1314 | 0 | fn rotate_left_c32s(self, a: Self::c32s, amount: usize) -> Self::c32s { |
1315 | 0 | self.rotate_right_c32s(a, amount.wrapping_neg()) |
1316 | 0 | } |
1317 | | #[inline(always)] |
1318 | 0 | fn rotate_left_c64s(self, a: Self::c64s, amount: usize) -> Self::c64s { |
1319 | 0 | self.rotate_right_c64s(a, amount.wrapping_neg()) |
1320 | 0 | } |
1321 | | |
1322 | | #[inline(always)] |
1323 | 0 | fn rotate_left_f32s(self, a: Self::f32s, amount: usize) -> Self::f32s { |
1324 | 0 | cast(self.rotate_left_u32s(cast(a), amount)) |
1325 | 0 | } |
1326 | | #[inline(always)] |
1327 | 0 | fn rotate_left_f64s(self, a: Self::f64s, amount: usize) -> Self::f64s { |
1328 | 0 | cast(self.rotate_left_u64s(cast(a), amount)) |
1329 | 0 | } |
1330 | | #[inline(always)] |
1331 | 0 | fn rotate_left_i32s(self, a: Self::i32s, amount: usize) -> Self::i32s { |
1332 | 0 | cast(self.rotate_left_u32s(cast(a), amount)) |
1333 | 0 | } |
1334 | | |
1335 | | #[inline(always)] |
1336 | 0 | fn rotate_left_i64s(self, a: Self::i64s, amount: usize) -> Self::i64s { |
1337 | 0 | cast(self.rotate_left_u64s(cast(a), amount)) |
1338 | 0 | } |
1339 | | |
1340 | | #[inline(always)] |
1341 | 0 | fn rotate_left_u32s(self, a: Self::u32s, amount: usize) -> Self::u32s { |
1342 | 0 | self.rotate_right_u32s(a, amount.wrapping_neg()) |
1343 | 0 | } |
1344 | | #[inline(always)] |
1345 | 0 | fn rotate_left_u64s(self, a: Self::u64s, amount: usize) -> Self::u64s { |
1346 | 0 | self.rotate_right_u64s(a, amount.wrapping_neg()) |
1347 | 0 | } |
1348 | | fn rotate_right_c32s(self, a: Self::c32s, amount: usize) -> Self::c32s; |
1349 | | fn rotate_right_c64s(self, a: Self::c64s, amount: usize) -> Self::c64s; |
1350 | | #[inline(always)] |
1351 | 0 | fn rotate_right_f32s(self, a: Self::f32s, amount: usize) -> Self::f32s { |
1352 | 0 | cast(self.rotate_right_u32s(cast(a), amount)) |
1353 | 0 | } |
1354 | | #[inline(always)] |
1355 | 0 | fn rotate_right_f64s(self, a: Self::f64s, amount: usize) -> Self::f64s { |
1356 | 0 | cast(self.rotate_right_u64s(cast(a), amount)) |
1357 | 0 | } |
1358 | | #[inline(always)] |
1359 | 0 | fn rotate_right_i32s(self, a: Self::i32s, amount: usize) -> Self::i32s { |
1360 | 0 | cast(self.rotate_right_u32s(cast(a), amount)) |
1361 | 0 | } |
1362 | | #[inline(always)] |
1363 | 0 | fn rotate_right_i64s(self, a: Self::i64s, amount: usize) -> Self::i64s { |
1364 | 0 | cast(self.rotate_right_u64s(cast(a), amount)) |
1365 | 0 | } |
1366 | | fn rotate_right_u32s(self, a: Self::u32s, amount: usize) -> Self::u32s; |
1367 | | fn rotate_right_u64s(self, a: Self::u64s, amount: usize) -> Self::u64s; |
1368 | | |
1369 | | #[inline] |
1370 | 0 | fn select_f32s( |
1371 | 0 | self, |
1372 | 0 | mask: Self::m32s, |
1373 | 0 | if_true: Self::f32s, |
1374 | 0 | if_false: Self::f32s, |
1375 | 0 | ) -> Self::f32s { |
1376 | 0 | self.transmute_f32s_u32s(self.select_u32s( |
1377 | 0 | mask, |
1378 | 0 | self.transmute_u32s_f32s(if_true), |
1379 | 0 | self.transmute_u32s_f32s(if_false), |
1380 | | )) |
1381 | 0 | } |
1382 | | #[inline] |
1383 | 0 | fn select_f64s( |
1384 | 0 | self, |
1385 | 0 | mask: Self::m64s, |
1386 | 0 | if_true: Self::f64s, |
1387 | 0 | if_false: Self::f64s, |
1388 | 0 | ) -> Self::f64s { |
1389 | 0 | self.transmute_f64s_u64s(self.select_u64s( |
1390 | 0 | mask, |
1391 | 0 | self.transmute_u64s_f64s(if_true), |
1392 | 0 | self.transmute_u64s_f64s(if_false), |
1393 | | )) |
1394 | 0 | } |
1395 | | #[inline] |
1396 | 0 | fn select_i32s( |
1397 | 0 | self, |
1398 | 0 | mask: Self::m32s, |
1399 | 0 | if_true: Self::i32s, |
1400 | 0 | if_false: Self::i32s, |
1401 | 0 | ) -> Self::i32s { |
1402 | 0 | self.transmute_i32s_u32s(self.select_u32s( |
1403 | 0 | mask, |
1404 | 0 | self.transmute_u32s_i32s(if_true), |
1405 | 0 | self.transmute_u32s_i32s(if_false), |
1406 | | )) |
1407 | 0 | } |
1408 | | #[inline] |
1409 | 0 | fn select_i64s( |
1410 | 0 | self, |
1411 | 0 | mask: Self::m64s, |
1412 | 0 | if_true: Self::i64s, |
1413 | 0 | if_false: Self::i64s, |
1414 | 0 | ) -> Self::i64s { |
1415 | 0 | self.transmute_i64s_u64s(self.select_u64s( |
1416 | 0 | mask, |
1417 | 0 | self.transmute_u64s_i64s(if_true), |
1418 | 0 | self.transmute_u64s_i64s(if_false), |
1419 | | )) |
1420 | 0 | } |
1421 | | fn select_u32s(self, mask: Self::m32s, if_true: Self::u32s, if_false: Self::u32s) |
1422 | | -> Self::u32s; |
1423 | | fn select_u64s(self, mask: Self::m64s, if_true: Self::u64s, if_false: Self::u64s) |
1424 | | -> Self::u64s; |
1425 | | |
1426 | | fn swap_re_im_c32s(self, a: Self::c32s) -> Self::c32s; |
1427 | | fn swap_re_im_c64s(self, a: Self::c64s) -> Self::c64s; |
1428 | | |
1429 | | #[inline] |
1430 | 0 | fn transmute_f32s_i32s(self, a: Self::i32s) -> Self::f32s { |
1431 | 0 | cast(a) |
1432 | 0 | } |
1433 | | #[inline] |
1434 | 0 | fn transmute_f32s_u32s(self, a: Self::u32s) -> Self::f32s { |
1435 | 0 | cast(a) |
1436 | 0 | } |
1437 | | |
1438 | | #[inline] |
1439 | 0 | fn transmute_f64s_i64s(self, a: Self::i64s) -> Self::f64s { |
1440 | 0 | cast(a) |
1441 | 0 | } |
1442 | | #[inline] |
1443 | 0 | fn transmute_f64s_u64s(self, a: Self::u64s) -> Self::f64s { |
1444 | 0 | cast(a) |
1445 | 0 | } |
1446 | | #[inline] |
1447 | 0 | fn transmute_i32s_f32s(self, a: Self::f32s) -> Self::i32s { |
1448 | 0 | cast(a) |
1449 | 0 | } |
1450 | | #[inline] |
1451 | 0 | fn transmute_m8s_u8s(self, a: Self::u8s) -> Self::m8s { |
1452 | 0 | checked::cast(a) |
1453 | 0 | } |
1454 | | #[inline] |
1455 | 0 | fn transmute_u8s_m8s(self, a: Self::m8s) -> Self::u8s { |
1456 | 0 | cast(a) |
1457 | 0 | } |
1458 | | #[inline] |
1459 | 0 | fn transmute_m16s_u16s(self, a: Self::u16s) -> Self::m16s { |
1460 | 0 | checked::cast(a) |
1461 | 0 | } |
1462 | | #[inline] |
1463 | 0 | fn transmute_u16s_m16s(self, a: Self::m16s) -> Self::u16s { |
1464 | 0 | cast(a) |
1465 | 0 | } |
1466 | | #[inline] |
1467 | 0 | fn transmute_m32s_u32s(self, a: Self::u32s) -> Self::m32s { |
1468 | 0 | checked::cast(a) |
1469 | 0 | } |
1470 | | #[inline] |
1471 | 0 | fn transmute_u32s_m32s(self, a: Self::m32s) -> Self::u32s { |
1472 | 0 | cast(a) |
1473 | 0 | } |
1474 | | #[inline] |
1475 | 0 | fn transmute_m64s_u64s(self, a: Self::u64s) -> Self::m64s { |
1476 | 0 | checked::cast(a) |
1477 | 0 | } |
1478 | | #[inline] |
1479 | 0 | fn transmute_u64s_m64s(self, a: Self::m64s) -> Self::u64s { |
1480 | 0 | cast(a) |
1481 | 0 | } |
1482 | | #[inline] |
1483 | 0 | fn transmute_i8s_u8s(self, a: Self::u8s) -> Self::i8s { |
1484 | 0 | cast(a) |
1485 | 0 | } |
1486 | | #[inline] |
1487 | 0 | fn transmute_u8s_i8s(self, a: Self::i8s) -> Self::u8s { |
1488 | 0 | cast(a) |
1489 | 0 | } |
1490 | | #[inline] |
1491 | 0 | fn transmute_u16s_i16s(self, a: Self::i16s) -> Self::u16s { |
1492 | 0 | cast(a) |
1493 | 0 | } |
1494 | | #[inline] |
1495 | 0 | fn transmute_i16s_u16s(self, a: Self::u16s) -> Self::i16s { |
1496 | 0 | cast(a) |
1497 | 0 | } |
1498 | | #[inline] |
1499 | 0 | fn transmute_i32s_u32s(self, a: Self::u32s) -> Self::i32s { |
1500 | 0 | cast(a) |
1501 | 0 | } |
1502 | | #[inline] |
1503 | 0 | fn transmute_i64s_f64s(self, a: Self::f64s) -> Self::i64s { |
1504 | 0 | cast(a) |
1505 | 0 | } |
1506 | | #[inline] |
1507 | 0 | fn transmute_i64s_u64s(self, a: Self::u64s) -> Self::i64s { |
1508 | 0 | cast(a) |
1509 | 0 | } |
1510 | | |
1511 | | #[inline] |
1512 | 0 | fn transmute_u32s_f32s(self, a: Self::f32s) -> Self::u32s { |
1513 | 0 | cast(a) |
1514 | 0 | } |
1515 | | #[inline] |
1516 | 0 | fn transmute_u32s_i32s(self, a: Self::i32s) -> Self::u32s { |
1517 | 0 | cast(a) |
1518 | 0 | } |
1519 | | #[inline] |
1520 | 0 | fn transmute_u64s_f64s(self, a: Self::f64s) -> Self::u64s { |
1521 | 0 | cast(a) |
1522 | 0 | } |
1523 | | #[inline] |
1524 | 0 | fn transmute_u64s_i64s(self, a: Self::i64s) -> Self::u64s { |
1525 | 0 | cast(a) |
1526 | 0 | } |
1527 | | |
1528 | | fn vectorize<Op: WithSimd>(self, op: Op) -> Op::Output; |
1529 | | fn widening_mul_u32s(self, a: Self::u32s, b: Self::u32s) -> (Self::u32s, Self::u32s); |
1530 | | fn wrapping_dyn_shl_u32s(self, a: Self::u32s, amount: Self::u32s) -> Self::u32s; |
1531 | | fn wrapping_dyn_shr_u32s(self, a: Self::u32s, amount: Self::u32s) -> Self::u32s; |
1532 | | } |
1533 | | |
1534 | | pub trait PortableSimd: Simd {} |
1535 | | |
1536 | | impl PortableSimd for Scalar {} |
1537 | | impl PortableSimd for Scalar128b {} |
1538 | | impl PortableSimd for Scalar256b {} |
1539 | | impl PortableSimd for Scalar512b {} |
1540 | | |
1541 | | #[derive(Debug, Copy, Clone)] |
1542 | | pub struct Scalar; |
1543 | | |
1544 | | #[derive(Debug, Copy, Clone)] |
1545 | | pub struct Scalar128b; |
1546 | | #[derive(Debug, Copy, Clone)] |
1547 | | pub struct Scalar256b; |
1548 | | #[derive(Debug, Copy, Clone)] |
1549 | | pub struct Scalar512b; |
1550 | | |
1551 | | macro_rules! scalar_simd_binop_impl { |
1552 | | ($func: ident, $op: ident, $ty: ty) => { |
1553 | | paste! { |
1554 | | #[inline] |
1555 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>], b: Self::[<$ty s>],) -> Self::[<$ty s>] { |
1556 | 0 | let mut out = [<$ty as Default>::default(); Self::[<$ty:upper _LANES>]]; |
1557 | 0 | let a: [$ty; Self::[<$ty:upper _LANES>]] = cast(a); |
1558 | 0 | let b: [$ty; Self::[<$ty:upper _LANES>]] = cast(b); |
1559 | | |
1560 | 0 | for i in 0..Self::[<$ty:upper _LANES>] { |
1561 | 0 | out[i] = a[i].$op(b[i]); |
1562 | 0 | } |
1563 | | |
1564 | 0 | cast(out) |
1565 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::or_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::and_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::or_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::or_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::or_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::xor_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_c32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_c64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::add_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::and_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::and_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::and_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::div_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::div_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::max_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::min_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_c32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_c64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_c32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_c64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sub_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::xor_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::xor_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::xor_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::or_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::and_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::or_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::or_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::or_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::xor_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::add_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::and_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::and_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::and_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::div_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::div_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::max_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::min_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sub_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::xor_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::xor_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::xor_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::or_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::and_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::or_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::or_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::or_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::xor_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::add_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::and_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::and_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::and_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::div_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::div_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::max_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::min_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sub_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::xor_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::xor_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::xor_u64s |
1566 | | } |
1567 | | }; |
1568 | | } |
1569 | | |
1570 | | macro_rules! scalar_simd_binop { |
1571 | | ($func: ident, op $op: ident, $($ty: ty),*) => { |
1572 | | $(scalar_simd_binop_impl!($func, $op, $ty);)* |
1573 | | }; |
1574 | | ($func: ident, $($ty: ty),*) => { |
1575 | | $(scalar_simd_binop_impl!($func, $func, $ty);)* |
1576 | | }; |
1577 | | } |
1578 | | |
1579 | | macro_rules! scalar_simd_unop_impl { |
1580 | | ($func: ident, $op: ident, $ty: ty) => { |
1581 | | paste! { |
1582 | | #[inline] |
1583 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>]) -> Self::[<$ty s>] { |
1584 | 0 | let mut out = [<$ty as Default>::default(); Self::[<$ty:upper _LANES>]]; |
1585 | 0 | let a: [$ty; Self::[<$ty:upper _LANES>]] = cast(a); |
1586 | | |
1587 | 0 | for i in 0..Self::[<$ty:upper _LANES>] { |
1588 | 0 | out[i] = a[i].$op(); |
1589 | 0 | } |
1590 | | |
1591 | 0 | cast(out) |
1592 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_m8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_m16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_m32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_m64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::not_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_m8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_m16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_m32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_m64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::not_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_m8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_m16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_m32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_m64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::not_u64s |
1593 | | } |
1594 | | }; |
1595 | | } |
1596 | | |
1597 | | macro_rules! scalar_simd_unop { |
1598 | | ($func: ident, $($ty: ty),*) => { |
1599 | | $(scalar_simd_unop_impl!($func, $func, $ty);)* |
1600 | | }; |
1601 | | } |
1602 | | |
1603 | | macro_rules! scalar_simd_cmp { |
1604 | | ($func: ident, $op: ident, $ty: ty, $mask: ty) => { |
1605 | | paste! { |
1606 | | #[inline] |
1607 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>], b: Self::[<$ty s>]) -> Self::[<$mask s>] { |
1608 | 0 | let mut out = [$mask::new(false); Self::[<$ty:upper _LANES>]]; |
1609 | 0 | let a: [$ty; Self::[<$ty:upper _LANES>]] = cast(a); |
1610 | 0 | let b: [$ty; Self::[<$ty:upper _LANES>]] = cast(b); |
1611 | 0 | for i in 0..Self::[<$ty:upper _LANES>] { |
1612 | 0 | out[i] = $mask::new(a[i].$op(&b[i])); |
1613 | 0 | } |
1614 | 0 | cast(out) |
1615 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_c32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_c64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::less_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::greater_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::equal_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::less_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::greater_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::equal_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::less_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::greater_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::equal_u8s |
1616 | | } |
1617 | | }; |
1618 | | ($func: ident, op $op: ident, $($ty: ty => $mask: ty),*) => { |
1619 | | $(scalar_simd_cmp!($func, $op, $ty, $mask);)* |
1620 | | }; |
1621 | | ($func: ident, $($ty: ty => $mask: ty),*) => { |
1622 | | $(scalar_simd_cmp!($func, $func, $ty, $mask);)* |
1623 | | }; |
1624 | | } |
1625 | | |
1626 | | macro_rules! scalar_splat { |
1627 | | ($ty: ident) => { |
1628 | | paste! { |
1629 | | #[inline] |
1630 | 0 | fn [<splat_ $ty s>](self, value: $ty) -> Self::[<$ty s>] { |
1631 | 0 | cast([value; Self::[<$ty:upper _LANES>]]) |
1632 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_u64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_u8s |
1633 | | } |
1634 | | }; |
1635 | | ($($ty: ident),*) => { |
1636 | | $(scalar_splat!($ty);)* |
1637 | | }; |
1638 | | } |
1639 | | |
1640 | | macro_rules! scalar_partial_load { |
1641 | | ($ty: ident) => { |
1642 | | paste! { |
1643 | | #[inline] |
1644 | 0 | fn [<partial_load_ $ty s>](self, slice: &[$ty]) -> Self::[<$ty s>] { |
1645 | 0 | let mut values = [<$ty as Default>::default(); Self::[<$ty:upper _LANES>]]; |
1646 | 0 | for i in 0..Ord::min(values.len(), slice.len()) { |
1647 | 0 | values[i] = slice[i]; |
1648 | 0 | } |
1649 | 0 | cast(values) |
1650 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_load_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_load_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_load_u64s |
1651 | | } |
1652 | | }; |
1653 | | ($($ty: ident),*) => { |
1654 | | $(scalar_partial_load!($ty);)* |
1655 | | }; |
1656 | | } |
1657 | | |
1658 | | macro_rules! scalar_partial_store { |
1659 | | ($ty: ident) => { |
1660 | | paste! { |
1661 | | #[inline] |
1662 | 0 | fn [<partial_store_ $ty s>](self, slice: &mut [$ty], values: Self::[<$ty s>]) { |
1663 | 0 | let values: [$ty; Self::[<$ty:upper _LANES>]] = cast(values); |
1664 | 0 | for i in 0..Ord::min(values.len(), slice.len()) { |
1665 | 0 | slice[i] = values[i]; |
1666 | 0 | } |
1667 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_i64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::partial_store_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::partial_store_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::partial_store_u64s |
1668 | | } |
1669 | | }; |
1670 | | ($($ty: ident),*) => { |
1671 | | $(scalar_partial_store!($ty);)* |
1672 | | }; |
1673 | | } |
1674 | | |
1675 | | macro_rules! mask_load_ptr { |
1676 | | ($ty: ident, $mask: ident) => { |
1677 | | paste! { |
1678 | | #[inline] |
1679 | 0 | unsafe fn [<mask_load_ptr_ $ty s>]( |
1680 | 0 | self, |
1681 | 0 | mask: MemMask<Self::[<$mask s>]>, |
1682 | 0 | ptr: *const $ty, |
1683 | 0 | ) -> Self::[<$ty s>] { |
1684 | 0 | let mut values = [<$ty as Default>::default(); Self::[<$ty:upper _LANES>]]; |
1685 | 0 | let mask: [$mask; Self::[<$ty:upper _LANES>]] = cast(mask.mask()); |
1686 | 0 | for i in 0..Self::[<$ty:upper _LANES>] { |
1687 | 0 | if mask[i].is_set() { |
1688 | 0 | values[i] = *ptr.add(i); |
1689 | 0 | } |
1690 | | } |
1691 | 0 | cast(values) |
1692 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_u64s |
1693 | | } |
1694 | | }; |
1695 | | (cast $ty: ident, $to: ident, $mask: ident) => { |
1696 | | paste! { |
1697 | | #[inline] |
1698 | 0 | unsafe fn [<mask_load_ptr_ $ty s>]( |
1699 | 0 | self, |
1700 | 0 | mask: MemMask<Self::[<$mask s>]>, |
1701 | 0 | ptr: *const $ty, |
1702 | 0 | ) -> Self::[<$ty s>] { |
1703 | 0 | cast(self.[<mask_load_ptr_ $to s>](mask, ptr as *const $to)) |
1704 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_c32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_c64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_load_ptr_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_load_ptr_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_load_ptr_i64s |
1705 | | } |
1706 | | }; |
1707 | | ($($ty: ident: $mask: ident),*) => { |
1708 | | $(mask_load_ptr!($ty, $mask);)* |
1709 | | }; |
1710 | | (cast $($ty: ident: $mask: ident => $to: ident),*) => { |
1711 | | $(mask_load_ptr!(cast $ty, $to, $mask);)* |
1712 | | }; |
1713 | | } |
1714 | | |
1715 | | macro_rules! mask_store_ptr { |
1716 | | ($ty: ident, $mask: ident) => { |
1717 | | paste! { |
1718 | | #[inline] |
1719 | 0 | unsafe fn [<mask_store_ptr_ $ty s>]( |
1720 | 0 | self, |
1721 | 0 | mask: MemMask<Self::[<$mask s>]>, |
1722 | 0 | ptr: *mut $ty, |
1723 | 0 | values: Self::[<$ty s>], |
1724 | 0 | ) { |
1725 | 0 | let mask: [$mask; Self::[<$ty:upper _LANES>]] = cast(mask.mask()); |
1726 | 0 | let values: [$ty; Self::[<$ty:upper _LANES>]] = cast(values); |
1727 | 0 | for i in 0..Self::[<$ty:upper _LANES>] { |
1728 | 0 | if mask[i].is_set() { |
1729 | 0 | *ptr.add(i) = values[i]; |
1730 | 0 | } |
1731 | | } |
1732 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_u8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_u16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_u32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_u8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_u16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_u8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_u16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_u64s |
1733 | | } |
1734 | | }; |
1735 | | (cast $ty: ident, $to: ident, $mask: ident) => { |
1736 | | paste! { |
1737 | | #[inline] |
1738 | 0 | unsafe fn [<mask_store_ptr_ $ty s>]( |
1739 | 0 | self, |
1740 | 0 | mask: MemMask<Self::[<$mask s>]>, |
1741 | 0 | ptr: *mut $ty, |
1742 | 0 | values: Self::[<$ty s>], |
1743 | 0 | ) { |
1744 | 0 | self.[<mask_store_ptr_ $to s>](mask, ptr as *mut $to, cast(values)); |
1745 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_i8s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_c32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_c64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_f32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_f64s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_i16s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_i32s Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mask_store_ptr_i64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_i8s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_i16s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_i32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mask_store_ptr_i64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_i8s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_i16s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_i32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mask_store_ptr_i64s |
1746 | | } |
1747 | | }; |
1748 | | ($($ty: ident: $mask: ident),*) => { |
1749 | | $(mask_store_ptr!($ty, $mask);)* |
1750 | | }; |
1751 | | (cast $($ty: ident: $mask: ident => $to: ident),*) => { |
1752 | | $(mask_store_ptr!(cast $ty, $to, $mask);)* |
1753 | | }; |
1754 | | } |
1755 | | |
1756 | | macro_rules! scalar_simd { |
1757 | | ($ty: ty, $register_count: expr, $m8s: ty, $i8s: ty, $u8s: ty, $m16s: ty, $i16s: ty, $u16s: ty, $m32s: ty, $f32s: ty, $i32s: ty, $u32s: ty, $m64s: ty, $f64s: ty, $i64s: ty, $u64s: ty $(,)?) => { |
1758 | | impl Seal for $ty {} |
1759 | | impl Simd for $ty { |
1760 | | type m8s = $m8s; |
1761 | | type m16s = $m16s; |
1762 | | type c32s = $f32s; |
1763 | | type c64s = $f64s; |
1764 | | type f32s = $f32s; |
1765 | | type f64s = $f64s; |
1766 | | type i16s = $i16s; |
1767 | | type i32s = $i32s; |
1768 | | type i64s = $i64s; |
1769 | | type i8s = $i8s; |
1770 | | type m32s = $m32s; |
1771 | | type m64s = $m64s; |
1772 | | type u16s = $u16s; |
1773 | | type u32s = $u32s; |
1774 | | type u64s = $u64s; |
1775 | | type u8s = $u8s; |
1776 | | |
1777 | | const REGISTER_COUNT: usize = $register_count; |
1778 | | |
1779 | | scalar_simd_binop!(min, u8, i8, u16, i16, u32, i32, u64, i64, f32, f64); |
1780 | | |
1781 | | scalar_simd_binop!(max, u8, i8, u16, i16, u32, i32, u64, i64, f32, f64); |
1782 | | |
1783 | | scalar_simd_binop!(add, c32, f32, c64, f64); |
1784 | | scalar_simd_binop!(add, op wrapping_add, u8, i8, u16, i16, u32, i32, u64, i64); |
1785 | | scalar_simd_binop!(sub, c32, f32, c64, f64); |
1786 | | scalar_simd_binop!(sub, op wrapping_sub, u8, i8, u16, i16, u32, i32, u64, i64); |
1787 | | scalar_simd_binop!(mul, c32, f32, c64, f64); |
1788 | | scalar_simd_binop!(mul, op wrapping_mul, u16, i16, u32, i32, u64, i64); |
1789 | | scalar_simd_binop!(div, f32, f64); |
1790 | | |
1791 | | scalar_simd_binop!(and, op bitand, u8, u16, u32, u64); |
1792 | | scalar_simd_binop!(or, op bitor, u8, u16, u32, u64); |
1793 | | scalar_simd_binop!(xor, op bitxor, u8, u16, u32, u64); |
1794 | | |
1795 | | scalar_simd_cmp!(equal, op eq, u8 => m8, u16 => m16, u32 => m32, u64 => m64, c32 => m32, f32 => m32, c64 => m64, f64 => m64); |
1796 | | scalar_simd_cmp!(greater_than, op gt, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
1797 | | scalar_simd_cmp!(greater_than_or_equal, op ge, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
1798 | | scalar_simd_cmp!(less_than_or_equal, op le, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
1799 | | scalar_simd_cmp!(less_than, op lt, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
1800 | | |
1801 | | scalar_simd_unop!(not, m8, u8, m16, u16, m32, u32, m64, u64); |
1802 | | |
1803 | | scalar_splat!(u8, i8, u16, i16, u32, i32, u64, i64, f32, f64); |
1804 | | |
1805 | | scalar_partial_load!(u8, i8, u16, i16, u32, i32, u64, i64, f32, f64); |
1806 | | scalar_partial_store!(u8, i8, u16, i16, u32, i32, u64, i64, f32, f64); |
1807 | | |
1808 | | mask_load_ptr!(u8: m8, u16: m16, u32: m32, u64: m64); |
1809 | | mask_load_ptr!(cast i8: m8 => u8, i16: m16 => u16, i32: m32 => u32, i64: m64 => u64, c32: m32 => u32, f32: m32 => u32, c64: m64 => u64, f64: m64 => u64); |
1810 | | mask_store_ptr!(u8: m8, u16: m16, u32: m32, u64: m64); |
1811 | | mask_store_ptr!(cast i8: m8 => u8, i16: m16 => u16, i32: m32 => u32, i64: m64 => u64, c32: m32 => u32, f32: m32 => u32, c64: m64 => u64, f64: m64 => u64); |
1812 | | |
1813 | | #[inline] |
1814 | 0 | fn vectorize<Op: WithSimd>(self, op: Op) -> Op::Output { |
1815 | 0 | op.with_simd(self) |
1816 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::vectorize::<_> Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::vectorize::<_> Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::vectorize::<_> |
1817 | | |
1818 | | #[inline] |
1819 | 0 | fn and_m32s(self, a: Self::m32s, b: Self::m32s) -> Self::m32s { |
1820 | 0 | let mut out = [m32::new(false); Self::F32_LANES]; |
1821 | 0 | let a: [m32; Self::F32_LANES] = cast(a); |
1822 | 0 | let b: [m32; Self::F32_LANES] = cast(b); |
1823 | 0 | for i in 0..Self::F32_LANES { |
1824 | 0 | out[i] = a[i] & b[i]; |
1825 | 0 | } |
1826 | 0 | cast(out) |
1827 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::and_m32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::and_m32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::and_m32s |
1828 | | |
1829 | | #[inline] |
1830 | 0 | fn or_m32s(self, a: Self::m32s, b: Self::m32s) -> Self::m32s { |
1831 | 0 | let mut out = [m32::new(false); Self::F32_LANES]; |
1832 | 0 | let a: [m32; Self::F32_LANES] = cast(a); |
1833 | 0 | let b: [m32; Self::F32_LANES] = cast(b); |
1834 | 0 | for i in 0..Self::F32_LANES { |
1835 | 0 | out[i] = a[i] | b[i]; |
1836 | 0 | } |
1837 | 0 | cast(out) |
1838 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::or_m32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::or_m32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::or_m32s |
1839 | | |
1840 | | #[inline] |
1841 | 0 | fn xor_m32s(self, a: Self::m32s, b: Self::m32s) -> Self::m32s { |
1842 | 0 | let mut out = [m32::new(false); Self::F32_LANES]; |
1843 | 0 | let a: [m32; Self::F32_LANES] = cast(a); |
1844 | 0 | let b: [m32; Self::F32_LANES] = cast(b); |
1845 | 0 | for i in 0..Self::F32_LANES { |
1846 | 0 | out[i] = a[i] ^ b[i]; |
1847 | 0 | } |
1848 | 0 | cast(out) |
1849 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::xor_m32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::xor_m32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::xor_m32s |
1850 | | |
1851 | | #[inline] |
1852 | 0 | fn and_m64s(self, a: Self::m64s, b: Self::m64s) -> Self::m64s { |
1853 | 0 | let mut out = [m64::new(false); Self::F64_LANES]; |
1854 | 0 | let a: [m64; Self::F64_LANES] = cast(a); |
1855 | 0 | let b: [m64; Self::F64_LANES] = cast(b); |
1856 | 0 | for i in 0..Self::F64_LANES { |
1857 | 0 | out[i] = a[i] & b[i]; |
1858 | 0 | } |
1859 | 0 | cast(out) |
1860 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::and_m64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::and_m64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::and_m64s |
1861 | | |
1862 | | #[inline] |
1863 | 0 | fn or_m64s(self, a: Self::m64s, b: Self::m64s) -> Self::m64s { |
1864 | 0 | let mut out = [m64::new(false); Self::F64_LANES]; |
1865 | 0 | let a: [m64; Self::F64_LANES] = cast(a); |
1866 | 0 | let b: [m64; Self::F64_LANES] = cast(b); |
1867 | 0 | for i in 0..Self::F64_LANES { |
1868 | 0 | out[i] = a[i] | b[i]; |
1869 | 0 | } |
1870 | 0 | cast(out) |
1871 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::or_m64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::or_m64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::or_m64s |
1872 | | |
1873 | | #[inline] |
1874 | 0 | fn xor_m64s(self, a: Self::m64s, b: Self::m64s) -> Self::m64s { |
1875 | 0 | let mut out = [m64::new(false); Self::F64_LANES]; |
1876 | 0 | let a: [m64; Self::F64_LANES] = cast(a); |
1877 | 0 | let b: [m64; Self::F64_LANES] = cast(b); |
1878 | 0 | for i in 0..Self::F64_LANES { |
1879 | 0 | out[i] = a[i] ^ b[i]; |
1880 | 0 | } |
1881 | 0 | cast(out) |
1882 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::xor_m64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::xor_m64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::xor_m64s |
1883 | | |
1884 | | #[inline] |
1885 | 0 | fn select_u32s( |
1886 | 0 | self, |
1887 | 0 | mask: Self::m32s, |
1888 | 0 | if_true: Self::u32s, |
1889 | 0 | if_false: Self::u32s, |
1890 | 0 | ) -> Self::u32s { |
1891 | 0 | let mut out = [0u32; Self::F32_LANES]; |
1892 | 0 | let mask: [m32; Self::F32_LANES] = cast(mask); |
1893 | 0 | let if_true: [u32; Self::F32_LANES] = cast(if_true); |
1894 | 0 | let if_false: [u32; Self::F32_LANES] = cast(if_false); |
1895 | | |
1896 | 0 | for i in 0..Self::F32_LANES { |
1897 | 0 | out[i] = if mask[i].is_set() { |
1898 | 0 | if_true[i] |
1899 | | } else { |
1900 | 0 | if_false[i] |
1901 | | }; |
1902 | | } |
1903 | | |
1904 | 0 | cast(out) |
1905 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::select_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::select_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::select_u32s |
1906 | | |
1907 | | #[inline] |
1908 | 0 | fn select_u64s( |
1909 | 0 | self, |
1910 | 0 | mask: Self::m64s, |
1911 | 0 | if_true: Self::u64s, |
1912 | 0 | if_false: Self::u64s, |
1913 | 0 | ) -> Self::u64s { |
1914 | 0 | let mut out = [0u64; Self::F64_LANES]; |
1915 | 0 | let mask: [m64; Self::F64_LANES] = cast(mask); |
1916 | 0 | let if_true: [u64; Self::F64_LANES] = cast(if_true); |
1917 | 0 | let if_false: [u64; Self::F64_LANES] = cast(if_false); |
1918 | | |
1919 | 0 | for i in 0..Self::F64_LANES { |
1920 | 0 | out[i] = if mask[i].is_set() { |
1921 | 0 | if_true[i] |
1922 | | } else { |
1923 | 0 | if_false[i] |
1924 | | }; |
1925 | | } |
1926 | | |
1927 | 0 | cast(out) |
1928 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::select_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::select_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::select_u64s |
1929 | | |
1930 | | #[inline] |
1931 | 0 | fn wrapping_dyn_shl_u32s(self, a: Self::u32s, amount: Self::u32s) -> Self::u32s { |
1932 | 0 | let mut out = [0u32; Self::F32_LANES]; |
1933 | 0 | let a: [u32; Self::F32_LANES] = cast(a); |
1934 | 0 | let b: [u32; Self::F32_LANES] = cast(amount); |
1935 | 0 | for i in 0..Self::F32_LANES { |
1936 | 0 | out[i] = a[i].wrapping_shl(b[i]); |
1937 | 0 | } |
1938 | 0 | cast(out) |
1939 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::wrapping_dyn_shl_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::wrapping_dyn_shl_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::wrapping_dyn_shl_u32s |
1940 | | |
1941 | | #[inline] |
1942 | 0 | fn wrapping_dyn_shr_u32s(self, a: Self::u32s, amount: Self::u32s) -> Self::u32s { |
1943 | 0 | let mut out = [0u32; Self::F32_LANES]; |
1944 | 0 | let a: [u32; Self::F32_LANES] = cast(a); |
1945 | 0 | let b: [u32; Self::F32_LANES] = cast(amount); |
1946 | 0 | for i in 0..Self::F32_LANES { |
1947 | 0 | out[i] = a[i].wrapping_shr(b[i]); |
1948 | 0 | } |
1949 | 0 | cast(out) |
1950 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::wrapping_dyn_shr_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::wrapping_dyn_shr_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::wrapping_dyn_shr_u32s |
1951 | | |
1952 | | #[inline] |
1953 | 0 | fn widening_mul_u32s(self, a: Self::u32s, b: Self::u32s) -> (Self::u32s, Self::u32s) { |
1954 | 0 | let mut lo = [0u32; Self::F32_LANES]; |
1955 | 0 | let mut hi = [0u32; Self::F32_LANES]; |
1956 | 0 | let a: [u32; Self::F32_LANES] = cast(a); |
1957 | 0 | let b: [u32; Self::F32_LANES] = cast(b); |
1958 | 0 | for i in 0..Self::F32_LANES { |
1959 | 0 | let m = a[i] as u64 * b[i] as u64; |
1960 | 0 |
|
1961 | 0 | (lo[i], hi[i]) = (m as u32, (m >> 32) as u32); |
1962 | 0 | } |
1963 | 0 | (cast(lo), cast(hi)) |
1964 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::widening_mul_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::widening_mul_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::widening_mul_u32s |
1965 | | |
1966 | | #[inline] |
1967 | 0 | fn mul_add_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
1968 | 0 | let mut out = [0.0f32; Self::F32_LANES]; |
1969 | 0 | let a: [f32; Self::F32_LANES] = cast(a); |
1970 | 0 | let b: [f32; Self::F32_LANES] = cast(b); |
1971 | 0 | let c: [f32; Self::F32_LANES] = cast(c); |
1972 | | |
1973 | 0 | for i in 0..Self::F32_LANES { |
1974 | 0 | out[i] = fma_f32(a[i], b[i], c[i]); |
1975 | 0 | } |
1976 | | |
1977 | 0 | cast(out) |
1978 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_add_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_add_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_add_f32s |
1979 | | |
1980 | | #[inline] |
1981 | 0 | fn negate_mul_add_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
1982 | 0 | let mut out = [0.0f32; Self::F32_LANES]; |
1983 | | |
1984 | 0 | let a: [f32; Self::F32_LANES] = cast(a); |
1985 | 0 | let b: [f32; Self::F32_LANES] = cast(b); |
1986 | 0 | let c: [f32; Self::F32_LANES] = cast(c); |
1987 | | |
1988 | 0 | for i in 0..Self::F32_LANES { |
1989 | 0 | out[i] = fma_f32(-a[i], b[i], c[i]); |
1990 | 0 | } |
1991 | | |
1992 | 0 | cast(out) |
1993 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::negate_mul_add_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::negate_mul_add_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::negate_mul_add_f32s |
1994 | | |
1995 | | #[inline] |
1996 | 0 | fn reduce_sum_f32s(self, a: Self::f32s) -> f32 { |
1997 | 0 | let mut a: [f32; Self::F32_LANES] = cast(a); |
1998 | | |
1999 | 0 | let mut n = Self::F32_LANES; |
2000 | 0 | while n > 1 { |
2001 | 0 | n /= 2; |
2002 | 0 | for i in 0..n { |
2003 | 0 | a[i] += a[i + n]; |
2004 | 0 | } |
2005 | | } |
2006 | | |
2007 | 0 | a[0] |
2008 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_sum_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_sum_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_sum_f32s |
2009 | | |
2010 | | #[inline] |
2011 | 0 | fn reduce_product_f32s(self, a: Self::f32s) -> f32 { |
2012 | 0 | let mut a: [f32; Self::F32_LANES] = cast(a); |
2013 | | |
2014 | 0 | let mut n = Self::F32_LANES; |
2015 | 0 | while n > 1 { |
2016 | 0 | n /= 2; |
2017 | 0 | for i in 0..n { |
2018 | 0 | a[i] *= a[i + n]; |
2019 | 0 | } |
2020 | | } |
2021 | | |
2022 | 0 | a[0] |
2023 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_product_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_product_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_product_f32s |
2024 | | |
2025 | | #[inline] |
2026 | 0 | fn reduce_min_f32s(self, a: Self::f32s) -> f32 { |
2027 | 0 | let mut a: [f32; Self::F32_LANES] = cast(a); |
2028 | | |
2029 | 0 | let mut n = Self::F32_LANES; |
2030 | 0 | while n > 1 { |
2031 | 0 | n /= 2; |
2032 | 0 | for i in 0..n { |
2033 | 0 | a[i] = f32::min(a[i], a[i + n]); |
2034 | 0 | } |
2035 | | } |
2036 | | |
2037 | 0 | a[0] |
2038 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_min_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_min_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_min_f32s |
2039 | | |
2040 | | #[inline] |
2041 | 0 | fn reduce_max_f32s(self, a: Self::f32s) -> f32 { |
2042 | 0 | let mut a: [f32; Self::F32_LANES] = cast(a); |
2043 | | |
2044 | 0 | let mut n = Self::F32_LANES; |
2045 | 0 | while n > 1 { |
2046 | 0 | n /= 2; |
2047 | 0 | for i in 0..n { |
2048 | 0 | a[i] = f32::max(a[i], a[i + n]); |
2049 | 0 | } |
2050 | | } |
2051 | | |
2052 | 0 | a[0] |
2053 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_max_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_max_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_max_f32s |
2054 | | |
2055 | | #[inline] |
2056 | 0 | fn splat_c32s(self, value: c32) -> Self::c32s { |
2057 | 0 | cast([value; Self::C32_LANES]) |
2058 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_c32s |
2059 | | |
2060 | | #[inline] |
2061 | 0 | fn conj_c32s(self, a: Self::c32s) -> Self::c32s { |
2062 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2063 | 0 | let a: [c32; Self::C32_LANES] = cast(a); |
2064 | | |
2065 | 0 | for i in 0..Self::C32_LANES { |
2066 | 0 | out[i] = c32::new(a[i].re, -a[i].im); |
2067 | 0 | } |
2068 | | |
2069 | 0 | cast(out) |
2070 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::conj_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::conj_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::conj_c32s |
2071 | | |
2072 | | #[inline] |
2073 | 0 | fn neg_c32s(self, a: Self::c32s) -> Self::c32s { |
2074 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2075 | 0 | let a: [c32; Self::C32_LANES] = cast(a); |
2076 | | |
2077 | 0 | for i in 0..Self::C32_LANES { |
2078 | 0 | out[i] = c32::new(-a[i].re, -a[i].im); |
2079 | 0 | } |
2080 | | |
2081 | 0 | cast(out) |
2082 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::neg_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::neg_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::neg_c32s |
2083 | | |
2084 | | #[inline] |
2085 | 0 | fn swap_re_im_c32s(self, a: Self::c32s) -> Self::c32s { |
2086 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2087 | 0 | let a: [c32; Self::C32_LANES] = cast(a); |
2088 | | |
2089 | 0 | for i in 0..Self::C32_LANES { |
2090 | 0 | out[i] = c32::new(a[i].im, a[i].re); |
2091 | 0 | } |
2092 | | |
2093 | 0 | cast(out) |
2094 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::swap_re_im_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::swap_re_im_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::swap_re_im_c32s |
2095 | | |
2096 | | #[inline] |
2097 | 0 | fn conj_mul_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s { |
2098 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2099 | 0 | let a: [c32; Self::C32_LANES] = cast(a); |
2100 | 0 | let b: [c32; Self::C32_LANES] = cast(b); |
2101 | | |
2102 | 0 | for i in 0..Self::C32_LANES { |
2103 | 0 | out[i].re = fma_f32(a[i].re, b[i].re, a[i].im * b[i].im); |
2104 | 0 | out[i].im = fma_f32(a[i].re, b[i].im, -(a[i].im * b[i].re)); |
2105 | 0 | } |
2106 | | |
2107 | 0 | cast(out) |
2108 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::conj_mul_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::conj_mul_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::conj_mul_c32s |
2109 | | |
2110 | | #[inline] |
2111 | 0 | fn mul_add_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
2112 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2113 | 0 | let a: [c32; Self::C32_LANES] = cast(a); |
2114 | 0 | let b: [c32; Self::C32_LANES] = cast(b); |
2115 | 0 | let c: [c32; Self::C32_LANES] = cast(c); |
2116 | | |
2117 | 0 | for i in 0..Self::C32_LANES { |
2118 | 0 | out[i].re = fma_f32(a[i].re, b[i].re, -fma_f32(a[i].im, b[i].im, -c[i].re)); |
2119 | 0 | out[i].im = fma_f32(a[i].re, b[i].im, fma_f32(a[i].im, b[i].re, c[i].im)); |
2120 | 0 | } |
2121 | | |
2122 | 0 | cast(out) |
2123 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_add_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_add_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_add_c32s |
2124 | | |
2125 | | #[inline] |
2126 | 0 | fn conj_mul_add_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
2127 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2128 | 0 | let a: [c32; Self::C32_LANES] = cast(a); |
2129 | 0 | let b: [c32; Self::C32_LANES] = cast(b); |
2130 | 0 | let c: [c32; Self::C32_LANES] = cast(c); |
2131 | | |
2132 | 0 | for i in 0..Self::C32_LANES { |
2133 | 0 | out[i].re = fma_f32(a[i].re, b[i].re, fma_f32(a[i].im, b[i].im, c[i].re)); |
2134 | 0 | out[i].im = fma_f32(a[i].re, b[i].im, -fma_f32(a[i].im, b[i].re, -c[i].im)); |
2135 | 0 | } |
2136 | | |
2137 | 0 | cast(out) |
2138 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::conj_mul_add_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::conj_mul_add_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::conj_mul_add_c32s |
2139 | | |
2140 | | #[inline] |
2141 | 0 | fn abs2_c32s(self, a: Self::c32s) -> Self::c32s { |
2142 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2143 | 0 | let a: [c32; Self::C32_LANES] = cast(a); |
2144 | | |
2145 | 0 | for i in 0..Self::C32_LANES { |
2146 | 0 | let x = a[i].re * a[i].re + a[i].im * a[i].im; |
2147 | 0 | out[i].re = x; |
2148 | 0 | out[i].im = x; |
2149 | 0 | } |
2150 | | |
2151 | 0 | cast(out) |
2152 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::abs2_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::abs2_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::abs2_c32s |
2153 | | |
2154 | | #[inline] |
2155 | 0 | fn abs_max_c32s(self, a: Self::c32s) -> Self::c32s { |
2156 | 0 | let mut out = [c32::ZERO; Self::C32_LANES]; |
2157 | 0 | let a: [c32; Self::C32_LANES] = cast(self.abs_f32s(a)); |
2158 | | |
2159 | 0 | for i in 0..Self::C32_LANES { |
2160 | 0 | let x = f32::max(a[i].re, a[i].im); |
2161 | 0 | out[i].re = x; |
2162 | 0 | out[i].im = x; |
2163 | 0 | } |
2164 | | |
2165 | 0 | cast(out) |
2166 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::abs_max_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::abs_max_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::abs_max_c32s |
2167 | | |
2168 | | #[inline] |
2169 | 0 | fn reduce_sum_c32s(self, a: Self::c32s) -> c32 { |
2170 | 0 | let mut a: [c32; Self::C32_LANES] = cast(a); |
2171 | | |
2172 | 0 | let mut n = Self::C32_LANES; |
2173 | 0 | while n > 1 { |
2174 | 0 | n /= 2; |
2175 | 0 | for i in 0..n { |
2176 | 0 | a[i].re += a[i + n].re; |
2177 | 0 | a[i].im += a[i + n].im; |
2178 | 0 | } |
2179 | | } |
2180 | | |
2181 | 0 | a[0] |
2182 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_sum_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_sum_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_sum_c32s |
2183 | | |
2184 | | #[inline] |
2185 | 0 | fn reduce_min_c32s(self, a: Self::c32s) -> c32 { |
2186 | 0 | let mut a: [c32; Self::C32_LANES] = cast(a); |
2187 | | |
2188 | 0 | let mut n = Self::C32_LANES; |
2189 | 0 | while n > 1 { |
2190 | 0 | n /= 2; |
2191 | 0 | for i in 0..n { |
2192 | 0 | a[i].re = f32::min(a[i].re, a[i + n].re); |
2193 | 0 | a[i].im = f32::min(a[i].im, a[i + n].im); |
2194 | 0 | } |
2195 | | } |
2196 | | |
2197 | 0 | a[0] |
2198 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_min_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_min_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_min_c32s |
2199 | | |
2200 | | #[inline] |
2201 | 0 | fn reduce_max_c32s(self, a: Self::c32s) -> c32 { |
2202 | 0 | let mut a: [c32; Self::C32_LANES] = cast(a); |
2203 | | |
2204 | 0 | let mut n = Self::C32_LANES; |
2205 | 0 | while n > 1 { |
2206 | 0 | n /= 2; |
2207 | 0 | for i in 0..n { |
2208 | 0 | a[i].re = f32::max(a[i].re, a[i + n].re); |
2209 | 0 | a[i].im = f32::max(a[i].im, a[i + n].im); |
2210 | 0 | } |
2211 | | } |
2212 | | |
2213 | 0 | a[0] |
2214 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_max_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_max_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_max_c32s |
2215 | | |
2216 | | #[inline] |
2217 | 0 | fn rotate_right_u32s(self, a: Self::u32s, amount: usize) -> Self::u32s { |
2218 | 0 | let mut a: [u32; Self::F32_LANES] = cast(a); |
2219 | 0 | let amount = amount % Self::F32_LANES; |
2220 | 0 | a.rotate_right(amount); |
2221 | 0 | cast(a) |
2222 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::rotate_right_u32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::rotate_right_u32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::rotate_right_u32s |
2223 | | |
2224 | | #[inline] |
2225 | 0 | fn rotate_right_c32s(self, a: Self::c32s, amount: usize) -> Self::c32s { |
2226 | 0 | let mut a: [c32; Self::C32_LANES] = cast(a); |
2227 | 0 | let amount = amount % Self::C32_LANES; |
2228 | 0 | a.rotate_right(amount); |
2229 | 0 | cast(a) |
2230 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::rotate_right_c32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::rotate_right_c32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::rotate_right_c32s |
2231 | | |
2232 | | #[inline] |
2233 | 0 | fn mul_add_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2234 | 0 | let mut out = [0.0f64; Self::F64_LANES]; |
2235 | 0 | let a: [f64; Self::F64_LANES] = cast(a); |
2236 | 0 | let b: [f64; Self::F64_LANES] = cast(b); |
2237 | 0 | let c: [f64; Self::F64_LANES] = cast(c); |
2238 | | |
2239 | 0 | for i in 0..Self::F64_LANES { |
2240 | 0 | out[i] = fma_f64(a[i], b[i], c[i]); |
2241 | 0 | } |
2242 | | |
2243 | 0 | cast(out) |
2244 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_add_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_add_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_add_f64s |
2245 | | |
2246 | | #[inline] |
2247 | 0 | fn negate_mul_add_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2248 | 0 | let mut out = [0.0f64; Self::F64_LANES]; |
2249 | 0 | let a: [f64; Self::F64_LANES] = cast(a); |
2250 | 0 | let b: [f64; Self::F64_LANES] = cast(b); |
2251 | 0 | let c: [f64; Self::F64_LANES] = cast(c); |
2252 | | |
2253 | 0 | for i in 0..Self::F64_LANES { |
2254 | 0 | out[i] = fma_f64(-a[i], b[i], c[i]); |
2255 | 0 | } |
2256 | | |
2257 | 0 | cast(out) |
2258 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::negate_mul_add_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::negate_mul_add_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::negate_mul_add_f64s |
2259 | | |
2260 | | #[inline] |
2261 | 0 | fn reduce_sum_f64s(self, a: Self::f64s) -> f64 { |
2262 | 0 | let mut a: [f64; Self::F64_LANES] = cast(a); |
2263 | | |
2264 | 0 | let mut n = Self::F64_LANES; |
2265 | 0 | while n > 1 { |
2266 | 0 | n /= 2; |
2267 | 0 | for i in 0..n { |
2268 | 0 | a[i] += a[i + n]; |
2269 | 0 | } |
2270 | | } |
2271 | | |
2272 | 0 | a[0] |
2273 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_sum_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_sum_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_sum_f64s |
2274 | | |
2275 | | #[inline] |
2276 | 0 | fn reduce_product_f64s(self, a: Self::f64s) -> f64 { |
2277 | 0 | let mut a: [f64; Self::F64_LANES] = cast(a); |
2278 | | |
2279 | 0 | let mut n = Self::F64_LANES; |
2280 | 0 | while n > 1 { |
2281 | 0 | n /= 2; |
2282 | 0 | for i in 0..n { |
2283 | 0 | a[i] *= a[i + n]; |
2284 | 0 | } |
2285 | | } |
2286 | | |
2287 | 0 | a[0] |
2288 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_product_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_product_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_product_f64s |
2289 | | |
2290 | | #[inline] |
2291 | 0 | fn reduce_min_f64s(self, a: Self::f64s) -> f64 { |
2292 | 0 | let mut a: [f64; Self::F64_LANES] = cast(a); |
2293 | | |
2294 | 0 | let mut n = Self::F64_LANES; |
2295 | 0 | while n > 1 { |
2296 | 0 | n /= 2; |
2297 | 0 | for i in 0..n { |
2298 | 0 | a[i] = f64::min(a[i], a[i + n]); |
2299 | 0 | } |
2300 | | } |
2301 | | |
2302 | 0 | a[0] |
2303 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_min_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_min_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_min_f64s |
2304 | | |
2305 | | #[inline] |
2306 | 0 | fn reduce_max_f64s(self, a: Self::f64s) -> f64 { |
2307 | 0 | let mut a: [f64; Self::F64_LANES] = cast(a); |
2308 | | |
2309 | 0 | let mut n = Self::F64_LANES; |
2310 | 0 | while n > 1 { |
2311 | 0 | n /= 2; |
2312 | 0 | for i in 0..n { |
2313 | 0 | a[i] = f64::max(a[i], a[i + n]); |
2314 | 0 | } |
2315 | | } |
2316 | | |
2317 | 0 | a[0] |
2318 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_max_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_max_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_max_f64s |
2319 | | |
2320 | | #[inline] |
2321 | 0 | fn splat_c64s(self, value: c64) -> Self::c64s { |
2322 | 0 | cast([value; Self::C64_LANES]) |
2323 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::splat_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::splat_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::splat_c64s |
2324 | | |
2325 | | #[inline] |
2326 | 0 | fn conj_c64s(self, a: Self::c64s) -> Self::c64s { |
2327 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2328 | 0 | let a: [c64; Self::C64_LANES] = cast(a); |
2329 | | |
2330 | 0 | for i in 0..Self::C64_LANES { |
2331 | 0 | out[i] = c64::new(a[i].re, -a[i].im); |
2332 | 0 | } |
2333 | | |
2334 | 0 | cast(out) |
2335 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::conj_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::conj_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::conj_c64s |
2336 | | |
2337 | | #[inline] |
2338 | 0 | fn neg_c64s(self, a: Self::c64s) -> Self::c64s { |
2339 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2340 | 0 | let a: [c64; Self::C64_LANES] = cast(a); |
2341 | | |
2342 | 0 | for i in 0..Self::C64_LANES { |
2343 | 0 | out[i] = c64::new(-a[i].re, -a[i].im); |
2344 | 0 | } |
2345 | | |
2346 | 0 | cast(out) |
2347 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::neg_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::neg_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::neg_c64s |
2348 | | |
2349 | | #[inline] |
2350 | 0 | fn swap_re_im_c64s(self, a: Self::c64s) -> Self::c64s { |
2351 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2352 | 0 | let a: [c64; Self::C64_LANES] = cast(a); |
2353 | | |
2354 | 0 | for i in 0..Self::C64_LANES { |
2355 | 0 | out[i] = c64::new(a[i].im, a[i].re); |
2356 | 0 | } |
2357 | | |
2358 | 0 | cast(out) |
2359 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::swap_re_im_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::swap_re_im_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::swap_re_im_c64s |
2360 | | |
2361 | | #[inline] |
2362 | 0 | fn conj_mul_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s { |
2363 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2364 | 0 | let a: [c64; Self::C64_LANES] = cast(a); |
2365 | 0 | let b: [c64; Self::C64_LANES] = cast(b); |
2366 | | |
2367 | 0 | for i in 0..Self::C64_LANES { |
2368 | 0 | out[i].re = fma_f64(a[i].re, b[i].re, a[i].im * b[i].im); |
2369 | 0 | out[i].im = fma_f64(a[i].re, b[i].im, -(a[i].im * b[i].re)); |
2370 | 0 | } |
2371 | | |
2372 | 0 | cast(out) |
2373 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::conj_mul_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::conj_mul_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::conj_mul_c64s |
2374 | | |
2375 | | #[inline] |
2376 | 0 | fn mul_add_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
2377 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2378 | 0 | let a: [c64; Self::C64_LANES] = cast(a); |
2379 | 0 | let b: [c64; Self::C64_LANES] = cast(b); |
2380 | 0 | let c: [c64; Self::C64_LANES] = cast(c); |
2381 | | |
2382 | 0 | for i in 0..Self::C64_LANES { |
2383 | 0 | out[i].re = fma_f64(a[i].re, b[i].re, -fma_f64(a[i].im, b[i].im, -c[i].re)); |
2384 | 0 | out[i].im = fma_f64(a[i].re, b[i].im, fma_f64(a[i].im, b[i].re, c[i].im)); |
2385 | 0 | } |
2386 | | |
2387 | 0 | cast(out) |
2388 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_add_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_add_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_add_c64s |
2389 | | |
2390 | | #[inline] |
2391 | 0 | fn conj_mul_add_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
2392 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2393 | 0 | let a: [c64; Self::C64_LANES] = cast(a); |
2394 | 0 | let b: [c64; Self::C64_LANES] = cast(b); |
2395 | 0 | let c: [c64; Self::C64_LANES] = cast(c); |
2396 | | |
2397 | 0 | for i in 0..Self::C64_LANES { |
2398 | 0 | out[i].re = fma_f64(a[i].re, b[i].re, fma_f64(a[i].im, b[i].im, c[i].re)); |
2399 | 0 | out[i].im = fma_f64(a[i].re, b[i].im, -fma_f64(a[i].im, b[i].re, -c[i].im)); |
2400 | 0 | } |
2401 | | |
2402 | 0 | cast(out) |
2403 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::conj_mul_add_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::conj_mul_add_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::conj_mul_add_c64s |
2404 | | |
2405 | | #[inline] |
2406 | 0 | fn abs2_c64s(self, a: Self::c64s) -> Self::c64s { |
2407 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2408 | 0 | let a: [c64; Self::C64_LANES] = cast(a); |
2409 | | |
2410 | 0 | for i in 0..Self::C64_LANES { |
2411 | 0 | let x = a[i].re * a[i].re + a[i].im * a[i].im; |
2412 | 0 | out[i].re = x; |
2413 | 0 | out[i].im = x; |
2414 | 0 | } |
2415 | | |
2416 | 0 | cast(out) |
2417 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::abs2_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::abs2_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::abs2_c64s |
2418 | | |
2419 | | #[inline] |
2420 | 0 | fn abs_max_c64s(self, a: Self::c64s) -> Self::c64s { |
2421 | 0 | let mut out = [c64::ZERO; Self::C64_LANES]; |
2422 | 0 | let a: [c64; Self::C64_LANES] = cast(self.abs_f64s(a)); |
2423 | | |
2424 | 0 | for i in 0..Self::C64_LANES { |
2425 | 0 | let x = f64::max(a[i].re, a[i].im); |
2426 | 0 | out[i].re = x; |
2427 | 0 | out[i].im = x; |
2428 | 0 | } |
2429 | | |
2430 | 0 | cast(out) |
2431 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::abs_max_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::abs_max_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::abs_max_c64s |
2432 | | |
2433 | | #[inline] |
2434 | 0 | fn reduce_sum_c64s(self, a: Self::c64s) -> c64 { |
2435 | 0 | let mut a: [c64; Self::C64_LANES] = cast(a); |
2436 | | |
2437 | 0 | let mut n = Self::C64_LANES; |
2438 | 0 | while n > 1 { |
2439 | 0 | n /= 2; |
2440 | 0 | for i in 0..n { |
2441 | 0 | a[i].re += a[i + n].re; |
2442 | 0 | a[i].im += a[i + n].im; |
2443 | 0 | } |
2444 | | } |
2445 | | |
2446 | 0 | a[0] |
2447 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_sum_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_sum_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_sum_c64s |
2448 | | |
2449 | | #[inline] |
2450 | 0 | fn reduce_min_c64s(self, a: Self::c64s) -> c64 { |
2451 | 0 | let mut a: [c64; Self::C64_LANES] = cast(a); |
2452 | | |
2453 | 0 | let mut n = Self::C64_LANES; |
2454 | 0 | while n > 1 { |
2455 | 0 | n /= 2; |
2456 | 0 | for i in 0..n { |
2457 | 0 | a[i].re = f64::min(a[i].re, a[i + n].re); |
2458 | 0 | a[i].im = f64::min(a[i].im, a[i + n].im); |
2459 | 0 | } |
2460 | | } |
2461 | | |
2462 | 0 | a[0] |
2463 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_min_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_min_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_min_c64s |
2464 | | |
2465 | | #[inline] |
2466 | 0 | fn reduce_max_c64s(self, a: Self::c64s) -> c64 { |
2467 | 0 | let mut a: [c64; Self::C64_LANES] = cast(a); |
2468 | | |
2469 | 0 | let mut n = Self::C64_LANES; |
2470 | 0 | while n > 1 { |
2471 | 0 | n /= 2; |
2472 | 0 | for i in 0..n { |
2473 | 0 | a[i].re = f64::max(a[i].re, a[i + n].re); |
2474 | 0 | a[i].im = f64::max(a[i].im, a[i + n].im); |
2475 | 0 | } |
2476 | | } |
2477 | | |
2478 | 0 | a[0] |
2479 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::reduce_max_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::reduce_max_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::reduce_max_c64s |
2480 | | |
2481 | | #[inline] |
2482 | 0 | fn rotate_right_u64s(self, a: Self::u64s, amount: usize) -> Self::u64s { |
2483 | 0 | let mut a: [u64; Self::F64_LANES] = cast(a); |
2484 | 0 | let amount = amount % Self::F64_LANES; |
2485 | 0 | a.rotate_right(amount); |
2486 | 0 | cast(a) |
2487 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::rotate_right_u64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::rotate_right_u64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::rotate_right_u64s |
2488 | | |
2489 | | #[inline] |
2490 | 0 | fn rotate_right_c64s(self, a: Self::c64s, amount: usize) -> Self::c64s { |
2491 | 0 | let mut a: [c64; Self::C64_LANES] = cast(a); |
2492 | 0 | let amount = amount % Self::C64_LANES; |
2493 | 0 | a.rotate_right(amount); |
2494 | 0 | cast(a) |
2495 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::rotate_right_c64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::rotate_right_c64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::rotate_right_c64s |
2496 | | |
2497 | | #[inline] |
2498 | 0 | fn mul_add_e_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
2499 | 0 | self.mul_add_f32s(a, b, c) |
2500 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_add_e_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_add_e_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_add_e_f32s |
2501 | | |
2502 | | #[inline] |
2503 | 0 | fn mul_add_e_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2504 | 0 | self.mul_add_f64s(a, b, c) |
2505 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::mul_add_e_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::mul_add_e_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::mul_add_e_f64s |
2506 | | |
2507 | | #[inline] |
2508 | 0 | fn negate_mul_add_e_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
2509 | 0 | self.negate_mul_add_f32s(a, b, c) |
2510 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::negate_mul_add_e_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::negate_mul_add_e_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::negate_mul_add_e_f32s |
2511 | | |
2512 | | #[inline] |
2513 | 0 | fn negate_mul_add_e_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2514 | 0 | self.negate_mul_add_f64s(a, b, c) |
2515 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::negate_mul_add_e_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::negate_mul_add_e_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::negate_mul_add_e_f64s |
2516 | | |
2517 | | #[inline(always)] |
2518 | 0 | fn sqrt_f32s(self, a: Self::f32s) -> Self::f32s { |
2519 | 0 | let mut out = [0.0_f32; Self::F32_LANES]; |
2520 | 0 | let a: [f32; Self::F32_LANES] = cast(a); |
2521 | | |
2522 | 0 | for i in 0..Self::F32_LANES { |
2523 | 0 | out[i] = sqrt_f32(a[i]); |
2524 | 0 | } |
2525 | | |
2526 | 0 | cast(out) |
2527 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sqrt_f32s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sqrt_f32s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sqrt_f32s |
2528 | | #[inline(always)] |
2529 | 0 | fn sqrt_f64s(self, a: Self::f64s) -> Self::f64s { |
2530 | 0 | let mut out = [0.0_f64; Self::F64_LANES]; |
2531 | 0 | let a: [f64; Self::F64_LANES] = cast(a); |
2532 | | |
2533 | 0 | for i in 0..Self::F64_LANES { |
2534 | 0 | out[i] = sqrt_f64(a[i]); |
2535 | 0 | } |
2536 | | |
2537 | 0 | cast(out) |
2538 | 0 | } Unexecuted instantiation: <pulp::Scalar128b as pulp::Simd>::sqrt_f64s Unexecuted instantiation: <pulp::Scalar256b as pulp::Simd>::sqrt_f64s Unexecuted instantiation: <pulp::Scalar512b as pulp::Simd>::sqrt_f64s |
2539 | | } |
2540 | | }; |
2541 | | } |
2542 | | |
2543 | | scalar_simd!( |
2544 | | Scalar128b, 16, m8x16, i8x16, u8x16, m16x8, i16x8, u16x8, m32x4, f32x4, i32x4, u32x4, m64x2, |
2545 | | f64x2, i64x2, u64x2 |
2546 | | ); |
2547 | | scalar_simd!( |
2548 | | Scalar256b, 16, m8x32, i8x32, u8x32, m16x16, i16x16, u16x16, m32x8, f32x8, i32x8, u32x8, m64x4, |
2549 | | f64x4, i64x4, u64x4 |
2550 | | ); |
2551 | | scalar_simd!( |
2552 | | Scalar512b, 8, m8x64, i8x64, u8x64, m16x32, i16x32, u16x32, m32x16, f32x16, i32x16, u32x16, |
2553 | | m64x8, f64x8, i64x8, u64x8 |
2554 | | ); |
2555 | | |
2556 | | impl Default for Scalar { |
2557 | | #[inline] |
2558 | 0 | fn default() -> Self { |
2559 | 0 | Self::new() |
2560 | 0 | } |
2561 | | } |
2562 | | |
2563 | | impl Scalar { |
2564 | | #[inline] |
2565 | 0 | pub fn new() -> Self { |
2566 | 0 | Self |
2567 | 0 | } |
2568 | | } |
2569 | | |
2570 | | macro_rules! impl_primitive_binop { |
2571 | | ($func: ident, $op: ident, $ty: ident, $out: ty) => { |
2572 | | paste! { |
2573 | | #[inline(always)] |
2574 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>], b: Self::[<$ty s>]) -> Self::[<$out s>] { |
2575 | 0 | a.$op(b) |
2576 | 0 | } Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_m8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_m8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_m16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_m32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_m64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::or_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_m8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_c32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_c64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::add_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_m16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_m32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_m64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::and_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::div_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::div_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::max_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::min_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::mul_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_c32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_c64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::sub_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_m16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_m32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_m64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::xor_u64s |
2577 | | } |
2578 | | }; |
2579 | | (ref $func: ident, $op: ident, $ty: ident, $out: ty) => { |
2580 | | paste! { |
2581 | | #[inline(always)] |
2582 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>], b: Self::[<$ty s>]) -> Self::[<$out s>] { |
2583 | 0 | a.$op(&b) |
2584 | 0 | } Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_c32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_c64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_m16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_m32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_m64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::less_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::greater_than_or_equal_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_m8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::equal_u8s |
2585 | | } |
2586 | | }; |
2587 | | } |
2588 | | |
2589 | | macro_rules! primitive_binop { |
2590 | | (ref $func: ident, op $op: ident, $($ty: ident => $out: ty),*) => { |
2591 | | $(impl_primitive_binop!(ref $func, $op, $ty, $out);)* |
2592 | | }; |
2593 | | ($func: ident, $($ty: ident => $out: ty),*) => { |
2594 | | $(impl_primitive_binop!($func, $func, $ty, $out);)* |
2595 | | }; |
2596 | | ($func: ident, op $op: ident, $($ty: ident),*) => { |
2597 | | $(impl_primitive_binop!($func, $op, $ty, $ty);)* |
2598 | | }; |
2599 | | ($func: ident, $($ty: ident),*) => { |
2600 | | $(impl_primitive_binop!($func, $func, $ty, $ty);)* |
2601 | | }; |
2602 | | } |
2603 | | |
2604 | | macro_rules! impl_primitive_unop { |
2605 | | ($func: ident, $op: ident, $ty: ident, $out: ty) => { |
2606 | | paste! { |
2607 | | #[inline(always)] |
2608 | 0 | fn [<$func _ $ty s>](self, a: Self::[<$ty s>]) -> Self::[<$out s>] { |
2609 | 0 | a.$op() |
2610 | 0 | } Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_m8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_u8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::neg_c32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::neg_c64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::neg_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::neg_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_m16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_m32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_m64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::not_u64s |
2611 | | } |
2612 | | }; |
2613 | | } |
2614 | | |
2615 | | macro_rules! primitive_unop { |
2616 | | ($func: ident, $($ty: ident),*) => { |
2617 | | $(impl_primitive_unop!($func, $func, $ty, $ty);)* |
2618 | | }; |
2619 | | } |
2620 | | |
2621 | | macro_rules! splat_primitive { |
2622 | | ($ty: ty) => { |
2623 | | paste! { |
2624 | | #[inline] |
2625 | 0 | fn [<splat_ $ty s>](self, value: $ty) -> Self::[<$ty s>] { |
2626 | 0 | value |
2627 | 0 | } Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_c32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_c64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_f32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_f64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_i16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_i32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_i64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_u16s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_u32s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_u64s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_i8s Unexecuted instantiation: <pulp::Scalar as pulp::Simd>::splat_u8s |
2628 | | } |
2629 | | }; |
2630 | | ($($ty: ty),*) => { |
2631 | | $(splat_primitive!($ty);)* |
2632 | | } |
2633 | | } |
2634 | | |
2635 | | impl Seal for Scalar {} |
2636 | | impl Simd for Scalar { |
2637 | | type c32s = c32; |
2638 | | type c64s = c64; |
2639 | | type f32s = f32; |
2640 | | type f64s = f64; |
2641 | | type i16s = i16; |
2642 | | type i32s = i32; |
2643 | | type i64s = i64; |
2644 | | type i8s = i8; |
2645 | | type m16s = bool; |
2646 | | type m32s = bool; |
2647 | | type m64s = bool; |
2648 | | type m8s = bool; |
2649 | | type u16s = u16; |
2650 | | type u32s = u32; |
2651 | | type u64s = u64; |
2652 | | type u8s = u8; |
2653 | | |
2654 | | const IS_SCALAR: bool = true; |
2655 | | const REGISTER_COUNT: usize = 16; |
2656 | | |
2657 | | primitive_binop!(add, c32, f32, c64, f64); |
2658 | | |
2659 | | primitive_binop!(add, op wrapping_add, u8, i8, u16, i16, u32, i32, u64, i64); |
2660 | | |
2661 | | primitive_binop!(sub, c32, f32, c64, f64); |
2662 | | |
2663 | | primitive_binop!(sub, op wrapping_sub, u8, i8, u16, i16, u32, i32, u64, i64); |
2664 | | |
2665 | | primitive_binop!(mul, f32, f64); |
2666 | | |
2667 | | primitive_binop!(mul, op wrapping_mul, u16, i16, u32, i32, u64, i64); |
2668 | | |
2669 | | primitive_binop!(div, f32, f64); |
2670 | | |
2671 | | primitive_binop!(and, op bitand, m8, u8, m16, u16, m32, u32, m64, u64); |
2672 | | |
2673 | | primitive_binop!(or, op bitor, m8, u8, m16, u16, m32, u32, m64, u64); |
2674 | | |
2675 | | primitive_binop!(xor, op bitxor, m8, u8, m16, u16, m32, u32, m64, u64); |
2676 | | |
2677 | | primitive_binop!(ref equal, op eq, m8 => m8, u8 => m8, m16 => m16, u16 => m16, m32 => m32, u32 => m32, m64 => m64, u64 => m64, c32 => m32, f32 => m32, c64 => m64, f64 => m64); |
2678 | | |
2679 | | primitive_binop!(ref greater_than, op gt, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
2680 | | |
2681 | | primitive_binop!(ref greater_than_or_equal, op ge, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
2682 | | |
2683 | | primitive_binop!(ref less_than, op lt, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
2684 | | |
2685 | | primitive_binop!(ref less_than_or_equal, op le, u8 => m8, i8 => m8, u16 => m16, i16 => m16, u32 => m32, i32 => m32, u64 => m64, i64 => m64, f32 => m32, f64 => m64); |
2686 | | |
2687 | | primitive_binop!(min, u8, i8, u16, i16, u32, i32, u64, i64, f32, f64); |
2688 | | |
2689 | | primitive_binop!(max, u8, i8, u16, i16, u32, i32, u64, i64, f32, f64); |
2690 | | |
2691 | | primitive_unop!(neg, c32, c64, f32, f64); |
2692 | | |
2693 | | primitive_unop!(not, m8, u8, m16, u16, m32, u32, m64, u64); |
2694 | | |
2695 | | splat_primitive!(u8, i8, u16, i16, u32, i32, u64, i64, c32, f32, c64, f64); |
2696 | | |
2697 | | #[inline] |
2698 | 0 | fn abs2_c32s(self, a: Self::c32s) -> Self::c32s { |
2699 | 0 | let norm2 = a.re * a.re + a.im * a.im; |
2700 | 0 | c32::new(norm2, norm2) |
2701 | 0 | } |
2702 | | |
2703 | | #[inline] |
2704 | 0 | fn abs2_c64s(self, a: Self::c64s) -> Self::c64s { |
2705 | 0 | let norm2 = a.re * a.re + a.im * a.im; |
2706 | 0 | c64::new(norm2, norm2) |
2707 | 0 | } |
2708 | | |
2709 | | #[inline(always)] |
2710 | 0 | fn abs_max_c32s(self, a: Self::c32s) -> Self::c32s { |
2711 | 0 | let re = if a.re > a.im { a.re } else { a.im }; |
2712 | 0 | let im = re; |
2713 | 0 | Complex { re, im } |
2714 | 0 | } |
2715 | | |
2716 | | #[inline(always)] |
2717 | 0 | fn abs_max_c64s(self, a: Self::c64s) -> Self::c64s { |
2718 | 0 | let re = if a.re > a.im { a.re } else { a.im }; |
2719 | 0 | let im = re; |
2720 | 0 | Complex { re, im } |
2721 | 0 | } |
2722 | | |
2723 | | #[inline] |
2724 | 0 | fn conj_c32s(self, a: Self::c32s) -> Self::c32s { |
2725 | 0 | a.conj() |
2726 | 0 | } |
2727 | | |
2728 | | #[inline] |
2729 | 0 | fn conj_c64s(self, a: Self::c64s) -> Self::c64s { |
2730 | 0 | a.conj() |
2731 | 0 | } |
2732 | | |
2733 | | #[inline] |
2734 | 0 | fn conj_mul_add_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
2735 | 0 | let re = fma_f32(a.re, b.re, fma_f32(a.im, b.im, c.re)); |
2736 | 0 | let im = fma_f32(a.re, b.im, -fma_f32(a.im, b.re, -c.im)); |
2737 | 0 | Complex { re, im } |
2738 | 0 | } |
2739 | | |
2740 | | #[inline] |
2741 | 0 | fn conj_mul_add_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
2742 | 0 | let re = fma_f64(a.re, b.re, fma_f64(a.im, b.im, c.re)); |
2743 | 0 | let im = fma_f64(a.re, b.im, -fma_f64(a.im, b.re, -c.im)); |
2744 | 0 | Complex { re, im } |
2745 | 0 | } |
2746 | | |
2747 | | #[inline] |
2748 | 0 | fn conj_mul_add_e_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
2749 | 0 | a.conj() * b + c |
2750 | 0 | } |
2751 | | |
2752 | | #[inline] |
2753 | 0 | fn conj_mul_add_e_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
2754 | 0 | a.conj() * b + c |
2755 | 0 | } |
2756 | | |
2757 | | #[inline] |
2758 | 0 | fn conj_mul_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s { |
2759 | 0 | let re = fma_f32(a.re, b.re, a.im * b.im); |
2760 | 0 | let im = fma_f32(a.re, b.im, -(a.im * b.re)); |
2761 | 0 | Complex { re, im } |
2762 | 0 | } |
2763 | | |
2764 | | #[inline] |
2765 | 0 | fn conj_mul_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s { |
2766 | 0 | let re = fma_f64(a.re, b.re, a.im * b.im); |
2767 | 0 | let im = fma_f64(a.re, b.im, -(a.im * b.re)); |
2768 | 0 | Complex { re, im } |
2769 | 0 | } |
2770 | | |
2771 | | #[inline] |
2772 | 0 | fn conj_mul_e_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s { |
2773 | 0 | a.conj() * b |
2774 | 0 | } |
2775 | | |
2776 | | #[inline] |
2777 | 0 | fn conj_mul_e_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s { |
2778 | 0 | a.conj() * b |
2779 | 0 | } |
2780 | | |
2781 | | #[inline(always)] |
2782 | 0 | fn first_true_m32s(self, mask: Self::m32s) -> usize { |
2783 | 0 | if mask { 0 } else { 1 } |
2784 | 0 | } |
2785 | | |
2786 | | #[inline(always)] |
2787 | 0 | fn first_true_m64s(self, mask: Self::m64s) -> usize { |
2788 | 0 | if mask { 0 } else { 1 } |
2789 | 0 | } |
2790 | | |
2791 | | #[inline(always)] |
2792 | 0 | unsafe fn mask_load_ptr_c32s(self, mask: MemMask<Self::m32s>, ptr: *const c32) -> Self::c32s { |
2793 | 0 | if mask.mask { *ptr } else { core::mem::zeroed() } |
2794 | 0 | } |
2795 | | |
2796 | | #[inline(always)] |
2797 | 0 | unsafe fn mask_load_ptr_c64s(self, mask: MemMask<Self::m64s>, ptr: *const c64) -> Self::c64s { |
2798 | 0 | if mask.mask { *ptr } else { core::mem::zeroed() } |
2799 | 0 | } |
2800 | | |
2801 | | #[inline(always)] |
2802 | 0 | unsafe fn mask_load_ptr_u32s(self, mask: MemMask<Self::m32s>, ptr: *const u32) -> Self::u32s { |
2803 | 0 | if mask.mask { *ptr } else { 0 } |
2804 | 0 | } |
2805 | | |
2806 | | #[inline(always)] |
2807 | 0 | unsafe fn mask_load_ptr_u64s(self, mask: MemMask<Self::m64s>, ptr: *const u64) -> Self::u64s { |
2808 | 0 | if mask.mask { *ptr } else { 0 } |
2809 | 0 | } |
2810 | | |
2811 | | #[inline(always)] |
2812 | 0 | unsafe fn mask_store_ptr_c32s( |
2813 | 0 | self, |
2814 | 0 | mask: MemMask<Self::m32s>, |
2815 | 0 | ptr: *mut c32, |
2816 | 0 | values: Self::c32s, |
2817 | 0 | ) { |
2818 | 0 | if mask.mask { |
2819 | 0 | *ptr = values |
2820 | 0 | } |
2821 | 0 | } |
2822 | | |
2823 | | #[inline(always)] |
2824 | 0 | unsafe fn mask_store_ptr_c64s( |
2825 | 0 | self, |
2826 | 0 | mask: MemMask<Self::m64s>, |
2827 | 0 | ptr: *mut c64, |
2828 | 0 | values: Self::c64s, |
2829 | 0 | ) { |
2830 | 0 | if mask.mask { |
2831 | 0 | *ptr = values |
2832 | 0 | } |
2833 | 0 | } |
2834 | | |
2835 | | #[inline(always)] |
2836 | 0 | unsafe fn mask_store_ptr_u8s(self, mask: MemMask<Self::m8s>, ptr: *mut u8, values: Self::u8s) { |
2837 | 0 | if mask.mask { |
2838 | 0 | *ptr = values |
2839 | 0 | } |
2840 | 0 | } |
2841 | | |
2842 | | #[inline(always)] |
2843 | 0 | unsafe fn mask_store_ptr_u16s( |
2844 | 0 | self, |
2845 | 0 | mask: MemMask<Self::m16s>, |
2846 | 0 | ptr: *mut u16, |
2847 | 0 | values: Self::u16s, |
2848 | 0 | ) { |
2849 | 0 | if mask.mask { |
2850 | 0 | *ptr = values |
2851 | 0 | } |
2852 | 0 | } |
2853 | | |
2854 | | #[inline(always)] |
2855 | 0 | unsafe fn mask_store_ptr_u32s( |
2856 | 0 | self, |
2857 | 0 | mask: MemMask<Self::m32s>, |
2858 | 0 | ptr: *mut u32, |
2859 | 0 | values: Self::u32s, |
2860 | 0 | ) { |
2861 | 0 | if mask.mask { |
2862 | 0 | *ptr = values |
2863 | 0 | } |
2864 | 0 | } |
2865 | | |
2866 | | #[inline(always)] |
2867 | 0 | unsafe fn mask_store_ptr_u64s( |
2868 | 0 | self, |
2869 | 0 | mask: MemMask<Self::m64s>, |
2870 | 0 | ptr: *mut u64, |
2871 | 0 | values: Self::u64s, |
2872 | 0 | ) { |
2873 | 0 | if mask.mask { |
2874 | 0 | *ptr = values |
2875 | 0 | } |
2876 | 0 | } |
2877 | | |
2878 | | #[inline] |
2879 | 0 | fn mul_add_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
2880 | 0 | let re = fma_f32(a.re, b.re, -fma_f32(a.im, b.im, -c.re)); |
2881 | 0 | let im = fma_f32(a.re, b.im, fma_f32(a.im, b.re, c.im)); |
2882 | 0 | Complex { re, im } |
2883 | 0 | } |
2884 | | |
2885 | | #[inline] |
2886 | 0 | fn mul_add_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
2887 | 0 | let re = fma_f64(a.re, b.re, -fma_f64(a.im, b.im, -c.re)); |
2888 | 0 | let im = fma_f64(a.re, b.im, fma_f64(a.im, b.re, c.im)); |
2889 | 0 | Complex { re, im } |
2890 | 0 | } |
2891 | | |
2892 | | #[inline] |
2893 | 0 | fn mul_add_e_c32s(self, a: Self::c32s, b: Self::c32s, c: Self::c32s) -> Self::c32s { |
2894 | 0 | a * b + c |
2895 | 0 | } |
2896 | | |
2897 | | #[inline] |
2898 | 0 | fn mul_add_e_c64s(self, a: Self::c64s, b: Self::c64s, c: Self::c64s) -> Self::c64s { |
2899 | 0 | a * b + c |
2900 | 0 | } |
2901 | | |
2902 | | #[inline(always)] |
2903 | 0 | fn mul_add_e_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
2904 | 0 | a * b + c |
2905 | 0 | } |
2906 | | |
2907 | | #[inline(always)] |
2908 | 0 | fn mul_add_e_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2909 | 0 | a * b + c |
2910 | 0 | } |
2911 | | |
2912 | | #[inline] |
2913 | 0 | fn mul_add_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
2914 | 0 | fma_f32(a, b, c) |
2915 | 0 | } |
2916 | | |
2917 | | #[inline] |
2918 | 0 | fn mul_add_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2919 | 0 | fma_f64(a, b, c) |
2920 | 0 | } |
2921 | | |
2922 | | #[inline] |
2923 | 0 | fn negate_mul_add_e_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
2924 | 0 | c - a * b |
2925 | 0 | } |
2926 | | |
2927 | | #[inline] |
2928 | 0 | fn negate_mul_add_e_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2929 | 0 | c - a * b |
2930 | 0 | } |
2931 | | |
2932 | | #[inline] |
2933 | 0 | fn negate_mul_add_f32s(self, a: Self::f32s, b: Self::f32s, c: Self::f32s) -> Self::f32s { |
2934 | 0 | fma_f32(-a, b, c) |
2935 | 0 | } |
2936 | | |
2937 | | #[inline] |
2938 | 0 | fn negate_mul_add_f64s(self, a: Self::f64s, b: Self::f64s, c: Self::f64s) -> Self::f64s { |
2939 | 0 | fma_f64(-a, b, c) |
2940 | 0 | } |
2941 | | |
2942 | | #[inline] |
2943 | 0 | fn mul_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s { |
2944 | 0 | let re = fma_f32(a.re, b.re, -(a.im * b.im)); |
2945 | 0 | let im = fma_f32(a.re, b.im, a.im * b.re); |
2946 | 0 | Complex { re, im } |
2947 | 0 | } |
2948 | | |
2949 | | #[inline] |
2950 | 0 | fn mul_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s { |
2951 | 0 | let re = fma_f64(a.re, b.re, -(a.im * b.im)); |
2952 | 0 | let im = fma_f64(a.re, b.im, a.im * b.re); |
2953 | 0 | Complex { re, im } |
2954 | 0 | } |
2955 | | |
2956 | | #[inline] |
2957 | 0 | fn mul_e_c32s(self, a: Self::c32s, b: Self::c32s) -> Self::c32s { |
2958 | 0 | a * b |
2959 | 0 | } |
2960 | | |
2961 | | #[inline] |
2962 | 0 | fn mul_e_c64s(self, a: Self::c64s, b: Self::c64s) -> Self::c64s { |
2963 | 0 | a * b |
2964 | 0 | } |
2965 | | |
2966 | | #[inline] |
2967 | 0 | fn partial_load_c64s(self, slice: &[c64]) -> Self::c64s { |
2968 | 0 | if let Some((head, _)) = slice.split_first() { |
2969 | 0 | *head |
2970 | | } else { |
2971 | 0 | c64 { re: 0.0, im: 0.0 } |
2972 | | } |
2973 | 0 | } |
2974 | | |
2975 | | #[inline] |
2976 | 0 | fn partial_load_u32s(self, slice: &[u32]) -> Self::u32s { |
2977 | 0 | if let Some((head, _)) = slice.split_first() { |
2978 | 0 | *head |
2979 | | } else { |
2980 | 0 | 0 |
2981 | | } |
2982 | 0 | } |
2983 | | |
2984 | | #[inline] |
2985 | 0 | fn partial_load_u64s(self, slice: &[u64]) -> Self::u64s { |
2986 | 0 | if let Some((head, _)) = slice.split_first() { |
2987 | 0 | *head |
2988 | | } else { |
2989 | 0 | 0 |
2990 | | } |
2991 | 0 | } |
2992 | | |
2993 | | #[inline] |
2994 | 0 | fn partial_store_c64s(self, slice: &mut [c64], values: Self::c64s) { |
2995 | 0 | if let Some((head, _)) = slice.split_first_mut() { |
2996 | 0 | *head = values; |
2997 | 0 | } |
2998 | 0 | } |
2999 | | |
3000 | | #[inline] |
3001 | 0 | fn partial_store_u32s(self, slice: &mut [u32], values: Self::u32s) { |
3002 | 0 | if let Some((head, _)) = slice.split_first_mut() { |
3003 | 0 | *head = values; |
3004 | 0 | } |
3005 | 0 | } |
3006 | | |
3007 | | #[inline] |
3008 | 0 | fn partial_store_u64s(self, slice: &mut [u64], values: Self::u64s) { |
3009 | 0 | if let Some((head, _)) = slice.split_first_mut() { |
3010 | 0 | *head = values; |
3011 | 0 | } |
3012 | 0 | } |
3013 | | |
3014 | | #[inline(always)] |
3015 | 0 | fn reduce_max_c32s(self, a: Self::c32s) -> c32 { |
3016 | 0 | a |
3017 | 0 | } |
3018 | | |
3019 | | #[inline(always)] |
3020 | 0 | fn reduce_max_c64s(self, a: Self::c64s) -> c64 { |
3021 | 0 | a |
3022 | 0 | } |
3023 | | |
3024 | | #[inline] |
3025 | 0 | fn reduce_max_f32s(self, a: Self::f32s) -> f32 { |
3026 | 0 | a |
3027 | 0 | } |
3028 | | |
3029 | | #[inline] |
3030 | 0 | fn reduce_max_f64s(self, a: Self::f64s) -> f64 { |
3031 | 0 | a |
3032 | 0 | } |
3033 | | |
3034 | | #[inline(always)] |
3035 | 0 | fn reduce_min_c32s(self, a: Self::c32s) -> c32 { |
3036 | 0 | a |
3037 | 0 | } |
3038 | | |
3039 | | #[inline(always)] |
3040 | 0 | fn reduce_min_c64s(self, a: Self::c64s) -> c64 { |
3041 | 0 | a |
3042 | 0 | } |
3043 | | |
3044 | | #[inline] |
3045 | 0 | fn reduce_min_f32s(self, a: Self::f32s) -> f32 { |
3046 | 0 | a |
3047 | 0 | } |
3048 | | |
3049 | | #[inline] |
3050 | 0 | fn reduce_min_f64s(self, a: Self::f64s) -> f64 { |
3051 | 0 | a |
3052 | 0 | } |
3053 | | |
3054 | | #[inline] |
3055 | 0 | fn reduce_product_f32s(self, a: Self::f32s) -> f32 { |
3056 | 0 | a |
3057 | 0 | } |
3058 | | |
3059 | | #[inline] |
3060 | 0 | fn reduce_product_f64s(self, a: Self::f64s) -> f64 { |
3061 | 0 | a |
3062 | 0 | } |
3063 | | |
3064 | | #[inline] |
3065 | 0 | fn reduce_sum_c32s(self, a: Self::c32s) -> c32 { |
3066 | 0 | a |
3067 | 0 | } |
3068 | | |
3069 | | #[inline] |
3070 | 0 | fn reduce_sum_c64s(self, a: Self::c64s) -> c64 { |
3071 | 0 | a |
3072 | 0 | } |
3073 | | |
3074 | | #[inline] |
3075 | 0 | fn reduce_sum_f32s(self, a: Self::f32s) -> f32 { |
3076 | 0 | a |
3077 | 0 | } |
3078 | | |
3079 | | #[inline] |
3080 | 0 | fn reduce_sum_f64s(self, a: Self::f64s) -> f64 { |
3081 | 0 | a |
3082 | 0 | } |
3083 | | |
3084 | | #[inline(always)] |
3085 | 0 | fn rotate_right_c32s(self, a: Self::c32s, _amount: usize) -> Self::c32s { |
3086 | 0 | a |
3087 | 0 | } |
3088 | | |
3089 | | #[inline(always)] |
3090 | 0 | fn rotate_right_c64s(self, a: Self::c64s, _amount: usize) -> Self::c64s { |
3091 | 0 | a |
3092 | 0 | } |
3093 | | |
3094 | | #[inline(always)] |
3095 | 0 | fn rotate_right_u32s(self, a: Self::u32s, _amount: usize) -> Self::u32s { |
3096 | 0 | a |
3097 | 0 | } |
3098 | | |
3099 | | #[inline(always)] |
3100 | 0 | fn rotate_right_u64s(self, a: Self::u64s, _amount: usize) -> Self::u64s { |
3101 | 0 | a |
3102 | 0 | } |
3103 | | |
3104 | | #[inline] |
3105 | 0 | fn select_u32s( |
3106 | 0 | self, |
3107 | 0 | mask: Self::m32s, |
3108 | 0 | if_true: Self::u32s, |
3109 | 0 | if_false: Self::u32s, |
3110 | 0 | ) -> Self::u32s { |
3111 | 0 | if mask { if_true } else { if_false } |
3112 | 0 | } |
3113 | | |
3114 | | #[inline] |
3115 | 0 | fn select_u64s( |
3116 | 0 | self, |
3117 | 0 | mask: Self::m64s, |
3118 | 0 | if_true: Self::u64s, |
3119 | 0 | if_false: Self::u64s, |
3120 | 0 | ) -> Self::u64s { |
3121 | 0 | if mask { if_true } else { if_false } |
3122 | 0 | } |
3123 | | |
3124 | | #[inline] |
3125 | 0 | fn swap_re_im_c32s(self, a: Self::c32s) -> Self::c32s { |
3126 | 0 | c32 { re: a.im, im: a.re } |
3127 | 0 | } |
3128 | | |
3129 | 0 | fn swap_re_im_c64s(self, a: Self::c64s) -> Self::c64s { |
3130 | 0 | c64 { re: a.im, im: a.re } |
3131 | 0 | } |
3132 | | |
3133 | | #[inline] |
3134 | 0 | fn vectorize<Op: WithSimd>(self, op: Op) -> Op::Output { |
3135 | 0 | op.with_simd(self) |
3136 | 0 | } |
3137 | | |
3138 | | #[inline] |
3139 | 0 | fn widening_mul_u32s(self, a: Self::u32s, b: Self::u32s) -> (Self::u32s, Self::u32s) { |
3140 | 0 | let c = a as u64 * b as u64; |
3141 | 0 | let lo = c as u32; |
3142 | 0 | let hi = (c >> 32) as u32; |
3143 | 0 | (lo, hi) |
3144 | 0 | } |
3145 | | |
3146 | | #[inline] |
3147 | 0 | fn wrapping_dyn_shl_u32s(self, a: Self::u32s, amount: Self::u32s) -> Self::u32s { |
3148 | 0 | a.wrapping_shl(amount) |
3149 | 0 | } |
3150 | | |
3151 | | #[inline] |
3152 | 0 | fn wrapping_dyn_shr_u32s(self, a: Self::u32s, amount: Self::u32s) -> Self::u32s { |
3153 | 0 | a.wrapping_shr(amount) |
3154 | 0 | } |
3155 | | |
3156 | 0 | unsafe fn mask_load_ptr_u8s(self, mask: MemMask<Self::m8s>, ptr: *const u8) -> Self::u8s { |
3157 | 0 | if mask.mask { *ptr } else { 0 } |
3158 | 0 | } |
3159 | | |
3160 | 0 | unsafe fn mask_load_ptr_u16s(self, mask: MemMask<Self::m16s>, ptr: *const u16) -> Self::u16s { |
3161 | 0 | if mask.mask { *ptr } else { 0 } |
3162 | 0 | } |
3163 | | |
3164 | | #[inline(always)] |
3165 | 0 | fn sqrt_f32s(self, a: Self::f32s) -> Self::f32s { |
3166 | 0 | sqrt_f32(a) |
3167 | 0 | } |
3168 | | |
3169 | | #[inline(always)] |
3170 | 0 | fn sqrt_f64s(self, a: Self::f64s) -> Self::f64s { |
3171 | 0 | sqrt_f64(a) |
3172 | 0 | } |
3173 | | } |
3174 | | |
3175 | | #[inline(always)] |
3176 | 0 | unsafe fn split_slice<T, U>(slice: &[T]) -> (&[U], &[T]) { |
3177 | 0 | assert_eq!(core::mem::size_of::<U>() % core::mem::size_of::<T>(), 0); |
3178 | 0 | assert_eq!(core::mem::align_of::<U>(), core::mem::align_of::<T>()); |
3179 | | |
3180 | 0 | let chunk_size = core::mem::size_of::<U>() / core::mem::size_of::<T>(); |
3181 | | |
3182 | 0 | let len = slice.len(); |
3183 | 0 | let data = slice.as_ptr(); |
3184 | | |
3185 | 0 | let div = len / chunk_size; |
3186 | 0 | let rem = len % chunk_size; |
3187 | 0 | ( |
3188 | 0 | from_raw_parts(data as *const U, div), |
3189 | 0 | from_raw_parts(data.add(len - rem), rem), |
3190 | 0 | ) |
3191 | 0 | } |
3192 | | |
3193 | | #[inline(always)] |
3194 | 0 | unsafe fn split_mut_slice<T, U>(slice: &mut [T]) -> (&mut [U], &mut [T]) { |
3195 | 0 | assert_eq!(core::mem::size_of::<U>() % core::mem::size_of::<T>(), 0); |
3196 | 0 | assert_eq!(core::mem::align_of::<U>(), core::mem::align_of::<T>()); |
3197 | | |
3198 | 0 | let chunk_size = core::mem::size_of::<U>() / core::mem::size_of::<T>(); |
3199 | | |
3200 | 0 | let len = slice.len(); |
3201 | 0 | let data = slice.as_mut_ptr(); |
3202 | | |
3203 | 0 | let div = len / chunk_size; |
3204 | 0 | let rem = len % chunk_size; |
3205 | 0 | ( |
3206 | 0 | from_raw_parts_mut(data as *mut U, div), |
3207 | 0 | from_raw_parts_mut(data.add(len - rem), rem), |
3208 | 0 | ) |
3209 | 0 | } |
3210 | | |
3211 | | #[inline(always)] |
3212 | 0 | unsafe fn rsplit_slice<T, U>(slice: &[T]) -> (&[T], &[U]) { |
3213 | 0 | assert_eq!(core::mem::size_of::<U>() % core::mem::size_of::<T>(), 0); |
3214 | 0 | assert_eq!(core::mem::align_of::<U>(), core::mem::align_of::<T>()); |
3215 | | |
3216 | 0 | let chunk_size = core::mem::size_of::<U>() / core::mem::size_of::<T>(); |
3217 | | |
3218 | 0 | let len = slice.len(); |
3219 | 0 | let data = slice.as_ptr(); |
3220 | | |
3221 | 0 | let div = len / chunk_size; |
3222 | 0 | let rem = len % chunk_size; |
3223 | 0 | ( |
3224 | 0 | from_raw_parts(data, rem), |
3225 | 0 | from_raw_parts(data.add(rem) as *const U, div), |
3226 | 0 | ) |
3227 | 0 | } |
3228 | | |
3229 | | #[inline(always)] |
3230 | 0 | unsafe fn rsplit_mut_slice<T, U>(slice: &mut [T]) -> (&mut [T], &mut [U]) { |
3231 | 0 | assert_eq!(core::mem::size_of::<U>() % core::mem::size_of::<T>(), 0); |
3232 | 0 | assert_eq!(core::mem::align_of::<U>(), core::mem::align_of::<T>()); |
3233 | | |
3234 | 0 | let chunk_size = core::mem::size_of::<U>() / core::mem::size_of::<T>(); |
3235 | | |
3236 | 0 | let len = slice.len(); |
3237 | 0 | let data = slice.as_mut_ptr(); |
3238 | | |
3239 | 0 | let div = len / chunk_size; |
3240 | 0 | let rem = len % chunk_size; |
3241 | 0 | ( |
3242 | 0 | from_raw_parts_mut(data, rem), |
3243 | 0 | from_raw_parts_mut(data.add(rem) as *mut U, div), |
3244 | 0 | ) |
3245 | 0 | } |
3246 | | |
3247 | | match_cfg!( |
3248 | | item, |
3249 | | match cfg!() { |
3250 | | const { any(target_arch = "x86", target_arch = "x86_64") } => { |
3251 | | pub use x86::Arch; |
3252 | | }, |
3253 | | const { target_arch = "aarch64" } => { |
3254 | | pub use aarch64::Arch; |
3255 | | }, |
3256 | | const { target_arch = "wasm32" } => { |
3257 | | pub use wasm::Arch; |
3258 | | }, |
3259 | | _ => { |
3260 | | #[derive(Debug, Clone, Copy)] |
3261 | | #[non_exhaustive] |
3262 | | pub enum Arch { |
3263 | | Scalar, |
3264 | | } |
3265 | | |
3266 | | impl Arch { |
3267 | | #[inline(always)] |
3268 | | pub fn new() -> Self { |
3269 | | Self::Scalar |
3270 | | } |
3271 | | |
3272 | | #[inline(always)] |
3273 | | pub fn dispatch<Op: WithSimd>(self, op: Op) -> Op::Output { |
3274 | | op.with_simd(Scalar) |
3275 | | } |
3276 | | } |
3277 | | impl Default for Arch { |
3278 | | #[inline] |
3279 | | fn default() -> Self { |
3280 | | Self::new() |
3281 | | } |
3282 | | } |
3283 | | }, |
3284 | | } |
3285 | | ); |
3286 | | |
3287 | | #[doc(hidden)] |
3288 | | pub struct CheckSameSize<T, U>(PhantomData<(T, U)>); |
3289 | | impl<T, U> CheckSameSize<T, U> { |
3290 | | pub const VALID: () = { |
3291 | | assert!(core::mem::size_of::<T>() == core::mem::size_of::<U>()); |
3292 | | }; |
3293 | | } |
3294 | | |
3295 | | #[doc(hidden)] |
3296 | | pub struct CheckSizeLessThanOrEqual<T, U>(PhantomData<(T, U)>); |
3297 | | impl<T, U> CheckSizeLessThanOrEqual<T, U> { |
3298 | | pub const VALID: () = { |
3299 | | assert!(core::mem::size_of::<T>() <= core::mem::size_of::<U>()); |
3300 | | }; |
3301 | | } |
3302 | | |
3303 | | #[macro_export] |
3304 | | macro_rules! static_assert_same_size { |
3305 | | ($t: ty, $u: ty) => { |
3306 | | let _ = $crate::CheckSameSize::<$t, $u>::VALID; |
3307 | | }; |
3308 | | } |
3309 | | #[macro_export] |
3310 | | macro_rules! static_assert_size_less_than_or_equal { |
3311 | | ($t: ty, $u: ty) => { |
3312 | | let _ = $crate::CheckSizeLessThanOrEqual::<$t, $u>::VALID; |
3313 | | }; |
3314 | | } |
3315 | | |
3316 | | /// Safe transmute function. |
3317 | | /// |
3318 | | /// This function asserts at compile time that the two types have the same size. |
3319 | | #[inline(always)] |
3320 | 0 | pub const fn cast<T: NoUninit, U: AnyBitPattern>(value: T) -> U { |
3321 | 0 | static_assert_same_size!(T, U); |
3322 | 0 | let ptr = &raw const value as *const U; |
3323 | 0 | unsafe { ptr.read_unaligned() } |
3324 | 0 | } Unexecuted instantiation: pulp::cast::<pulp::f32x4, pulp::u32x4> Unexecuted instantiation: pulp::cast::<pulp::f64x2, pulp::u64x2> Unexecuted instantiation: pulp::cast::<pulp::u32x4, pulp::f32x4> Unexecuted instantiation: pulp::cast::<pulp::u64x2, pulp::f64x2> |
3325 | | |
3326 | | /// Safe lossy transmute function, where the destination type may be smaller than the source type. |
3327 | | /// |
3328 | | /// This property is checked at compile time. |
3329 | | #[inline(always)] |
3330 | 0 | pub const fn cast_lossy<T: NoUninit, U: AnyBitPattern>(value: T) -> U { |
3331 | 0 | static_assert_size_less_than_or_equal!(U, T); |
3332 | 0 | let value = core::mem::ManuallyDrop::new(value); |
3333 | 0 | let ptr = &raw const value as *const U; |
3334 | 0 | unsafe { ptr.read_unaligned() } |
3335 | 0 | } |
3336 | | |
3337 | | /// Splits a slice into chunks of equal size (known at compile time). |
3338 | | /// |
3339 | | /// Returns the chunks and the remaining section of the input slice. |
3340 | | #[inline(always)] |
3341 | 0 | pub fn as_arrays<const N: usize, T>(slice: &[T]) -> (&[[T; N]], &[T]) { |
3342 | 0 | let n = slice.len(); |
3343 | 0 | let mid_div_n = n / N; |
3344 | 0 | let mid = mid_div_n * N; |
3345 | 0 | let ptr = slice.as_ptr(); |
3346 | | unsafe { |
3347 | 0 | ( |
3348 | 0 | from_raw_parts(ptr as *const [T; N], mid_div_n), |
3349 | 0 | from_raw_parts(ptr.add(mid), n - mid), |
3350 | 0 | ) |
3351 | | } |
3352 | 0 | } |
3353 | | |
3354 | | /// Splits a slice into chunks of equal size (known at compile time). |
3355 | | /// |
3356 | | /// Returns the chunks and the remaining section of the input slice. |
3357 | | #[inline(always)] |
3358 | 0 | pub fn as_arrays_mut<const N: usize, T>(slice: &mut [T]) -> (&mut [[T; N]], &mut [T]) { |
3359 | 0 | let n = slice.len(); |
3360 | 0 | let mid_div_n = n / N; |
3361 | 0 | let mid = mid_div_n * N; |
3362 | 0 | let ptr = slice.as_mut_ptr(); |
3363 | | unsafe { |
3364 | 0 | ( |
3365 | 0 | from_raw_parts_mut(ptr as *mut [T; N], mid_div_n), |
3366 | 0 | from_raw_parts_mut(ptr.add(mid), n - mid), |
3367 | 0 | ) |
3368 | | } |
3369 | 0 | } |
3370 | | |
3371 | | /// Platform dependent intrinsics. |
3372 | | pub mod core_arch; |
3373 | | |
3374 | | #[allow(unused_macros)] |
3375 | | macro_rules! inherit { |
3376 | | ({$( |
3377 | | $(#[$attr: meta])* |
3378 | | $(unsafe $($placeholder: lifetime)?)? |
3379 | | fn $func: ident(self |
3380 | | $(,$arg: ident: $ty: ty)* $(,)? |
3381 | | ) $(-> $ret: ty)?; |
3382 | | )*}) => { |
3383 | | $( |
3384 | | $(#[$attr])* |
3385 | | #[inline(always)] |
3386 | 0 | $(unsafe $($placeholder)?)? fn $func (self, $($arg: $ty,)*) $(-> $ret)? { |
3387 | 0 | (*self).$func ($($arg,)*) |
3388 | 0 | } Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_load_ptr_u8s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_load_ptr_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_load_ptr_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_load_ptr_u16s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_load_ptr_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_load_ptr_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_store_ptr_u8s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_store_ptr_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_store_ptr_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_store_ptr_u16s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_store_ptr_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_store_ptr_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::equal_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::equal_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::splat_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::splat_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::select_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::select_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::abs_max_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::abs_max_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_add_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_add_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_add_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_add_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::conj_mul_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::conj_mul_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_add_e_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_add_e_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_max_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_max_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_max_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_max_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_min_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_min_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_min_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_min_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_sum_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_sum_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_sum_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_sum_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::swap_re_im_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::swap_re_im_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::conj_mul_add_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::conj_mul_add_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_between_m32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mask_between_m64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::partial_load_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::partial_load_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::rotate_right_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::rotate_right_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::rotate_right_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::rotate_right_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::widening_mul_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::partial_store_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::partial_store_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::negate_mul_add_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::negate_mul_add_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_product_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::reduce_product_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::negate_mul_add_e_f32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::negate_mul_add_e_f64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::wrapping_dyn_shl_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::wrapping_dyn_shr_u32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::add_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::add_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::max_i64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::max_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::min_i64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::min_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_i64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::mul_u64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::neg_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::neg_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::sub_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::sub_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::abs2_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::abs2_c64s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::conj_c32s Unexecuted instantiation: <pulp::x86::v3::V3_256b as pulp::Simd>::conj_c64s |
3389 | | )* |
3390 | | }; |
3391 | | } |
3392 | | |
3393 | | #[allow(unused_macros)] |
3394 | | macro_rules! inherit_x2 { |
3395 | | ($base: expr, {$( |
3396 | | $(#[$attr: meta])* |
3397 | | $(unsafe $($placeholder: lifetime)?)? |
3398 | | fn $func: ident ($self: ident |
3399 | | $(,$arg: ident: $ty: ty)* $(,)? |
3400 | | ) $(-> $ret: ty)?; |
3401 | | )*}) => { |
3402 | | $( |
3403 | | $(#[$attr])* |
3404 | | #[inline(always)] |
3405 | 0 | $(unsafe $($placeholder)?)? fn $func ($self, $($arg: $ty,)*) $(-> $ret)? { |
3406 | 0 | $(let $arg: [_; 2] = cast!($arg);)* |
3407 | 0 | cast!([($base).$func ($($arg[0],)*), ($base).$func ($($arg[1],)*)]) |
3408 | 0 | } Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::select_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::select_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::abs_max_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::abs_max_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_add_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_add_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_add_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_add_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::conj_mul_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::conj_mul_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_add_e_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_add_e_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::swap_re_im_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::swap_re_im_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::conj_mul_add_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::conj_mul_add_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::negate_mul_add_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::negate_mul_add_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::negate_mul_add_e_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::negate_mul_add_e_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::wrapping_dyn_shl_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::wrapping_dyn_shr_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::less_than_or_equal_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::greater_than_or_equal_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_m8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_m8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_m16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_m32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_m64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::or_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_m8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_u8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::add_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_m32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_m64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::and_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::div_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::div_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::max_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::min_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::mul_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::neg_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::neg_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_m16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_m32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_m64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::not_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::sub_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_m16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_m32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_m64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::xor_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::abs2_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::abs2_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::conj_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::conj_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::equal_u8s |
3409 | | )* |
3410 | | }; |
3411 | | |
3412 | | ($base: expr, splat, {$( |
3413 | | $(#[$attr: meta])* |
3414 | | $(unsafe $($placeholder: lifetime)?)? |
3415 | | fn $func: ident ($self: ident |
3416 | | $(,$arg: ident: $ty: ty)* $(,)? |
3417 | | ) $(-> $ret: ty)?; |
3418 | | )*}) => { |
3419 | | $( |
3420 | | $(#[$attr])* |
3421 | | #[inline(always)] |
3422 | 0 | $(unsafe $($placeholder)?)? fn $func ($self, $($arg: $ty,)*) $(-> $ret)? { |
3423 | 0 | cast!([($base).$func ($($arg,)*), ($base).$func ($($arg,)*)]) |
3424 | 0 | } Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_c32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_c64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_f32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_f64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_i16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_i32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_i64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_u16s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_u32s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_u64s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_i8s Unexecuted instantiation: <pulp::x86::v3::V3_512b as pulp::Simd>::splat_u8s |
3425 | | )* |
3426 | | }; |
3427 | | |
3428 | | ($base: expr, wide, {$( |
3429 | | $(#[$attr: meta])* |
3430 | | $(unsafe $($placeholder: lifetime)?)? |
3431 | | fn $func: ident ($self: ident |
3432 | | $(,$arg: ident: $ty: ty)* $(,)? |
3433 | | ) $(-> $ret: ty)?; |
3434 | | )*}) => { |
3435 | | $( |
3436 | | $(#[$attr])* |
3437 | | #[inline(always)] |
3438 | 0 | $(unsafe $($placeholder)?)? fn $func ($self, $($arg: $ty,)*) $(-> $ret)? { |
3439 | 0 | $(let $arg: [_; 2] = cast!($arg);)* |
3440 | 0 | let (r0, r1) = ($base).$func ($($arg[0],)*); let (s0, s1) = ($base).$func ($($arg[1],)*); |
3441 | 0 | (cast!([r0, s0]), cast!([r1, s1])) |
3442 | 0 | } |
3443 | | )* |
3444 | | }; |
3445 | | } |
3446 | | |
3447 | | #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
3448 | | #[cfg_attr(docsrs, doc(cfg(any(target_arch = "x86", target_arch = "x86_64"))))] |
3449 | | /// Low level x86 API. |
3450 | | pub mod x86; |
3451 | | |
3452 | | #[cfg(target_arch = "wasm32")] |
3453 | | #[cfg_attr(docsrs, doc(cfg(target_arch = "wasm32")))] |
3454 | | /// Low level wasm API. |
3455 | | pub mod wasm; |
3456 | | |
3457 | | #[cfg(target_arch = "aarch64")] |
3458 | | #[cfg_attr(docsrs, doc(cfg(target_arch = "aarch64")))] |
3459 | | /// Low level aarch64 API. |
3460 | | pub mod aarch64; |
3461 | | |
3462 | | /// Mask type with 8 bits. Its bit pattern is either all ones or all zeros. Unsafe code must not |
3463 | | /// depend on this, however. |
3464 | | #[derive(Copy, Clone, PartialEq, Eq, Default)] |
3465 | | #[repr(transparent)] |
3466 | | pub struct m8(u8); |
3467 | | /// Mask type with 16 bits. Its bit pattern is either all ones or all zeros. Unsafe code must not |
3468 | | /// depend on this, however. |
3469 | | #[derive(Copy, Clone, PartialEq, Eq, Default)] |
3470 | | #[repr(transparent)] |
3471 | | pub struct m16(u16); |
3472 | | /// Mask type with 32 bits. Its bit pattern is either all ones or all zeros. Unsafe code must not |
3473 | | /// depend on this, however. |
3474 | | #[derive(Copy, Clone, PartialEq, Eq, Default)] |
3475 | | #[repr(transparent)] |
3476 | | pub struct m32(u32); |
3477 | | /// Mask type with 64 bits. Its bit pattern is either all ones or all zeros. Unsafe code must not |
3478 | | /// depend on this, however. |
3479 | | #[derive(Copy, Clone, PartialEq, Eq, Default)] |
3480 | | #[repr(transparent)] |
3481 | | pub struct m64(u64); |
3482 | | |
3483 | | /// Bitmask type for 8 elements, used for mask operations on AVX512. |
3484 | | #[derive(Copy, Clone, PartialEq, Eq)] |
3485 | | #[repr(transparent)] |
3486 | | pub struct b8(pub u8); |
3487 | | /// Bitmask type for 16 elements, used for mask operations on AVX512. |
3488 | | #[derive(Copy, Clone, PartialEq, Eq)] |
3489 | | #[repr(transparent)] |
3490 | | pub struct b16(pub u16); |
3491 | | /// Bitmask type for 32 elements, used for mask operations on AVX512. |
3492 | | #[derive(Copy, Clone, PartialEq, Eq)] |
3493 | | #[repr(transparent)] |
3494 | | pub struct b32(pub u32); |
3495 | | /// Bitmask type for 64 elements, used for mask operations on AVX512. |
3496 | | #[derive(Copy, Clone, PartialEq, Eq)] |
3497 | | #[repr(transparent)] |
3498 | | pub struct b64(pub u64); |
3499 | | |
3500 | | impl core::ops::Not for b8 { |
3501 | | type Output = b8; |
3502 | | |
3503 | | #[inline(always)] |
3504 | 0 | fn not(self) -> Self::Output { |
3505 | 0 | b8(!self.0) |
3506 | 0 | } |
3507 | | } |
3508 | | impl core::ops::BitAnd for b8 { |
3509 | | type Output = b8; |
3510 | | |
3511 | | #[inline(always)] |
3512 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3513 | 0 | b8(self.0 & rhs.0) |
3514 | 0 | } |
3515 | | } |
3516 | | impl core::ops::BitOr for b8 { |
3517 | | type Output = b8; |
3518 | | |
3519 | | #[inline(always)] |
3520 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3521 | 0 | b8(self.0 | rhs.0) |
3522 | 0 | } |
3523 | | } |
3524 | | impl core::ops::BitXor for b8 { |
3525 | | type Output = b8; |
3526 | | |
3527 | | #[inline(always)] |
3528 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3529 | 0 | b8(self.0 ^ rhs.0) |
3530 | 0 | } |
3531 | | } |
3532 | | |
3533 | | impl core::ops::Not for m8 { |
3534 | | type Output = m8; |
3535 | | |
3536 | | #[inline(always)] |
3537 | 0 | fn not(self) -> Self::Output { |
3538 | 0 | m8(!self.0) |
3539 | 0 | } |
3540 | | } |
3541 | | impl core::ops::BitAnd for m8 { |
3542 | | type Output = m8; |
3543 | | |
3544 | | #[inline(always)] |
3545 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3546 | 0 | m8(self.0 & rhs.0) |
3547 | 0 | } |
3548 | | } |
3549 | | impl core::ops::BitOr for m8 { |
3550 | | type Output = m8; |
3551 | | |
3552 | | #[inline(always)] |
3553 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3554 | 0 | m8(self.0 | rhs.0) |
3555 | 0 | } |
3556 | | } |
3557 | | impl core::ops::BitXor for m8 { |
3558 | | type Output = m8; |
3559 | | |
3560 | | #[inline(always)] |
3561 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3562 | 0 | m8(self.0 ^ rhs.0) |
3563 | 0 | } |
3564 | | } |
3565 | | |
3566 | | impl core::ops::Not for m16 { |
3567 | | type Output = m16; |
3568 | | |
3569 | | #[inline(always)] |
3570 | 0 | fn not(self) -> Self::Output { |
3571 | 0 | m16(!self.0) |
3572 | 0 | } |
3573 | | } |
3574 | | impl core::ops::BitAnd for m16 { |
3575 | | type Output = m16; |
3576 | | |
3577 | | #[inline(always)] |
3578 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3579 | 0 | m16(self.0 & rhs.0) |
3580 | 0 | } |
3581 | | } |
3582 | | impl core::ops::BitOr for m16 { |
3583 | | type Output = m16; |
3584 | | |
3585 | | #[inline(always)] |
3586 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3587 | 0 | m16(self.0 | rhs.0) |
3588 | 0 | } |
3589 | | } |
3590 | | impl core::ops::BitXor for m16 { |
3591 | | type Output = m16; |
3592 | | |
3593 | | #[inline(always)] |
3594 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3595 | 0 | m16(self.0 ^ rhs.0) |
3596 | 0 | } |
3597 | | } |
3598 | | |
3599 | | impl core::ops::Not for m32 { |
3600 | | type Output = m32; |
3601 | | |
3602 | | #[inline(always)] |
3603 | 0 | fn not(self) -> Self::Output { |
3604 | 0 | m32(!self.0) |
3605 | 0 | } |
3606 | | } |
3607 | | impl core::ops::BitAnd for m32 { |
3608 | | type Output = m32; |
3609 | | |
3610 | | #[inline(always)] |
3611 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3612 | 0 | m32(self.0 & rhs.0) |
3613 | 0 | } |
3614 | | } |
3615 | | impl core::ops::BitOr for m32 { |
3616 | | type Output = m32; |
3617 | | |
3618 | | #[inline(always)] |
3619 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3620 | 0 | m32(self.0 | rhs.0) |
3621 | 0 | } |
3622 | | } |
3623 | | impl core::ops::BitXor for m32 { |
3624 | | type Output = m32; |
3625 | | |
3626 | | #[inline(always)] |
3627 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3628 | 0 | m32(self.0 ^ rhs.0) |
3629 | 0 | } |
3630 | | } |
3631 | | |
3632 | | impl core::ops::Not for m64 { |
3633 | | type Output = m64; |
3634 | | |
3635 | | #[inline(always)] |
3636 | 0 | fn not(self) -> Self::Output { |
3637 | 0 | m64(!self.0) |
3638 | 0 | } |
3639 | | } |
3640 | | impl core::ops::BitAnd for m64 { |
3641 | | type Output = m64; |
3642 | | |
3643 | | #[inline(always)] |
3644 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3645 | 0 | m64(self.0 & rhs.0) |
3646 | 0 | } |
3647 | | } |
3648 | | impl core::ops::BitOr for m64 { |
3649 | | type Output = m64; |
3650 | | |
3651 | | #[inline(always)] |
3652 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3653 | 0 | m64(self.0 | rhs.0) |
3654 | 0 | } |
3655 | | } |
3656 | | impl core::ops::BitXor for m64 { |
3657 | | type Output = m64; |
3658 | | |
3659 | | #[inline(always)] |
3660 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3661 | 0 | m64(self.0 ^ rhs.0) |
3662 | 0 | } |
3663 | | } |
3664 | | |
3665 | | impl core::ops::Not for b16 { |
3666 | | type Output = b16; |
3667 | | |
3668 | | #[inline(always)] |
3669 | 0 | fn not(self) -> Self::Output { |
3670 | 0 | b16(!self.0) |
3671 | 0 | } |
3672 | | } |
3673 | | impl core::ops::BitAnd for b16 { |
3674 | | type Output = b16; |
3675 | | |
3676 | | #[inline(always)] |
3677 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3678 | 0 | b16(self.0 & rhs.0) |
3679 | 0 | } |
3680 | | } |
3681 | | impl core::ops::BitOr for b16 { |
3682 | | type Output = b16; |
3683 | | |
3684 | | #[inline(always)] |
3685 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3686 | 0 | b16(self.0 | rhs.0) |
3687 | 0 | } |
3688 | | } |
3689 | | impl core::ops::BitXor for b16 { |
3690 | | type Output = b16; |
3691 | | |
3692 | | #[inline(always)] |
3693 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3694 | 0 | b16(self.0 ^ rhs.0) |
3695 | 0 | } |
3696 | | } |
3697 | | |
3698 | | impl core::ops::Not for b32 { |
3699 | | type Output = b32; |
3700 | | |
3701 | | #[inline(always)] |
3702 | 0 | fn not(self) -> Self::Output { |
3703 | 0 | b32(!self.0) |
3704 | 0 | } |
3705 | | } |
3706 | | impl core::ops::BitAnd for b32 { |
3707 | | type Output = b32; |
3708 | | |
3709 | | #[inline(always)] |
3710 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3711 | 0 | b32(self.0 & rhs.0) |
3712 | 0 | } |
3713 | | } |
3714 | | impl core::ops::BitOr for b32 { |
3715 | | type Output = b32; |
3716 | | |
3717 | | #[inline(always)] |
3718 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3719 | 0 | b32(self.0 | rhs.0) |
3720 | 0 | } |
3721 | | } |
3722 | | impl core::ops::BitXor for b32 { |
3723 | | type Output = b32; |
3724 | | |
3725 | | #[inline(always)] |
3726 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3727 | 0 | b32(self.0 ^ rhs.0) |
3728 | 0 | } |
3729 | | } |
3730 | | |
3731 | | impl core::ops::Not for b64 { |
3732 | | type Output = b64; |
3733 | | |
3734 | | #[inline(always)] |
3735 | 0 | fn not(self) -> Self::Output { |
3736 | 0 | b64(!self.0) |
3737 | 0 | } |
3738 | | } |
3739 | | impl core::ops::BitAnd for b64 { |
3740 | | type Output = b64; |
3741 | | |
3742 | | #[inline(always)] |
3743 | 0 | fn bitand(self, rhs: Self) -> Self::Output { |
3744 | 0 | b64(self.0 & rhs.0) |
3745 | 0 | } |
3746 | | } |
3747 | | impl core::ops::BitOr for b64 { |
3748 | | type Output = b64; |
3749 | | |
3750 | | #[inline(always)] |
3751 | 0 | fn bitor(self, rhs: Self) -> Self::Output { |
3752 | 0 | b64(self.0 | rhs.0) |
3753 | 0 | } |
3754 | | } |
3755 | | impl core::ops::BitXor for b64 { |
3756 | | type Output = b64; |
3757 | | |
3758 | | #[inline(always)] |
3759 | 0 | fn bitxor(self, rhs: Self) -> Self::Output { |
3760 | 0 | b64(self.0 ^ rhs.0) |
3761 | 0 | } |
3762 | | } |
3763 | | |
3764 | | impl Debug for b8 { |
3765 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
3766 | | #[allow(dead_code)] |
3767 | | #[derive(Copy, Clone, Debug)] |
3768 | | struct b8(bool, bool, bool, bool, bool, bool, bool, bool); |
3769 | 0 | b8( |
3770 | 0 | ((self.0 >> 0) & 1) == 1, |
3771 | 0 | ((self.0 >> 1) & 1) == 1, |
3772 | 0 | ((self.0 >> 2) & 1) == 1, |
3773 | 0 | ((self.0 >> 3) & 1) == 1, |
3774 | 0 | ((self.0 >> 4) & 1) == 1, |
3775 | 0 | ((self.0 >> 5) & 1) == 1, |
3776 | 0 | ((self.0 >> 6) & 1) == 1, |
3777 | 0 | ((self.0 >> 7) & 1) == 1, |
3778 | 0 | ) |
3779 | 0 | .fmt(f) |
3780 | 0 | } |
3781 | | } |
3782 | | impl Debug for b16 { |
3783 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
3784 | | #[allow(dead_code)] |
3785 | | #[derive(Copy, Clone, Debug)] |
3786 | | struct b16( |
3787 | | bool, |
3788 | | bool, |
3789 | | bool, |
3790 | | bool, |
3791 | | bool, |
3792 | | bool, |
3793 | | bool, |
3794 | | bool, |
3795 | | bool, |
3796 | | bool, |
3797 | | bool, |
3798 | | bool, |
3799 | | bool, |
3800 | | bool, |
3801 | | bool, |
3802 | | bool, |
3803 | | ); |
3804 | 0 | b16( |
3805 | 0 | ((self.0 >> 00) & 1) == 1, |
3806 | 0 | ((self.0 >> 01) & 1) == 1, |
3807 | 0 | ((self.0 >> 02) & 1) == 1, |
3808 | 0 | ((self.0 >> 03) & 1) == 1, |
3809 | 0 | ((self.0 >> 04) & 1) == 1, |
3810 | 0 | ((self.0 >> 05) & 1) == 1, |
3811 | 0 | ((self.0 >> 06) & 1) == 1, |
3812 | 0 | ((self.0 >> 07) & 1) == 1, |
3813 | 0 | ((self.0 >> 08) & 1) == 1, |
3814 | 0 | ((self.0 >> 09) & 1) == 1, |
3815 | 0 | ((self.0 >> 10) & 1) == 1, |
3816 | 0 | ((self.0 >> 11) & 1) == 1, |
3817 | 0 | ((self.0 >> 12) & 1) == 1, |
3818 | 0 | ((self.0 >> 13) & 1) == 1, |
3819 | 0 | ((self.0 >> 14) & 1) == 1, |
3820 | 0 | ((self.0 >> 15) & 1) == 1, |
3821 | 0 | ) |
3822 | 0 | .fmt(f) |
3823 | 0 | } |
3824 | | } |
3825 | | impl Debug for b32 { |
3826 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
3827 | | #[allow(dead_code)] |
3828 | | #[derive(Copy, Clone, Debug)] |
3829 | | struct b32( |
3830 | | bool, |
3831 | | bool, |
3832 | | bool, |
3833 | | bool, |
3834 | | bool, |
3835 | | bool, |
3836 | | bool, |
3837 | | bool, |
3838 | | bool, |
3839 | | bool, |
3840 | | bool, |
3841 | | bool, |
3842 | | bool, |
3843 | | bool, |
3844 | | bool, |
3845 | | bool, |
3846 | | bool, |
3847 | | bool, |
3848 | | bool, |
3849 | | bool, |
3850 | | bool, |
3851 | | bool, |
3852 | | bool, |
3853 | | bool, |
3854 | | bool, |
3855 | | bool, |
3856 | | bool, |
3857 | | bool, |
3858 | | bool, |
3859 | | bool, |
3860 | | bool, |
3861 | | bool, |
3862 | | ); |
3863 | 0 | b32( |
3864 | 0 | ((self.0 >> 00) & 1) == 1, |
3865 | 0 | ((self.0 >> 01) & 1) == 1, |
3866 | 0 | ((self.0 >> 02) & 1) == 1, |
3867 | 0 | ((self.0 >> 03) & 1) == 1, |
3868 | 0 | ((self.0 >> 04) & 1) == 1, |
3869 | 0 | ((self.0 >> 05) & 1) == 1, |
3870 | 0 | ((self.0 >> 06) & 1) == 1, |
3871 | 0 | ((self.0 >> 07) & 1) == 1, |
3872 | 0 | ((self.0 >> 08) & 1) == 1, |
3873 | 0 | ((self.0 >> 09) & 1) == 1, |
3874 | 0 | ((self.0 >> 10) & 1) == 1, |
3875 | 0 | ((self.0 >> 11) & 1) == 1, |
3876 | 0 | ((self.0 >> 12) & 1) == 1, |
3877 | 0 | ((self.0 >> 13) & 1) == 1, |
3878 | 0 | ((self.0 >> 14) & 1) == 1, |
3879 | 0 | ((self.0 >> 15) & 1) == 1, |
3880 | 0 | ((self.0 >> 16) & 1) == 1, |
3881 | 0 | ((self.0 >> 17) & 1) == 1, |
3882 | 0 | ((self.0 >> 18) & 1) == 1, |
3883 | 0 | ((self.0 >> 19) & 1) == 1, |
3884 | 0 | ((self.0 >> 20) & 1) == 1, |
3885 | 0 | ((self.0 >> 21) & 1) == 1, |
3886 | 0 | ((self.0 >> 22) & 1) == 1, |
3887 | 0 | ((self.0 >> 23) & 1) == 1, |
3888 | 0 | ((self.0 >> 24) & 1) == 1, |
3889 | 0 | ((self.0 >> 25) & 1) == 1, |
3890 | 0 | ((self.0 >> 26) & 1) == 1, |
3891 | 0 | ((self.0 >> 27) & 1) == 1, |
3892 | 0 | ((self.0 >> 28) & 1) == 1, |
3893 | 0 | ((self.0 >> 29) & 1) == 1, |
3894 | 0 | ((self.0 >> 30) & 1) == 1, |
3895 | 0 | ((self.0 >> 31) & 1) == 1, |
3896 | 0 | ) |
3897 | 0 | .fmt(f) |
3898 | 0 | } |
3899 | | } |
3900 | | impl Debug for b64 { |
3901 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
3902 | | #[allow(dead_code)] |
3903 | | #[derive(Copy, Clone, Debug)] |
3904 | | struct b64( |
3905 | | bool, |
3906 | | bool, |
3907 | | bool, |
3908 | | bool, |
3909 | | bool, |
3910 | | bool, |
3911 | | bool, |
3912 | | bool, |
3913 | | bool, |
3914 | | bool, |
3915 | | bool, |
3916 | | bool, |
3917 | | bool, |
3918 | | bool, |
3919 | | bool, |
3920 | | bool, |
3921 | | bool, |
3922 | | bool, |
3923 | | bool, |
3924 | | bool, |
3925 | | bool, |
3926 | | bool, |
3927 | | bool, |
3928 | | bool, |
3929 | | bool, |
3930 | | bool, |
3931 | | bool, |
3932 | | bool, |
3933 | | bool, |
3934 | | bool, |
3935 | | bool, |
3936 | | bool, |
3937 | | bool, |
3938 | | bool, |
3939 | | bool, |
3940 | | bool, |
3941 | | bool, |
3942 | | bool, |
3943 | | bool, |
3944 | | bool, |
3945 | | bool, |
3946 | | bool, |
3947 | | bool, |
3948 | | bool, |
3949 | | bool, |
3950 | | bool, |
3951 | | bool, |
3952 | | bool, |
3953 | | bool, |
3954 | | bool, |
3955 | | bool, |
3956 | | bool, |
3957 | | bool, |
3958 | | bool, |
3959 | | bool, |
3960 | | bool, |
3961 | | bool, |
3962 | | bool, |
3963 | | bool, |
3964 | | bool, |
3965 | | bool, |
3966 | | bool, |
3967 | | bool, |
3968 | | bool, |
3969 | | ); |
3970 | 0 | b64( |
3971 | 0 | ((self.0 >> 00) & 1) == 1, |
3972 | 0 | ((self.0 >> 01) & 1) == 1, |
3973 | 0 | ((self.0 >> 02) & 1) == 1, |
3974 | 0 | ((self.0 >> 03) & 1) == 1, |
3975 | 0 | ((self.0 >> 04) & 1) == 1, |
3976 | 0 | ((self.0 >> 05) & 1) == 1, |
3977 | 0 | ((self.0 >> 06) & 1) == 1, |
3978 | 0 | ((self.0 >> 07) & 1) == 1, |
3979 | 0 | ((self.0 >> 08) & 1) == 1, |
3980 | 0 | ((self.0 >> 09) & 1) == 1, |
3981 | 0 | ((self.0 >> 10) & 1) == 1, |
3982 | 0 | ((self.0 >> 11) & 1) == 1, |
3983 | 0 | ((self.0 >> 12) & 1) == 1, |
3984 | 0 | ((self.0 >> 13) & 1) == 1, |
3985 | 0 | ((self.0 >> 14) & 1) == 1, |
3986 | 0 | ((self.0 >> 15) & 1) == 1, |
3987 | 0 | ((self.0 >> 16) & 1) == 1, |
3988 | 0 | ((self.0 >> 17) & 1) == 1, |
3989 | 0 | ((self.0 >> 18) & 1) == 1, |
3990 | 0 | ((self.0 >> 19) & 1) == 1, |
3991 | 0 | ((self.0 >> 20) & 1) == 1, |
3992 | 0 | ((self.0 >> 21) & 1) == 1, |
3993 | 0 | ((self.0 >> 22) & 1) == 1, |
3994 | 0 | ((self.0 >> 23) & 1) == 1, |
3995 | 0 | ((self.0 >> 24) & 1) == 1, |
3996 | 0 | ((self.0 >> 25) & 1) == 1, |
3997 | 0 | ((self.0 >> 26) & 1) == 1, |
3998 | 0 | ((self.0 >> 27) & 1) == 1, |
3999 | 0 | ((self.0 >> 28) & 1) == 1, |
4000 | 0 | ((self.0 >> 29) & 1) == 1, |
4001 | 0 | ((self.0 >> 30) & 1) == 1, |
4002 | 0 | ((self.0 >> 31) & 1) == 1, |
4003 | 0 | ((self.0 >> 32) & 1) == 1, |
4004 | 0 | ((self.0 >> 33) & 1) == 1, |
4005 | 0 | ((self.0 >> 34) & 1) == 1, |
4006 | 0 | ((self.0 >> 35) & 1) == 1, |
4007 | 0 | ((self.0 >> 36) & 1) == 1, |
4008 | 0 | ((self.0 >> 37) & 1) == 1, |
4009 | 0 | ((self.0 >> 38) & 1) == 1, |
4010 | 0 | ((self.0 >> 39) & 1) == 1, |
4011 | 0 | ((self.0 >> 40) & 1) == 1, |
4012 | 0 | ((self.0 >> 41) & 1) == 1, |
4013 | 0 | ((self.0 >> 42) & 1) == 1, |
4014 | 0 | ((self.0 >> 43) & 1) == 1, |
4015 | 0 | ((self.0 >> 44) & 1) == 1, |
4016 | 0 | ((self.0 >> 45) & 1) == 1, |
4017 | 0 | ((self.0 >> 46) & 1) == 1, |
4018 | 0 | ((self.0 >> 47) & 1) == 1, |
4019 | 0 | ((self.0 >> 48) & 1) == 1, |
4020 | 0 | ((self.0 >> 49) & 1) == 1, |
4021 | 0 | ((self.0 >> 50) & 1) == 1, |
4022 | 0 | ((self.0 >> 51) & 1) == 1, |
4023 | 0 | ((self.0 >> 52) & 1) == 1, |
4024 | 0 | ((self.0 >> 53) & 1) == 1, |
4025 | 0 | ((self.0 >> 54) & 1) == 1, |
4026 | 0 | ((self.0 >> 55) & 1) == 1, |
4027 | 0 | ((self.0 >> 56) & 1) == 1, |
4028 | 0 | ((self.0 >> 57) & 1) == 1, |
4029 | 0 | ((self.0 >> 58) & 1) == 1, |
4030 | 0 | ((self.0 >> 59) & 1) == 1, |
4031 | 0 | ((self.0 >> 60) & 1) == 1, |
4032 | 0 | ((self.0 >> 61) & 1) == 1, |
4033 | 0 | ((self.0 >> 62) & 1) == 1, |
4034 | 0 | ((self.0 >> 63) & 1) == 1, |
4035 | 0 | ) |
4036 | 0 | .fmt(f) |
4037 | 0 | } |
4038 | | } |
4039 | | |
4040 | | impl Debug for m8 { |
4041 | | #[inline] |
4042 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
4043 | 0 | self.is_set().fmt(f) |
4044 | 0 | } |
4045 | | } |
4046 | | impl Debug for m16 { |
4047 | | #[inline] |
4048 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
4049 | 0 | self.is_set().fmt(f) |
4050 | 0 | } |
4051 | | } |
4052 | | impl Debug for m32 { |
4053 | | #[inline] |
4054 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
4055 | 0 | self.is_set().fmt(f) |
4056 | 0 | } |
4057 | | } |
4058 | | impl Debug for m64 { |
4059 | | #[inline] |
4060 | 0 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
4061 | 0 | self.is_set().fmt(f) |
4062 | 0 | } |
4063 | | } |
4064 | | |
4065 | | impl m8 { |
4066 | | /// Returns a mask with all bits set one, if `flag` is true, otherwise returns a mask with all |
4067 | | /// bits set to zero. |
4068 | | #[inline(always)] |
4069 | 0 | pub const fn new(flag: bool) -> Self { |
4070 | 0 | Self(if flag { u8::MAX } else { 0 }) |
4071 | 0 | } |
4072 | | |
4073 | | /// Returns `false` if the mask bits are all zero, otherwise returns `true`. |
4074 | | #[inline(always)] |
4075 | 0 | pub const fn is_set(self) -> bool { |
4076 | 0 | self.0 != 0 |
4077 | 0 | } |
4078 | | } |
4079 | | impl m16 { |
4080 | | /// Returns a mask with all bits set one, if `flag` is true, otherwise returns a mask with all |
4081 | | /// bits set to zero. |
4082 | | #[inline(always)] |
4083 | 0 | pub const fn new(flag: bool) -> Self { |
4084 | 0 | Self(if flag { u16::MAX } else { 0 }) |
4085 | 0 | } |
4086 | | |
4087 | | /// Returns `false` if the mask bits are all zero, otherwise returns `true`. |
4088 | | #[inline(always)] |
4089 | 0 | pub const fn is_set(self) -> bool { |
4090 | 0 | self.0 != 0 |
4091 | 0 | } |
4092 | | } |
4093 | | impl m32 { |
4094 | | /// Returns a mask with all bits set one, if `flag` is true, otherwise returns a mask with all |
4095 | | /// bits set to zero. |
4096 | | #[inline(always)] |
4097 | 0 | pub const fn new(flag: bool) -> Self { |
4098 | 0 | Self(if flag { u32::MAX } else { 0 }) |
4099 | 0 | } |
4100 | | |
4101 | | /// Returns `false` if the mask bits are all zero, otherwise returns `true`. |
4102 | | #[inline(always)] |
4103 | 0 | pub const fn is_set(self) -> bool { |
4104 | 0 | self.0 != 0 |
4105 | 0 | } |
4106 | | } |
4107 | | impl m64 { |
4108 | | /// Returns a mask with all bits set one, if `flag` is true, otherwise returns a mask with all |
4109 | | /// bits set to zero. |
4110 | | #[inline(always)] |
4111 | 0 | pub const fn new(flag: bool) -> Self { |
4112 | 0 | Self(if flag { u64::MAX } else { 0 }) |
4113 | 0 | } |
4114 | | |
4115 | | /// Returns `false` if the mask bits are all zero, otherwise returns `true`. |
4116 | | #[inline(always)] |
4117 | 0 | pub const fn is_set(self) -> bool { |
4118 | 0 | self.0 != 0 |
4119 | 0 | } |
4120 | | } |
4121 | | |
4122 | | /// A 128-bit SIMD vector with 16 elements of type [`i8`]. |
4123 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4124 | | #[repr(C)] |
4125 | | pub struct i8x16( |
4126 | | pub i8, |
4127 | | pub i8, |
4128 | | pub i8, |
4129 | | pub i8, |
4130 | | pub i8, |
4131 | | pub i8, |
4132 | | pub i8, |
4133 | | pub i8, |
4134 | | pub i8, |
4135 | | pub i8, |
4136 | | pub i8, |
4137 | | pub i8, |
4138 | | pub i8, |
4139 | | pub i8, |
4140 | | pub i8, |
4141 | | pub i8, |
4142 | | ); |
4143 | | /// A 256-bit SIMD vector with 32 elements of type [`i8`]. |
4144 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4145 | | #[repr(C)] |
4146 | | pub struct i8x32( |
4147 | | pub i8, |
4148 | | pub i8, |
4149 | | pub i8, |
4150 | | pub i8, |
4151 | | pub i8, |
4152 | | pub i8, |
4153 | | pub i8, |
4154 | | pub i8, |
4155 | | pub i8, |
4156 | | pub i8, |
4157 | | pub i8, |
4158 | | pub i8, |
4159 | | pub i8, |
4160 | | pub i8, |
4161 | | pub i8, |
4162 | | pub i8, |
4163 | | pub i8, |
4164 | | pub i8, |
4165 | | pub i8, |
4166 | | pub i8, |
4167 | | pub i8, |
4168 | | pub i8, |
4169 | | pub i8, |
4170 | | pub i8, |
4171 | | pub i8, |
4172 | | pub i8, |
4173 | | pub i8, |
4174 | | pub i8, |
4175 | | pub i8, |
4176 | | pub i8, |
4177 | | pub i8, |
4178 | | pub i8, |
4179 | | ); |
4180 | | /// A 512-bit SIMD vector with 64 elements of type [`i8`]. |
4181 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4182 | | #[repr(C)] |
4183 | | pub struct i8x64( |
4184 | | pub i8, |
4185 | | pub i8, |
4186 | | pub i8, |
4187 | | pub i8, |
4188 | | pub i8, |
4189 | | pub i8, |
4190 | | pub i8, |
4191 | | pub i8, |
4192 | | pub i8, |
4193 | | pub i8, |
4194 | | pub i8, |
4195 | | pub i8, |
4196 | | pub i8, |
4197 | | pub i8, |
4198 | | pub i8, |
4199 | | pub i8, |
4200 | | pub i8, |
4201 | | pub i8, |
4202 | | pub i8, |
4203 | | pub i8, |
4204 | | pub i8, |
4205 | | pub i8, |
4206 | | pub i8, |
4207 | | pub i8, |
4208 | | pub i8, |
4209 | | pub i8, |
4210 | | pub i8, |
4211 | | pub i8, |
4212 | | pub i8, |
4213 | | pub i8, |
4214 | | pub i8, |
4215 | | pub i8, |
4216 | | pub i8, |
4217 | | pub i8, |
4218 | | pub i8, |
4219 | | pub i8, |
4220 | | pub i8, |
4221 | | pub i8, |
4222 | | pub i8, |
4223 | | pub i8, |
4224 | | pub i8, |
4225 | | pub i8, |
4226 | | pub i8, |
4227 | | pub i8, |
4228 | | pub i8, |
4229 | | pub i8, |
4230 | | pub i8, |
4231 | | pub i8, |
4232 | | pub i8, |
4233 | | pub i8, |
4234 | | pub i8, |
4235 | | pub i8, |
4236 | | pub i8, |
4237 | | pub i8, |
4238 | | pub i8, |
4239 | | pub i8, |
4240 | | pub i8, |
4241 | | pub i8, |
4242 | | pub i8, |
4243 | | pub i8, |
4244 | | pub i8, |
4245 | | pub i8, |
4246 | | pub i8, |
4247 | | pub i8, |
4248 | | ); |
4249 | | |
4250 | | /// A 128-bit SIMD vector with 16 elements of type [`u8`]. |
4251 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4252 | | #[repr(C)] |
4253 | | pub struct u8x16( |
4254 | | pub u8, |
4255 | | pub u8, |
4256 | | pub u8, |
4257 | | pub u8, |
4258 | | pub u8, |
4259 | | pub u8, |
4260 | | pub u8, |
4261 | | pub u8, |
4262 | | pub u8, |
4263 | | pub u8, |
4264 | | pub u8, |
4265 | | pub u8, |
4266 | | pub u8, |
4267 | | pub u8, |
4268 | | pub u8, |
4269 | | pub u8, |
4270 | | ); |
4271 | | /// A 256-bit SIMD vector with 32 elements of type [`u8`]. |
4272 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4273 | | #[repr(C)] |
4274 | | pub struct u8x32( |
4275 | | pub u8, |
4276 | | pub u8, |
4277 | | pub u8, |
4278 | | pub u8, |
4279 | | pub u8, |
4280 | | pub u8, |
4281 | | pub u8, |
4282 | | pub u8, |
4283 | | pub u8, |
4284 | | pub u8, |
4285 | | pub u8, |
4286 | | pub u8, |
4287 | | pub u8, |
4288 | | pub u8, |
4289 | | pub u8, |
4290 | | pub u8, |
4291 | | pub u8, |
4292 | | pub u8, |
4293 | | pub u8, |
4294 | | pub u8, |
4295 | | pub u8, |
4296 | | pub u8, |
4297 | | pub u8, |
4298 | | pub u8, |
4299 | | pub u8, |
4300 | | pub u8, |
4301 | | pub u8, |
4302 | | pub u8, |
4303 | | pub u8, |
4304 | | pub u8, |
4305 | | pub u8, |
4306 | | pub u8, |
4307 | | ); |
4308 | | /// A 512-bit SIMD vector with 64 elements of type [`u8`]. |
4309 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4310 | | #[repr(C)] |
4311 | | pub struct u8x64( |
4312 | | pub u8, |
4313 | | pub u8, |
4314 | | pub u8, |
4315 | | pub u8, |
4316 | | pub u8, |
4317 | | pub u8, |
4318 | | pub u8, |
4319 | | pub u8, |
4320 | | pub u8, |
4321 | | pub u8, |
4322 | | pub u8, |
4323 | | pub u8, |
4324 | | pub u8, |
4325 | | pub u8, |
4326 | | pub u8, |
4327 | | pub u8, |
4328 | | pub u8, |
4329 | | pub u8, |
4330 | | pub u8, |
4331 | | pub u8, |
4332 | | pub u8, |
4333 | | pub u8, |
4334 | | pub u8, |
4335 | | pub u8, |
4336 | | pub u8, |
4337 | | pub u8, |
4338 | | pub u8, |
4339 | | pub u8, |
4340 | | pub u8, |
4341 | | pub u8, |
4342 | | pub u8, |
4343 | | pub u8, |
4344 | | pub u8, |
4345 | | pub u8, |
4346 | | pub u8, |
4347 | | pub u8, |
4348 | | pub u8, |
4349 | | pub u8, |
4350 | | pub u8, |
4351 | | pub u8, |
4352 | | pub u8, |
4353 | | pub u8, |
4354 | | pub u8, |
4355 | | pub u8, |
4356 | | pub u8, |
4357 | | pub u8, |
4358 | | pub u8, |
4359 | | pub u8, |
4360 | | pub u8, |
4361 | | pub u8, |
4362 | | pub u8, |
4363 | | pub u8, |
4364 | | pub u8, |
4365 | | pub u8, |
4366 | | pub u8, |
4367 | | pub u8, |
4368 | | pub u8, |
4369 | | pub u8, |
4370 | | pub u8, |
4371 | | pub u8, |
4372 | | pub u8, |
4373 | | pub u8, |
4374 | | pub u8, |
4375 | | pub u8, |
4376 | | ); |
4377 | | |
4378 | | /// A 128-bit SIMD vector with 16 elements of type [`m8`]. |
4379 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4380 | | #[repr(C)] |
4381 | | pub struct m8x16( |
4382 | | pub m8, |
4383 | | pub m8, |
4384 | | pub m8, |
4385 | | pub m8, |
4386 | | pub m8, |
4387 | | pub m8, |
4388 | | pub m8, |
4389 | | pub m8, |
4390 | | pub m8, |
4391 | | pub m8, |
4392 | | pub m8, |
4393 | | pub m8, |
4394 | | pub m8, |
4395 | | pub m8, |
4396 | | pub m8, |
4397 | | pub m8, |
4398 | | ); |
4399 | | /// A 256-bit SIMD vector with 32 elements of type [`m8`]. |
4400 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4401 | | #[repr(C)] |
4402 | | pub struct m8x32( |
4403 | | pub m8, |
4404 | | pub m8, |
4405 | | pub m8, |
4406 | | pub m8, |
4407 | | pub m8, |
4408 | | pub m8, |
4409 | | pub m8, |
4410 | | pub m8, |
4411 | | pub m8, |
4412 | | pub m8, |
4413 | | pub m8, |
4414 | | pub m8, |
4415 | | pub m8, |
4416 | | pub m8, |
4417 | | pub m8, |
4418 | | pub m8, |
4419 | | pub m8, |
4420 | | pub m8, |
4421 | | pub m8, |
4422 | | pub m8, |
4423 | | pub m8, |
4424 | | pub m8, |
4425 | | pub m8, |
4426 | | pub m8, |
4427 | | pub m8, |
4428 | | pub m8, |
4429 | | pub m8, |
4430 | | pub m8, |
4431 | | pub m8, |
4432 | | pub m8, |
4433 | | pub m8, |
4434 | | pub m8, |
4435 | | ); |
4436 | | |
4437 | | /// A 512-bit SIMD vector with 64 elements of type [`m8`]. |
4438 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4439 | | #[repr(C)] |
4440 | | pub struct m8x64( |
4441 | | pub m8, |
4442 | | pub m8, |
4443 | | pub m8, |
4444 | | pub m8, |
4445 | | pub m8, |
4446 | | pub m8, |
4447 | | pub m8, |
4448 | | pub m8, |
4449 | | pub m8, |
4450 | | pub m8, |
4451 | | pub m8, |
4452 | | pub m8, |
4453 | | pub m8, |
4454 | | pub m8, |
4455 | | pub m8, |
4456 | | pub m8, |
4457 | | pub m8, |
4458 | | pub m8, |
4459 | | pub m8, |
4460 | | pub m8, |
4461 | | pub m8, |
4462 | | pub m8, |
4463 | | pub m8, |
4464 | | pub m8, |
4465 | | pub m8, |
4466 | | pub m8, |
4467 | | pub m8, |
4468 | | pub m8, |
4469 | | pub m8, |
4470 | | pub m8, |
4471 | | pub m8, |
4472 | | pub m8, |
4473 | | pub m8, |
4474 | | pub m8, |
4475 | | pub m8, |
4476 | | pub m8, |
4477 | | pub m8, |
4478 | | pub m8, |
4479 | | pub m8, |
4480 | | pub m8, |
4481 | | pub m8, |
4482 | | pub m8, |
4483 | | pub m8, |
4484 | | pub m8, |
4485 | | pub m8, |
4486 | | pub m8, |
4487 | | pub m8, |
4488 | | pub m8, |
4489 | | pub m8, |
4490 | | pub m8, |
4491 | | pub m8, |
4492 | | pub m8, |
4493 | | pub m8, |
4494 | | pub m8, |
4495 | | pub m8, |
4496 | | pub m8, |
4497 | | pub m8, |
4498 | | pub m8, |
4499 | | pub m8, |
4500 | | pub m8, |
4501 | | pub m8, |
4502 | | pub m8, |
4503 | | pub m8, |
4504 | | pub m8, |
4505 | | ); |
4506 | | |
4507 | | /// A 128-bit SIMD vector with 8 elements of type [`i16`]. |
4508 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4509 | | #[repr(C)] |
4510 | | pub struct i16x8( |
4511 | | pub i16, |
4512 | | pub i16, |
4513 | | pub i16, |
4514 | | pub i16, |
4515 | | pub i16, |
4516 | | pub i16, |
4517 | | pub i16, |
4518 | | pub i16, |
4519 | | ); |
4520 | | /// A 256-bit SIMD vector with 16 elements of type [`i16`]. |
4521 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4522 | | #[repr(C)] |
4523 | | pub struct i16x16( |
4524 | | pub i16, |
4525 | | pub i16, |
4526 | | pub i16, |
4527 | | pub i16, |
4528 | | pub i16, |
4529 | | pub i16, |
4530 | | pub i16, |
4531 | | pub i16, |
4532 | | pub i16, |
4533 | | pub i16, |
4534 | | pub i16, |
4535 | | pub i16, |
4536 | | pub i16, |
4537 | | pub i16, |
4538 | | pub i16, |
4539 | | pub i16, |
4540 | | ); |
4541 | | /// A 512-bit SIMD vector with 32 elements of type [`i16`]. |
4542 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4543 | | #[repr(C)] |
4544 | | pub struct i16x32( |
4545 | | pub i16, |
4546 | | pub i16, |
4547 | | pub i16, |
4548 | | pub i16, |
4549 | | pub i16, |
4550 | | pub i16, |
4551 | | pub i16, |
4552 | | pub i16, |
4553 | | pub i16, |
4554 | | pub i16, |
4555 | | pub i16, |
4556 | | pub i16, |
4557 | | pub i16, |
4558 | | pub i16, |
4559 | | pub i16, |
4560 | | pub i16, |
4561 | | pub i16, |
4562 | | pub i16, |
4563 | | pub i16, |
4564 | | pub i16, |
4565 | | pub i16, |
4566 | | pub i16, |
4567 | | pub i16, |
4568 | | pub i16, |
4569 | | pub i16, |
4570 | | pub i16, |
4571 | | pub i16, |
4572 | | pub i16, |
4573 | | pub i16, |
4574 | | pub i16, |
4575 | | pub i16, |
4576 | | pub i16, |
4577 | | ); |
4578 | | |
4579 | | /// A 128-bit SIMD vector with 8 elements of type [`u16`]. |
4580 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4581 | | #[repr(C)] |
4582 | | pub struct u16x8( |
4583 | | pub u16, |
4584 | | pub u16, |
4585 | | pub u16, |
4586 | | pub u16, |
4587 | | pub u16, |
4588 | | pub u16, |
4589 | | pub u16, |
4590 | | pub u16, |
4591 | | ); |
4592 | | /// A 256-bit SIMD vector with 16 elements of type [`u16`]. |
4593 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4594 | | #[repr(C)] |
4595 | | pub struct u16x16( |
4596 | | pub u16, |
4597 | | pub u16, |
4598 | | pub u16, |
4599 | | pub u16, |
4600 | | pub u16, |
4601 | | pub u16, |
4602 | | pub u16, |
4603 | | pub u16, |
4604 | | pub u16, |
4605 | | pub u16, |
4606 | | pub u16, |
4607 | | pub u16, |
4608 | | pub u16, |
4609 | | pub u16, |
4610 | | pub u16, |
4611 | | pub u16, |
4612 | | ); |
4613 | | /// A 512-bit SIMD vector with 32 elements of type [`u16`]. |
4614 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4615 | | #[repr(C)] |
4616 | | pub struct u16x32( |
4617 | | pub u16, |
4618 | | pub u16, |
4619 | | pub u16, |
4620 | | pub u16, |
4621 | | pub u16, |
4622 | | pub u16, |
4623 | | pub u16, |
4624 | | pub u16, |
4625 | | pub u16, |
4626 | | pub u16, |
4627 | | pub u16, |
4628 | | pub u16, |
4629 | | pub u16, |
4630 | | pub u16, |
4631 | | pub u16, |
4632 | | pub u16, |
4633 | | pub u16, |
4634 | | pub u16, |
4635 | | pub u16, |
4636 | | pub u16, |
4637 | | pub u16, |
4638 | | pub u16, |
4639 | | pub u16, |
4640 | | pub u16, |
4641 | | pub u16, |
4642 | | pub u16, |
4643 | | pub u16, |
4644 | | pub u16, |
4645 | | pub u16, |
4646 | | pub u16, |
4647 | | pub u16, |
4648 | | pub u16, |
4649 | | ); |
4650 | | |
4651 | | /// A 128-bit SIMD vector with 8 elements of type [`m16`]. |
4652 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4653 | | #[repr(C)] |
4654 | | pub struct m16x8( |
4655 | | pub m16, |
4656 | | pub m16, |
4657 | | pub m16, |
4658 | | pub m16, |
4659 | | pub m16, |
4660 | | pub m16, |
4661 | | pub m16, |
4662 | | pub m16, |
4663 | | ); |
4664 | | /// A 256-bit SIMD vector with 16 elements of type [`m16`]. |
4665 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4666 | | #[repr(C)] |
4667 | | pub struct m16x16( |
4668 | | pub m16, |
4669 | | pub m16, |
4670 | | pub m16, |
4671 | | pub m16, |
4672 | | pub m16, |
4673 | | pub m16, |
4674 | | pub m16, |
4675 | | pub m16, |
4676 | | pub m16, |
4677 | | pub m16, |
4678 | | pub m16, |
4679 | | pub m16, |
4680 | | pub m16, |
4681 | | pub m16, |
4682 | | pub m16, |
4683 | | pub m16, |
4684 | | ); |
4685 | | /// A 512-bit SIMD vector with 32 elements of type [`m16`]. |
4686 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4687 | | #[repr(C)] |
4688 | | pub struct m16x32( |
4689 | | pub m16, |
4690 | | pub m16, |
4691 | | pub m16, |
4692 | | pub m16, |
4693 | | pub m16, |
4694 | | pub m16, |
4695 | | pub m16, |
4696 | | pub m16, |
4697 | | pub m16, |
4698 | | pub m16, |
4699 | | pub m16, |
4700 | | pub m16, |
4701 | | pub m16, |
4702 | | pub m16, |
4703 | | pub m16, |
4704 | | pub m16, |
4705 | | pub m16, |
4706 | | pub m16, |
4707 | | pub m16, |
4708 | | pub m16, |
4709 | | pub m16, |
4710 | | pub m16, |
4711 | | pub m16, |
4712 | | pub m16, |
4713 | | pub m16, |
4714 | | pub m16, |
4715 | | pub m16, |
4716 | | pub m16, |
4717 | | pub m16, |
4718 | | pub m16, |
4719 | | pub m16, |
4720 | | pub m16, |
4721 | | ); |
4722 | | |
4723 | | /// A 128-bit SIMD vector with 4 elements of type [`f32`]. |
4724 | | #[derive(Debug, Copy, Clone, PartialEq)] |
4725 | | #[repr(C)] |
4726 | | pub struct f32x4(pub f32, pub f32, pub f32, pub f32); |
4727 | | |
4728 | | /// A 256-bit SIMD vector with 8 elements of type [`f32`]. |
4729 | | #[derive(Debug, Copy, Clone, PartialEq)] |
4730 | | #[repr(C)] |
4731 | | pub struct f32x8( |
4732 | | pub f32, |
4733 | | pub f32, |
4734 | | pub f32, |
4735 | | pub f32, |
4736 | | pub f32, |
4737 | | pub f32, |
4738 | | pub f32, |
4739 | | pub f32, |
4740 | | ); |
4741 | | /// A 512-bit SIMD vector with 16 elements of type [`f32`]. |
4742 | | #[derive(Debug, Copy, Clone, PartialEq)] |
4743 | | #[repr(C)] |
4744 | | pub struct f32x16( |
4745 | | pub f32, |
4746 | | pub f32, |
4747 | | pub f32, |
4748 | | pub f32, |
4749 | | pub f32, |
4750 | | pub f32, |
4751 | | pub f32, |
4752 | | pub f32, |
4753 | | pub f32, |
4754 | | pub f32, |
4755 | | pub f32, |
4756 | | pub f32, |
4757 | | pub f32, |
4758 | | pub f32, |
4759 | | pub f32, |
4760 | | pub f32, |
4761 | | ); |
4762 | | |
4763 | | /// A 128-bit SIMD vector with 2 elements of type [`c32`]. |
4764 | | #[derive(Copy, Clone, PartialEq)] |
4765 | | #[repr(C)] |
4766 | | pub struct c32x2(pub c32, pub c32); |
4767 | | |
4768 | | impl Debug for c32x2 { |
4769 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
4770 | | #[derive(Copy, Clone, Debug)] |
4771 | | #[repr(C)] |
4772 | | pub struct c32x2(pub DebugCplx<c32>, pub DebugCplx<c32>); |
4773 | | unsafe impl Zeroable for c32x2 {} |
4774 | | unsafe impl Pod for c32x2 {} |
4775 | | |
4776 | 0 | let this: c32x2 = cast!(*self); |
4777 | 0 | this.fmt(f) |
4778 | 0 | } |
4779 | | } |
4780 | | |
4781 | | /// A 256-bit SIMD vector with 4 elements of type [`c32`]. |
4782 | | #[derive(Copy, Clone, PartialEq)] |
4783 | | #[repr(C)] |
4784 | | pub struct c32x4(pub c32, pub c32, pub c32, pub c32); |
4785 | | |
4786 | | impl Debug for c32x4 { |
4787 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
4788 | | #[derive(Copy, Clone, Debug)] |
4789 | | #[repr(C)] |
4790 | | pub struct c32x4( |
4791 | | pub DebugCplx<c32>, |
4792 | | pub DebugCplx<c32>, |
4793 | | pub DebugCplx<c32>, |
4794 | | pub DebugCplx<c32>, |
4795 | | ); |
4796 | | unsafe impl Zeroable for c32x4 {} |
4797 | | unsafe impl Pod for c32x4 {} |
4798 | | |
4799 | 0 | let this: c32x4 = cast!(*self); |
4800 | 0 | this.fmt(f) |
4801 | 0 | } |
4802 | | } |
4803 | | |
4804 | | /// A 512-bit SIMD vector with 8 elements of type [`c32`]. |
4805 | | #[derive(Copy, Clone, PartialEq)] |
4806 | | #[repr(C)] |
4807 | | pub struct c32x8( |
4808 | | pub c32, |
4809 | | pub c32, |
4810 | | pub c32, |
4811 | | pub c32, |
4812 | | pub c32, |
4813 | | pub c32, |
4814 | | pub c32, |
4815 | | pub c32, |
4816 | | ); |
4817 | | |
4818 | | impl Debug for c32x8 { |
4819 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
4820 | | #[derive(Copy, Clone, Debug)] |
4821 | | #[repr(C)] |
4822 | | pub struct c32x8( |
4823 | | pub DebugCplx<c32>, |
4824 | | pub DebugCplx<c32>, |
4825 | | pub DebugCplx<c32>, |
4826 | | pub DebugCplx<c32>, |
4827 | | pub DebugCplx<c32>, |
4828 | | pub DebugCplx<c32>, |
4829 | | pub DebugCplx<c32>, |
4830 | | pub DebugCplx<c32>, |
4831 | | ); |
4832 | | unsafe impl Zeroable for c32x8 {} |
4833 | | unsafe impl Pod for c32x8 {} |
4834 | | |
4835 | 0 | let this: c32x8 = cast!(*self); |
4836 | 0 | this.fmt(f) |
4837 | 0 | } |
4838 | | } |
4839 | | /// A 128-bit SIMD vector with 4 elements of type [`i32`]. |
4840 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4841 | | #[repr(C)] |
4842 | | pub struct i32x4(pub i32, pub i32, pub i32, pub i32); |
4843 | | /// A 256-bit SIMD vector with 8 elements of type [`i32`]. |
4844 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4845 | | #[repr(C)] |
4846 | | pub struct i32x8( |
4847 | | pub i32, |
4848 | | pub i32, |
4849 | | pub i32, |
4850 | | pub i32, |
4851 | | pub i32, |
4852 | | pub i32, |
4853 | | pub i32, |
4854 | | pub i32, |
4855 | | ); |
4856 | | /// A 512-bit SIMD vector with 16 elements of type [`i32`]. |
4857 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4858 | | #[repr(C)] |
4859 | | pub struct i32x16( |
4860 | | pub i32, |
4861 | | pub i32, |
4862 | | pub i32, |
4863 | | pub i32, |
4864 | | pub i32, |
4865 | | pub i32, |
4866 | | pub i32, |
4867 | | pub i32, |
4868 | | pub i32, |
4869 | | pub i32, |
4870 | | pub i32, |
4871 | | pub i32, |
4872 | | pub i32, |
4873 | | pub i32, |
4874 | | pub i32, |
4875 | | pub i32, |
4876 | | ); |
4877 | | |
4878 | | /// A 128-bit SIMD vector with 4 elements of type [`u32`]. |
4879 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4880 | | #[repr(C)] |
4881 | | pub struct u32x4(pub u32, pub u32, pub u32, pub u32); |
4882 | | /// A 256-bit SIMD vector with 8 elements of type [`u32`]. |
4883 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4884 | | #[repr(C)] |
4885 | | pub struct u32x8( |
4886 | | pub u32, |
4887 | | pub u32, |
4888 | | pub u32, |
4889 | | pub u32, |
4890 | | pub u32, |
4891 | | pub u32, |
4892 | | pub u32, |
4893 | | pub u32, |
4894 | | ); |
4895 | | /// A 512-bit SIMD vector with 16 elements of type [`u32`]. |
4896 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4897 | | #[repr(C)] |
4898 | | pub struct u32x16( |
4899 | | pub u32, |
4900 | | pub u32, |
4901 | | pub u32, |
4902 | | pub u32, |
4903 | | pub u32, |
4904 | | pub u32, |
4905 | | pub u32, |
4906 | | pub u32, |
4907 | | pub u32, |
4908 | | pub u32, |
4909 | | pub u32, |
4910 | | pub u32, |
4911 | | pub u32, |
4912 | | pub u32, |
4913 | | pub u32, |
4914 | | pub u32, |
4915 | | ); |
4916 | | |
4917 | | /// A 128-bit SIMD vector with 4 elements of type [`m32`]. |
4918 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4919 | | #[repr(C)] |
4920 | | pub struct m32x4(pub m32, pub m32, pub m32, pub m32); |
4921 | | /// A 256-bit SIMD vector with 8 elements of type [`m32`]. |
4922 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4923 | | #[repr(C)] |
4924 | | pub struct m32x8( |
4925 | | pub m32, |
4926 | | pub m32, |
4927 | | pub m32, |
4928 | | pub m32, |
4929 | | pub m32, |
4930 | | pub m32, |
4931 | | pub m32, |
4932 | | pub m32, |
4933 | | ); |
4934 | | /// A 512-bit SIMD vector with 16 elements of type [`m32`]. |
4935 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
4936 | | #[repr(C)] |
4937 | | pub struct m32x16( |
4938 | | pub m32, |
4939 | | pub m32, |
4940 | | pub m32, |
4941 | | pub m32, |
4942 | | pub m32, |
4943 | | pub m32, |
4944 | | pub m32, |
4945 | | pub m32, |
4946 | | pub m32, |
4947 | | pub m32, |
4948 | | pub m32, |
4949 | | pub m32, |
4950 | | pub m32, |
4951 | | pub m32, |
4952 | | pub m32, |
4953 | | pub m32, |
4954 | | ); |
4955 | | |
4956 | | /// A 128-bit SIMD vector with 2 elements of type [`f64`]. |
4957 | | #[derive(Debug, Copy, Clone, PartialEq)] |
4958 | | #[repr(C)] |
4959 | | pub struct f64x2(pub f64, pub f64); |
4960 | | /// A 256-bit SIMD vector with 4 elements of type [`f64`]. |
4961 | | #[derive(Debug, Copy, Clone, PartialEq)] |
4962 | | #[repr(C)] |
4963 | | pub struct f64x4(pub f64, pub f64, pub f64, pub f64); |
4964 | | /// A 512-bit SIMD vector with 8 elements of type [`f64`]. |
4965 | | #[derive(Debug, Copy, Clone, PartialEq)] |
4966 | | #[repr(C)] |
4967 | | pub struct f64x8( |
4968 | | pub f64, |
4969 | | pub f64, |
4970 | | pub f64, |
4971 | | pub f64, |
4972 | | pub f64, |
4973 | | pub f64, |
4974 | | pub f64, |
4975 | | pub f64, |
4976 | | ); |
4977 | | |
4978 | | /// A 128-bit SIMD vector with 1 elements of type [`c64`]. |
4979 | | #[derive(Copy, Clone, PartialEq)] |
4980 | | #[repr(C)] |
4981 | | pub struct c64x1(pub c64); |
4982 | | |
4983 | | impl Debug for c64x1 { |
4984 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
4985 | | #[derive(Copy, Clone, Debug)] |
4986 | | #[repr(C)] |
4987 | | pub struct c64x1(pub DebugCplx<c64>); |
4988 | | unsafe impl Zeroable for c64x1 {} |
4989 | | unsafe impl Pod for c64x1 {} |
4990 | | |
4991 | 0 | let this: c64x1 = cast!(*self); |
4992 | 0 | this.fmt(f) |
4993 | 0 | } |
4994 | | } |
4995 | | |
4996 | | /// A 256-bit SIMD vector with 2 elements of type [`c64`]. |
4997 | | #[derive(Copy, Clone, PartialEq)] |
4998 | | #[repr(C)] |
4999 | | pub struct c64x2(pub c64, pub c64); |
5000 | | |
5001 | | impl Debug for c64x2 { |
5002 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
5003 | | #[derive(Copy, Clone, Debug)] |
5004 | | #[repr(C)] |
5005 | | pub struct c64x2(pub DebugCplx<c64>, pub DebugCplx<c64>); |
5006 | | unsafe impl Zeroable for c64x2 {} |
5007 | | unsafe impl Pod for c64x2 {} |
5008 | | |
5009 | 0 | let this: c64x2 = cast!(*self); |
5010 | 0 | this.fmt(f) |
5011 | 0 | } |
5012 | | } |
5013 | | |
5014 | | /// A 512-bit SIMD vector with 4 elements of type [`c64`]. |
5015 | | #[derive(Copy, Clone, PartialEq)] |
5016 | | #[repr(C)] |
5017 | | pub struct c64x4(pub c64, pub c64, pub c64, pub c64); |
5018 | | |
5019 | | impl Debug for c64x4 { |
5020 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
5021 | | #[derive(Copy, Clone, Debug)] |
5022 | | #[repr(C)] |
5023 | | pub struct c64x4( |
5024 | | pub DebugCplx<c64>, |
5025 | | pub DebugCplx<c64>, |
5026 | | pub DebugCplx<c64>, |
5027 | | pub DebugCplx<c64>, |
5028 | | ); |
5029 | | unsafe impl Zeroable for c64x4 {} |
5030 | | unsafe impl Pod for c64x4 {} |
5031 | | |
5032 | 0 | let this: c64x4 = cast!(*self); |
5033 | 0 | this.fmt(f) |
5034 | 0 | } |
5035 | | } |
5036 | | |
5037 | | /// A 128-bit SIMD vector with 2 elements of type [`i64`]. |
5038 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5039 | | #[repr(C)] |
5040 | | pub struct i64x2(pub i64, pub i64); |
5041 | | /// A 256-bit SIMD vector with 4 elements of type [`i64`]. |
5042 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5043 | | #[repr(C)] |
5044 | | pub struct i64x4(pub i64, pub i64, pub i64, pub i64); |
5045 | | /// A 512-bit SIMD vector with 8 elements of type [`i64`]. |
5046 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5047 | | #[repr(C)] |
5048 | | pub struct i64x8( |
5049 | | pub i64, |
5050 | | pub i64, |
5051 | | pub i64, |
5052 | | pub i64, |
5053 | | pub i64, |
5054 | | pub i64, |
5055 | | pub i64, |
5056 | | pub i64, |
5057 | | ); |
5058 | | |
5059 | | /// A 128-bit SIMD vector with 2 elements of type [`u64`]. |
5060 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5061 | | #[repr(C)] |
5062 | | pub struct u64x2(pub u64, pub u64); |
5063 | | /// A 256-bit SIMD vector with 4 elements of type [`u64`]. |
5064 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5065 | | #[repr(C)] |
5066 | | pub struct u64x4(pub u64, pub u64, pub u64, pub u64); |
5067 | | /// A 512-bit SIMD vector with 8 elements of type [`u64`]. |
5068 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5069 | | #[repr(C)] |
5070 | | pub struct u64x8( |
5071 | | pub u64, |
5072 | | pub u64, |
5073 | | pub u64, |
5074 | | pub u64, |
5075 | | pub u64, |
5076 | | pub u64, |
5077 | | pub u64, |
5078 | | pub u64, |
5079 | | ); |
5080 | | |
5081 | | /// A 128-bit SIMD vector with 2 elements of type [`m64`]. |
5082 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5083 | | #[repr(C)] |
5084 | | pub struct m64x2(pub m64, pub m64); |
5085 | | /// A 256-bit SIMD vector with 4 elements of type [`m64`]. |
5086 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5087 | | #[repr(C)] |
5088 | | pub struct m64x4(pub m64, pub m64, pub m64, pub m64); |
5089 | | /// A 512-bit SIMD vector with 8 elements of type [`m64`]. |
5090 | | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
5091 | | #[repr(C)] |
5092 | | pub struct m64x8( |
5093 | | pub m64, |
5094 | | pub m64, |
5095 | | pub m64, |
5096 | | pub m64, |
5097 | | pub m64, |
5098 | | pub m64, |
5099 | | pub m64, |
5100 | | pub m64, |
5101 | | ); |
5102 | | |
5103 | | unsafe impl Zeroable for m8 {} |
5104 | | unsafe impl Zeroable for m16 {} |
5105 | | unsafe impl Zeroable for m32 {} |
5106 | | unsafe impl Zeroable for m64 {} |
5107 | | unsafe impl Pod for m8 {} |
5108 | | unsafe impl Pod for m16 {} |
5109 | | unsafe impl Pod for m32 {} |
5110 | | unsafe impl Pod for m64 {} |
5111 | | |
5112 | | unsafe impl Zeroable for b8 {} |
5113 | | unsafe impl Pod for b8 {} |
5114 | | unsafe impl Zeroable for b16 {} |
5115 | | unsafe impl Pod for b16 {} |
5116 | | unsafe impl Zeroable for b32 {} |
5117 | | unsafe impl Pod for b32 {} |
5118 | | unsafe impl Zeroable for b64 {} |
5119 | | unsafe impl Pod for b64 {} |
5120 | | |
5121 | | unsafe impl Zeroable for i8x16 {} |
5122 | | unsafe impl Zeroable for i8x32 {} |
5123 | | unsafe impl Zeroable for i8x64 {} |
5124 | | unsafe impl Pod for i8x16 {} |
5125 | | unsafe impl Pod for i8x32 {} |
5126 | | unsafe impl Pod for i8x64 {} |
5127 | | unsafe impl Zeroable for u8x16 {} |
5128 | | unsafe impl Zeroable for u8x32 {} |
5129 | | unsafe impl Zeroable for u8x64 {} |
5130 | | unsafe impl Pod for u8x16 {} |
5131 | | unsafe impl Pod for u8x32 {} |
5132 | | unsafe impl Pod for u8x64 {} |
5133 | | unsafe impl Zeroable for m8x16 {} |
5134 | | unsafe impl Zeroable for m8x32 {} |
5135 | | unsafe impl Zeroable for m8x64 {} |
5136 | | unsafe impl Pod for m8x16 {} |
5137 | | unsafe impl Pod for m8x32 {} |
5138 | | unsafe impl Pod for m8x64 {} |
5139 | | |
5140 | | unsafe impl Zeroable for i16x8 {} |
5141 | | unsafe impl Zeroable for i16x16 {} |
5142 | | unsafe impl Zeroable for i16x32 {} |
5143 | | unsafe impl Pod for i16x8 {} |
5144 | | unsafe impl Pod for i16x16 {} |
5145 | | unsafe impl Pod for i16x32 {} |
5146 | | unsafe impl Zeroable for u16x8 {} |
5147 | | unsafe impl Zeroable for u16x16 {} |
5148 | | unsafe impl Zeroable for u16x32 {} |
5149 | | unsafe impl Pod for u16x8 {} |
5150 | | unsafe impl Pod for u16x16 {} |
5151 | | unsafe impl Pod for u16x32 {} |
5152 | | unsafe impl Zeroable for m16x8 {} |
5153 | | unsafe impl Zeroable for m16x16 {} |
5154 | | unsafe impl Zeroable for m16x32 {} |
5155 | | unsafe impl Pod for m16x8 {} |
5156 | | unsafe impl Pod for m16x16 {} |
5157 | | unsafe impl Pod for m16x32 {} |
5158 | | |
5159 | | unsafe impl Zeroable for f32x4 {} |
5160 | | unsafe impl Zeroable for f32x8 {} |
5161 | | unsafe impl Zeroable for f32x16 {} |
5162 | | unsafe impl Pod for f32x4 {} |
5163 | | unsafe impl Pod for f32x8 {} |
5164 | | unsafe impl Pod for f32x16 {} |
5165 | | unsafe impl Zeroable for c32x2 {} |
5166 | | unsafe impl Zeroable for c32x4 {} |
5167 | | unsafe impl Zeroable for c32x8 {} |
5168 | | unsafe impl Pod for c32x2 {} |
5169 | | unsafe impl Pod for c32x4 {} |
5170 | | unsafe impl Pod for c32x8 {} |
5171 | | unsafe impl Zeroable for i32x4 {} |
5172 | | unsafe impl Zeroable for i32x8 {} |
5173 | | unsafe impl Zeroable for i32x16 {} |
5174 | | unsafe impl Pod for i32x4 {} |
5175 | | unsafe impl Pod for i32x8 {} |
5176 | | unsafe impl Pod for i32x16 {} |
5177 | | unsafe impl Zeroable for u32x4 {} |
5178 | | unsafe impl Zeroable for u32x8 {} |
5179 | | unsafe impl Zeroable for u32x16 {} |
5180 | | unsafe impl Pod for u32x4 {} |
5181 | | unsafe impl Pod for u32x8 {} |
5182 | | unsafe impl Pod for u32x16 {} |
5183 | | unsafe impl Zeroable for m32x4 {} |
5184 | | unsafe impl Zeroable for m32x8 {} |
5185 | | unsafe impl Zeroable for m32x16 {} |
5186 | | unsafe impl Pod for m32x4 {} |
5187 | | unsafe impl Pod for m32x8 {} |
5188 | | unsafe impl Pod for m32x16 {} |
5189 | | |
5190 | | unsafe impl Zeroable for f64x2 {} |
5191 | | unsafe impl Zeroable for f64x4 {} |
5192 | | unsafe impl Zeroable for f64x8 {} |
5193 | | unsafe impl Pod for f64x2 {} |
5194 | | unsafe impl Pod for f64x4 {} |
5195 | | unsafe impl Pod for f64x8 {} |
5196 | | unsafe impl Zeroable for c64x1 {} |
5197 | | unsafe impl Zeroable for c64x2 {} |
5198 | | unsafe impl Zeroable for c64x4 {} |
5199 | | unsafe impl Pod for c64x1 {} |
5200 | | unsafe impl Pod for c64x2 {} |
5201 | | unsafe impl Pod for c64x4 {} |
5202 | | unsafe impl Zeroable for i64x2 {} |
5203 | | unsafe impl Zeroable for i64x4 {} |
5204 | | unsafe impl Zeroable for i64x8 {} |
5205 | | unsafe impl Pod for i64x2 {} |
5206 | | unsafe impl Pod for i64x4 {} |
5207 | | unsafe impl Pod for i64x8 {} |
5208 | | unsafe impl Zeroable for u64x2 {} |
5209 | | unsafe impl Zeroable for u64x4 {} |
5210 | | unsafe impl Zeroable for u64x8 {} |
5211 | | unsafe impl Pod for u64x2 {} |
5212 | | unsafe impl Pod for u64x4 {} |
5213 | | unsafe impl Pod for u64x8 {} |
5214 | | unsafe impl Zeroable for m64x2 {} |
5215 | | unsafe impl Zeroable for m64x4 {} |
5216 | | unsafe impl Zeroable for m64x8 {} |
5217 | | unsafe impl Pod for m64x2 {} |
5218 | | unsafe impl Pod for m64x4 {} |
5219 | | unsafe impl Pod for m64x8 {} |
5220 | | |
5221 | | macro_rules! iota { |
5222 | | ($T: ty, $N: expr, $int: ty) => { |
5223 | | const { |
5224 | | unsafe { |
5225 | | let mut iota = [const { core::mem::MaybeUninit::uninit() }; $N]; |
5226 | | { |
5227 | | let mut i = 0; |
5228 | | while i < $N { |
5229 | | let v = (&raw mut iota[i]) as *mut $int; |
5230 | | |
5231 | | let mut j = 0; |
5232 | | while j < core::mem::size_of::<$T>() / core::mem::size_of::<$int>() { |
5233 | | v.add(j).write_unaligned(i as $int); |
5234 | | j += 1; |
5235 | | } |
5236 | | |
5237 | | i += 1; |
5238 | | } |
5239 | | } |
5240 | | iota |
5241 | | } |
5242 | | } |
5243 | | }; |
5244 | | } |
5245 | | |
5246 | 0 | pub const fn iota_8<T: Interleave, const N: usize>() -> [MaybeUninit<T>; N] { |
5247 | 0 | iota!(T, N, u8) |
5248 | 0 | } |
5249 | 0 | pub const fn iota_16<T: Interleave, const N: usize>() -> [MaybeUninit<T>; N] { |
5250 | 0 | iota!(T, N, u16) |
5251 | 0 | } |
5252 | 0 | pub const fn iota_32<T: Interleave, const N: usize>() -> [MaybeUninit<T>; N] { |
5253 | 0 | iota!(T, N, u32) |
5254 | 0 | } |
5255 | 0 | pub const fn iota_64<T: Interleave, const N: usize>() -> [MaybeUninit<T>; N] { |
5256 | 0 | iota!(T, N, u64) |
5257 | 0 | } |
5258 | | |
5259 | | #[cfg(target_arch = "x86_64")] |
5260 | | #[cfg(test)] |
5261 | | mod tests { |
5262 | | use super::*; |
5263 | | |
5264 | | #[test] |
5265 | | fn test_interleave() { |
5266 | | if let Some(simd) = x86::V3::try_new() { |
5267 | | { |
5268 | | let src = [f64x4(0.0, 0.1, 1.0, 1.1), f64x4(2.0, 2.1, 3.0, 3.1)]; |
5269 | | let dst = unsafe { deinterleave_fallback::<f64, f64x4, [f64x4; 2]>(src) }; |
5270 | | assert_eq!(dst[1], simd.add_f64x4(dst[0], simd.splat_f64x4(0.1))); |
5271 | | assert_eq!(src, unsafe { |
5272 | | interleave_fallback::<f64, f64x4, [f64x4; 2]>(dst) |
5273 | | }); |
5274 | | } |
5275 | | { |
5276 | | let src = [ |
5277 | | f64x4(0.0, 0.1, 0.2, 0.3), |
5278 | | f64x4(1.0, 1.1, 1.2, 1.3), |
5279 | | f64x4(2.0, 2.1, 2.2, 2.3), |
5280 | | f64x4(3.0, 3.1, 3.2, 3.3), |
5281 | | ]; |
5282 | | let dst = unsafe { deinterleave_fallback::<f64, f64x4, [f64x4; 4]>(src) }; |
5283 | | assert_eq!(dst[1], simd.add_f64x4(dst[0], simd.splat_f64x4(0.1))); |
5284 | | assert_eq!(dst[2], simd.add_f64x4(dst[0], simd.splat_f64x4(0.2))); |
5285 | | assert_eq!(dst[3], simd.add_f64x4(dst[0], simd.splat_f64x4(0.3))); |
5286 | | assert_eq!(src, unsafe { |
5287 | | interleave_fallback::<f64, f64x4, [f64x4; 4]>(dst) |
5288 | | }); |
5289 | | } |
5290 | | } |
5291 | | } |
5292 | | } |