diff options
| -rw-r--r-- | crates/core_simd/src/intrinsics.rs | 8 | ||||
| -rw-r--r-- | crates/core_simd/src/masks/to_bitmask.rs | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/crates/core_simd/src/intrinsics.rs b/crates/core_simd/src/intrinsics.rs index e150946c705..47edff4a66a 100644 --- a/crates/core_simd/src/intrinsics.rs +++ b/crates/core_simd/src/intrinsics.rs @@ -130,6 +130,14 @@ extern "platform-intrinsic" { pub(crate) fn simd_reduce_xor<T, U>(x: T) -> U; // truncate integer vector to bitmask + // `fn simd_bitmask(vector) -> unsigned integer` takes a vector of integers and + // returns either an unsigned integer or array of `u8`. + // Every element in the vector becomes a single bit in the returned bitmask. + // If the vector has less than 8 lanes, a u8 is returned with zeroed trailing bits. + // The bit order of the result depends on the byte endianness. LSB-first for little + // endian and MSB-first for big endian. + // + // UB if called on a vector with values other than 0 and -1. #[allow(unused)] pub(crate) fn simd_bitmask<T, U>(x: T) -> U; diff --git a/crates/core_simd/src/masks/to_bitmask.rs b/crates/core_simd/src/masks/to_bitmask.rs index 1c2037764c1..c263f6a4eec 100644 --- a/crates/core_simd/src/masks/to_bitmask.rs +++ b/crates/core_simd/src/masks/to_bitmask.rs @@ -50,6 +50,9 @@ macro_rules! impl_integer_intrinsic { } impl_integer_intrinsic! { + unsafe impl ToBitMask<BitMask=u8> for Mask<_, 1> + unsafe impl ToBitMask<BitMask=u8> for Mask<_, 2> + unsafe impl ToBitMask<BitMask=u8> for Mask<_, 4> unsafe impl ToBitMask<BitMask=u8> for Mask<_, 8> unsafe impl ToBitMask<BitMask=u16> for Mask<_, 16> unsafe impl ToBitMask<BitMask=u32> for Mask<_, 32> |
