diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/packed_simd_2/src/api/bitmask.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/packed_simd_2/src/api/bitmask.rs')
-rw-r--r-- | vendor/packed_simd_2/src/api/bitmask.rs | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/vendor/packed_simd_2/src/api/bitmask.rs b/vendor/packed_simd_2/src/api/bitmask.rs deleted file mode 100644 index a06ff0fab..000000000 --- a/vendor/packed_simd_2/src/api/bitmask.rs +++ /dev/null @@ -1,82 +0,0 @@ -//! Bitmask API - -macro_rules! impl_bitmask { - ($id:ident | $ibitmask_ty:ident | ($set:expr, $clear:expr) - | $test_tt:tt) => { - impl $id { - /// Creates a bitmask with the MSB of each vector lane. - /// - /// If the vector has less than 8 lanes, the bits that do not - /// correspond to any vector lanes are cleared. - #[inline] - pub fn bitmask(self) -> $ibitmask_ty { - unsafe { codegen::llvm::simd_bitmask(self.0) } - } - } - - test_if! { - $test_tt: - paste::item! { - #[cfg(not(any( - // FIXME: https://github.com/rust-lang-nursery/packed_simd/issues/210 - all(target_arch = "mips", target_endian = "big"), - all(target_arch = "mips64", target_endian = "big"), - target_arch = "sparc64", - target_arch = "s390x", - )))] - pub mod [<$id _bitmask>] { - use super::*; - #[cfg_attr(not(target_arch = "wasm32"), test)] - #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] - fn bitmask() { - // clear all lanes - let vec = $id::splat($clear as _); - let bitmask: $ibitmask_ty = 0; - assert_eq!(vec.bitmask(), bitmask); - - // set even lanes - let mut vec = $id::splat($clear as _); - for i in 0..$id::lanes() { - if i % 2 == 0 { - vec = vec.replace(i, $set as _); - } - } - // create bitmask with even lanes set: - let mut bitmask: $ibitmask_ty = 0; - for i in 0..$id::lanes() { - if i % 2 == 0 { - bitmask |= 1 << i; - } - } - assert_eq!(vec.bitmask(), bitmask); - - - // set odd lanes - let mut vec = $id::splat($clear as _); - for i in 0..$id::lanes() { - if i % 2 != 0 { - vec = vec.replace(i, $set as _); - } - } - // create bitmask with odd lanes set: - let mut bitmask: $ibitmask_ty = 0; - for i in 0..$id::lanes() { - if i % 2 != 0 { - bitmask |= 1 << i; - } - } - assert_eq!(vec.bitmask(), bitmask); - - // set all lanes - let vec = $id::splat($set as _); - let mut bitmask: $ibitmask_ty = 0; - for i in 0..$id::lanes() { - bitmask |= 1 << i; - } - assert_eq!(vec.bitmask(), bitmask); - } - } - } - } - }; -} |