From 4e14017f3d9e0379304dd8d34772786631310104 Mon Sep 17 00:00:00 2001 From: Sean Stangl Date: Sun, 3 Apr 2022 15:20:00 -0600 Subject: [PATCH 1/4] Standardize documentation for SIMD vector and mask types --- crates/core_simd/src/masks.rs | 36 ++++++++++++------------- crates/core_simd/src/vector/float.rs | 14 +++++----- crates/core_simd/src/vector/int.rs | 40 ++++++++++++++-------------- crates/core_simd/src/vector/uint.rs | 40 ++++++++++++++-------------- 4 files changed, 65 insertions(+), 65 deletions(-) diff --git a/crates/core_simd/src/masks.rs b/crates/core_simd/src/masks.rs index e1cd7930450..a56a154b437 100644 --- a/crates/core_simd/src/masks.rs +++ b/crates/core_simd/src/masks.rs @@ -507,58 +507,58 @@ where } } -/// Vector of eight 8-bit masks +/// A 64-bit SIMD vector mask for eight elements of 8 bits. pub type mask8x8 = Mask; -/// Vector of 16 8-bit masks +/// A 128-bit SIMD vector mask for 16 elements of 8 bits. pub type mask8x16 = Mask; -/// Vector of 32 8-bit masks +/// A 256-bit SIMD vector mask for 32 elements of 8 bits. pub type mask8x32 = Mask; -/// Vector of 16 8-bit masks +/// A 512-bit SIMD vector mask for 64 elements of 8 bits. pub type mask8x64 = Mask; -/// Vector of four 16-bit masks +/// A 64-bit SIMD vector mask for four elements of 16 bits. pub type mask16x4 = Mask; -/// Vector of eight 16-bit masks +/// A 128-bit SIMD vector mask for eight elements of 16 bits. pub type mask16x8 = Mask; -/// Vector of 16 16-bit masks +/// A 256-bit SIMD vector mask for 16 elements of 16 bits. pub type mask16x16 = Mask; -/// Vector of 32 16-bit masks +/// A 512-bit SIMD vector mask for 32 elements of 16 bits. pub type mask16x32 = Mask; -/// Vector of two 32-bit masks +/// A 64-bit SIMD vector mask for two elements of 32 bits. pub type mask32x2 = Mask; -/// Vector of four 32-bit masks +/// A 128-bit SIMD vector mask for four elements of 32 bits. pub type mask32x4 = Mask; -/// Vector of eight 32-bit masks +/// A 256-bit SIMD vector mask for eight elements of 32 bits. pub type mask32x8 = Mask; -/// Vector of 16 32-bit masks +/// A 512-bit SIMD vector mask for 16 elements of 32 bits. pub type mask32x16 = Mask; -/// Vector of two 64-bit masks +/// A 128-bit SIMD vector mask for two elements of 64 bits. pub type mask64x2 = Mask; -/// Vector of four 64-bit masks +/// A 256-bit SIMD vector mask for four elements of 64 bits. pub type mask64x4 = Mask; -/// Vector of eight 64-bit masks +/// A 512-bit SIMD vector mask for eight elements of 64 bits. pub type mask64x8 = Mask; -/// Vector of two pointer-width masks +/// A SIMD vector mask for two elements of pointer width. pub type masksizex2 = Mask; -/// Vector of four pointer-width masks +/// A SIMD vector mask for four elements of pointer width. pub type masksizex4 = Mask; -/// Vector of eight pointer-width masks +/// A SIMD vector mask for eight elements of pointer width. pub type masksizex8 = Mask; macro_rules! impl_from { diff --git a/crates/core_simd/src/vector/float.rs b/crates/core_simd/src/vector/float.rs index fcc7f6d8d1c..f7985b64710 100644 --- a/crates/core_simd/src/vector/float.rs +++ b/crates/core_simd/src/vector/float.rs @@ -177,23 +177,23 @@ macro_rules! impl_float_vector { impl_float_vector! { f32, u32, i32 } impl_float_vector! { f64, u64, i64 } -/// Vector of two `f32` values +/// A 64-bit SIMD vector with two elements of type `f32`. pub type f32x2 = Simd; -/// Vector of four `f32` values +/// A 128-bit SIMD vector with four elements of type `f32`. pub type f32x4 = Simd; -/// Vector of eight `f32` values +/// A 256-bit SIMD vector with eight elements of type `f32`. pub type f32x8 = Simd; -/// Vector of 16 `f32` values +/// A 512-bit SIMD vector with 16 elements of type `f32`. pub type f32x16 = Simd; -/// Vector of two `f64` values +/// A 128-bit SIMD vector with two elements of type `f64`. pub type f64x2 = Simd; -/// Vector of four `f64` values +/// A 256-bit SIMD vector with four elements of type `f64`. pub type f64x4 = Simd; -/// Vector of eight `f64` values +/// A 512-bit SIMD vector with eight elements of type `f64`. pub type f64x8 = Simd; diff --git a/crates/core_simd/src/vector/int.rs b/crates/core_simd/src/vector/int.rs index 3eac02a2761..eec483212b3 100644 --- a/crates/core_simd/src/vector/int.rs +++ b/crates/core_simd/src/vector/int.rs @@ -42,62 +42,62 @@ impl_integer_vector! { i32 } impl_integer_vector! { i64 } impl_integer_vector! { i8 } -/// Vector of two `isize` values +/// A SIMD vector with two elements of type `isize`. pub type isizex2 = Simd; -/// Vector of four `isize` values +/// A SIMD vector with four elements of type `isize`. pub type isizex4 = Simd; -/// Vector of eight `isize` values +/// A SIMD vector with eight elements of type `isize`. pub type isizex8 = Simd; -/// Vector of two `i16` values +/// A 32-bit SIMD vector with two elements of type `i16`. pub type i16x2 = Simd; -/// Vector of four `i16` values +/// A 64-bit SIMD vector with four elements of type `i16`. pub type i16x4 = Simd; -/// Vector of eight `i16` values +/// A 128-bit SIMD vector with eight elements of type `i16`. pub type i16x8 = Simd; -/// Vector of 16 `i16` values +/// A 256-bit SIMD vector with 16 elements of type `i16`. pub type i16x16 = Simd; -/// Vector of 32 `i16` values +/// A 512-bit SIMD vector with 32 elements of type `i16`. pub type i16x32 = Simd; -/// Vector of two `i32` values +/// A 64-bit SIMD vector with two elements of type `i32`. pub type i32x2 = Simd; -/// Vector of four `i32` values +/// A 128-bit SIMD vector with four elements of type `i32`. pub type i32x4 = Simd; -/// Vector of eight `i32` values +/// A 256-bit SIMD vector with eight elements of type `i32`. pub type i32x8 = Simd; -/// Vector of 16 `i32` values +/// A 512-bit SIMD vector with 16 elements of type `i32`. pub type i32x16 = Simd; -/// Vector of two `i64` values +/// A 128-bit SIMD vector with two elements of type `i64`. pub type i64x2 = Simd; -/// Vector of four `i64` values +/// A 256-bit SIMD vector with four elements of type `i64`. pub type i64x4 = Simd; -/// Vector of eight `i64` values +/// A 512-bit SIMD vector with eight elements of type `i64`. pub type i64x8 = Simd; -/// Vector of four `i8` values +/// A 32-bit SIMD vector with four elements of type `i8`. pub type i8x4 = Simd; -/// Vector of eight `i8` values +/// A 64-bit SIMD vector with eight elements of type `i8`. pub type i8x8 = Simd; -/// Vector of 16 `i8` values +/// A 128-bit SIMD vector with 16 elements of type `i8`. pub type i8x16 = Simd; -/// Vector of 32 `i8` values +/// A 256-bit SIMD vector with 32 elements of type `i8`. pub type i8x32 = Simd; -/// Vector of 64 `i8` values +/// A 512-bit SIMD vector with 64 elements of type `i8`. pub type i8x64 = Simd; diff --git a/crates/core_simd/src/vector/uint.rs b/crates/core_simd/src/vector/uint.rs index ed91fc3640e..b4a69c44363 100644 --- a/crates/core_simd/src/vector/uint.rs +++ b/crates/core_simd/src/vector/uint.rs @@ -2,62 +2,62 @@ use crate::simd::Simd; -/// Vector of two `usize` values +/// A SIMD vector with two elements of type `usize`. pub type usizex2 = Simd; -/// Vector of four `usize` values +/// A SIMD vector with four elements of type `usize`. pub type usizex4 = Simd; -/// Vector of eight `usize` values +/// A SIMD vector with eight elements of type `usize`. pub type usizex8 = Simd; -/// Vector of two `u16` values +/// A 32-bit SIMD vector with two elements of type `u16`. pub type u16x2 = Simd; -/// Vector of four `u16` values +/// A 64-bit SIMD vector with four elements of type `u16`. pub type u16x4 = Simd; -/// Vector of eight `u16` values +/// A 128-bit SIMD vector with eight elements of type `u16`. pub type u16x8 = Simd; -/// Vector of 16 `u16` values +/// A 256-bit SIMD vector with 16 elements of type `u16`. pub type u16x16 = Simd; -/// Vector of 32 `u16` values +/// A 512-bit SIMD vector with 32 elements of type `u16`. pub type u16x32 = Simd; -/// Vector of two `u32` values +/// A 64-bit SIMD vector with two elements of type `u32`. pub type u32x2 = Simd; -/// Vector of four `u32` values +/// A 128-bit SIMD vector with four elements of type `u32`. pub type u32x4 = Simd; -/// Vector of eight `u32` values +/// A 256-bit SIMD vector with eight elements of type `u32`. pub type u32x8 = Simd; -/// Vector of 16 `u32` values +/// A 512-bit SIMD vector with 16 elements of type `u32`. pub type u32x16 = Simd; -/// Vector of two `u64` values +/// A 128-bit SIMD vector with two elements of type `u64`. pub type u64x2 = Simd; -/// Vector of four `u64` values +/// A 256-bit SIMD vector with four elements of type `u64`. pub type u64x4 = Simd; -/// Vector of eight `u64` values +/// A 512-bit SIMD vector with eight elements of type `u64`. pub type u64x8 = Simd; -/// Vector of four `u8` values +/// A 32-bit SIMD vector with four elements of type `u8`. pub type u8x4 = Simd; -/// Vector of eight `u8` values +/// A 64-bit SIMD vector with eight elements of type `u8`. pub type u8x8 = Simd; -/// Vector of 16 `u8` values +/// A 128-bit SIMD vector with 16 elements of type `u8`. pub type u8x16 = Simd; -/// Vector of 32 `u8` values +/// A 256-bit SIMD vector with 32 elements of type `u8`. pub type u8x32 = Simd; -/// Vector of 64 `u8` values +/// A 512-bit SIMD vector with 64 elements of type `u8`. pub type u8x64 = Simd; From c73f1fbdde8bd1c257f2f683a595a5c434f32a2d Mon Sep 17 00:00:00 2001 From: Sean Stangl Date: Sun, 3 Apr 2022 15:59:22 -0600 Subject: [PATCH 2/4] Update crates/core_simd/src/masks.rs Co-authored-by: Jacob Lifshay --- crates/core_simd/src/masks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core_simd/src/masks.rs b/crates/core_simd/src/masks.rs index a56a154b437..ba4158b3cfc 100644 --- a/crates/core_simd/src/masks.rs +++ b/crates/core_simd/src/masks.rs @@ -507,7 +507,7 @@ where } } -/// A 64-bit SIMD vector mask for eight elements of 8 bits. +/// A SIMD vector mask of eight elements, for operating with SIMD vectors with 8 bit elements. pub type mask8x8 = Mask; /// A 128-bit SIMD vector mask for 16 elements of 8 bits. From 21b070ce4372c5141cb48ebd6fc6ca45030d703c Mon Sep 17 00:00:00 2001 From: Sean Stangl Date: Sun, 3 Apr 2022 16:15:27 -0600 Subject: [PATCH 3/4] Correct the Mask docs, and get them to fit in search results --- crates/core_simd/src/masks.rs | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/core_simd/src/masks.rs b/crates/core_simd/src/masks.rs index ba4158b3cfc..d0021c91142 100644 --- a/crates/core_simd/src/masks.rs +++ b/crates/core_simd/src/masks.rs @@ -507,58 +507,58 @@ where } } -/// A SIMD vector mask of eight elements, for operating with SIMD vectors with 8 bit elements. +/// A mask for SIMD vectors with eight elements of 8 bits. pub type mask8x8 = Mask; -/// A 128-bit SIMD vector mask for 16 elements of 8 bits. +/// A mask for SIMD vectors with 16 elements of 8 bits. pub type mask8x16 = Mask; -/// A 256-bit SIMD vector mask for 32 elements of 8 bits. +/// A mask for SIMD vectors with 32 elements of 8 bits. pub type mask8x32 = Mask; -/// A 512-bit SIMD vector mask for 64 elements of 8 bits. +/// A mask for SIMD vectors with 64 elements of 8 bits. pub type mask8x64 = Mask; -/// A 64-bit SIMD vector mask for four elements of 16 bits. +/// A mask for SIMD vectors with four elements of 16 bits. pub type mask16x4 = Mask; -/// A 128-bit SIMD vector mask for eight elements of 16 bits. +/// A mask for SIMD vectors with eight elements of 16 bits. pub type mask16x8 = Mask; -/// A 256-bit SIMD vector mask for 16 elements of 16 bits. +/// A mask for SIMD vectors with 16 elements of 16 bits. pub type mask16x16 = Mask; -/// A 512-bit SIMD vector mask for 32 elements of 16 bits. +/// A mask for SIMD vectors with 32 elements of 16 bits. pub type mask16x32 = Mask; -/// A 64-bit SIMD vector mask for two elements of 32 bits. +/// A mask for SIMD vectors with two elements of 32 bits. pub type mask32x2 = Mask; -/// A 128-bit SIMD vector mask for four elements of 32 bits. +/// A mask for SIMD vectors with four elements of 32 bits. pub type mask32x4 = Mask; -/// A 256-bit SIMD vector mask for eight elements of 32 bits. +/// A mask for SIMD vectors with eight elements of 32 bits. pub type mask32x8 = Mask; -/// A 512-bit SIMD vector mask for 16 elements of 32 bits. +/// A mask for SIMD vectors with 16 elements of 32 bits. pub type mask32x16 = Mask; -/// A 128-bit SIMD vector mask for two elements of 64 bits. +/// A mask for SIMD vectors with two elements of 64 bits. pub type mask64x2 = Mask; -/// A 256-bit SIMD vector mask for four elements of 64 bits. +/// A mask for SIMD vectors with four elements of 64 bits. pub type mask64x4 = Mask; -/// A 512-bit SIMD vector mask for eight elements of 64 bits. +/// A mask for SIMD vectors with eight elements of 64 bits. pub type mask64x8 = Mask; -/// A SIMD vector mask for two elements of pointer width. +/// A mask for SIMD vectors with two elements of pointer width. pub type masksizex2 = Mask; -/// A SIMD vector mask for four elements of pointer width. +/// A mask for SIMD vectors with four elements of pointer width. pub type masksizex4 = Mask; -/// A SIMD vector mask for eight elements of pointer width. +/// A mask for SIMD vectors with eight elements of pointer width. pub type masksizex8 = Mask; macro_rules! impl_from { From 8cd9325e206bf362071b71a812849a3b463bcbcc Mon Sep 17 00:00:00 2001 From: Sean Stangl Date: Sun, 3 Apr 2022 16:22:31 -0600 Subject: [PATCH 4/4] Add a *small* blurb to Mask that is likely unobjectionable --- crates/core_simd/src/masks.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/core_simd/src/masks.rs b/crates/core_simd/src/masks.rs index d0021c91142..b97be97f7e6 100644 --- a/crates/core_simd/src/masks.rs +++ b/crates/core_simd/src/masks.rs @@ -77,6 +77,8 @@ impl_element! { isize } /// A SIMD vector mask for `LANES` elements of width specified by `Element`. /// +/// Masks represent boolean inclusion/exclusion on a per-lane basis. +/// /// The layout of this type is unspecified. #[repr(transparent)] pub struct Mask(mask_impl::Mask)