diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/packed_simd/src/api/shuffle1_dyn.rs | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | third_party/rust/packed_simd/src/api/shuffle1_dyn.rs | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/third_party/rust/packed_simd/src/api/shuffle1_dyn.rs b/third_party/rust/packed_simd/src/api/shuffle1_dyn.rs deleted file mode 100644 index 64536be6cb..0000000000 --- a/third_party/rust/packed_simd/src/api/shuffle1_dyn.rs +++ /dev/null @@ -1,159 +0,0 @@ -//! Shuffle vector elements according to a dynamic vector of indices. - -macro_rules! impl_shuffle1_dyn { - ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { - impl $id { - /// Shuffle vector elements according to `indices`. - #[inline] - pub fn shuffle1_dyn<I>(self, indices: I) -> Self - where - Self: codegen::shuffle1_dyn::Shuffle1Dyn<Indices = I>, - { - codegen::shuffle1_dyn::Shuffle1Dyn::shuffle1_dyn(self, indices) - } - } - }; -} - -macro_rules! test_shuffle1_dyn { - ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { - test_if! { - $test_tt: - paste::item! { - pub mod [<$id _shuffle1_dyn>] { - use super::*; - #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] - fn shuffle1_dyn() { - let increasing = { - let mut v = $id::splat(0 as $elem_ty); - for i in 0..$id::lanes() { - v = v.replace(i, i as $elem_ty); - } - v - }; - let decreasing = { - let mut v = $id::splat(0 as $elem_ty); - for i in 0..$id::lanes() { - v = v.replace( - i, - ($id::lanes() - 1 - i) as $elem_ty - ); - } - v - }; - - type Indices = < - $id as codegen::shuffle1_dyn::Shuffle1Dyn - >::Indices; - let increasing_ids: Indices = increasing.cast(); - let decreasing_ids: Indices = decreasing.cast(); - - assert_eq!( - increasing.shuffle1_dyn(increasing_ids), - increasing, - "(i,i)=>i" - ); - assert_eq!( - decreasing.shuffle1_dyn(increasing_ids), - decreasing, - "(d,i)=>d" - ); - assert_eq!( - increasing.shuffle1_dyn(decreasing_ids), - decreasing, - "(i,d)=>d" - ); - assert_eq!( - decreasing.shuffle1_dyn(decreasing_ids), - increasing, - "(d,d)=>i" - ); - - for i in 0..$id::lanes() { - let v_ids: Indices - = $id::splat(i as $elem_ty).cast(); - assert_eq!(increasing.shuffle1_dyn(v_ids), - $id::splat(increasing.extract(i)) - ); - assert_eq!(decreasing.shuffle1_dyn(v_ids), - $id::splat(decreasing.extract(i)) - ); - assert_eq!( - $id::splat(i as $elem_ty) - .shuffle1_dyn(increasing_ids), - $id::splat(i as $elem_ty) - ); - assert_eq!( - $id::splat(i as $elem_ty) - .shuffle1_dyn(decreasing_ids), - $id::splat(i as $elem_ty) - ); - } - } - } - } - } - }; -} - -macro_rules! test_shuffle1_dyn_mask { - ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { - test_if! { - $test_tt: - paste::item! { - pub mod [<$id _shuffle1_dyn>] { - use super::*; - #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] - fn shuffle1_dyn() { - // alternating = [true, false, true, false, ...] - let mut alternating = $id::splat(false); - for i in 0..$id::lanes() { - if i % 2 == 0 { - alternating = alternating.replace(i, true); - } - } - - type Indices = < - $id as codegen::shuffle1_dyn::Shuffle1Dyn - >::Indices; - // even = [0, 0, 2, 2, 4, 4, ..] - let even = { - let mut v = Indices::splat(0); - for i in 0..$id::lanes() { - if i % 2 == 0 { - v = v.replace(i, (i as u8).into()); - } else { - v = v.replace(i, (i as u8 - 1).into()); - } - } - v - }; - // odd = [1, 1, 3, 3, 5, 5, ...] - let odd = { - let mut v = Indices::splat(0); - for i in 0..$id::lanes() { - if i % 2 != 0 { - v = v.replace(i, (i as u8).into()); - } else { - v = v.replace(i, (i as u8 + 1).into()); - } - } - v - }; - - assert_eq!( - alternating.shuffle1_dyn(even), - $id::splat(true) - ); - if $id::lanes() > 1 { - assert_eq!( - alternating.shuffle1_dyn(odd), - $id::splat(false) - ); - } - } - } - } - } - }; -} |