#[repr(transparent)]pub struct Vector<T, Arch>{
pub raw: <Arch as SimdKernel<T>>::Vector,
/* private fields */
}Expand description
A monomorphized vector register type wrapping the architecture-native raw register.
Fields§
§raw: <Arch as SimdKernel<T>>::VectorThe underlying raw vector register.
Implementations§
Source§impl<T, Arch> Vector<T, Arch>
impl<T, Arch> Vector<T, Arch>
Sourcepub const fn new(raw: <Arch as SimdKernel<T>>::Vector) -> Vector<T, Arch>
pub const fn new(raw: <Arch as SimdKernel<T>>::Vector) -> Vector<T, Arch>
Create a new Vector wrapping a raw vector register.
Sourcepub fn try_zero() -> Result<Vector<T, Arch>, SimdError>
pub fn try_zero() -> Result<Vector<T, Arch>, SimdError>
Try to construct a Vector with all lanes set to zero.
Sourcepub fn splat(val: T) -> Vector<T, Arch>
pub fn splat(val: T) -> Vector<T, Arch>
Construct a Vector by broadcasting a scalar value to all lanes.
Sourcepub fn try_splat(val: T) -> Result<Vector<T, Arch>, SimdError>
pub fn try_splat(val: T) -> Result<Vector<T, Arch>, SimdError>
Try to construct a Vector by broadcasting a scalar value to all lanes.
Sourcepub unsafe fn load_aligned(ptr: *const T) -> Vector<T, Arch>
pub unsafe fn load_aligned(ptr: *const T) -> Vector<T, Arch>
Load a Vector from an aligned pointer.
§Safety
The host must support Arch’s target features, and ptr must be valid
for reads and aligned to Arch::LANE_COUNT * size_of::<T>() bytes.
Sourcepub unsafe fn load_unaligned(ptr: *const T) -> Vector<T, Arch>
pub unsafe fn load_unaligned(ptr: *const T) -> Vector<T, Arch>
Load a Vector from an unaligned pointer.
§Safety
The host must support Arch’s target features, and ptr must be valid
for reads.
Sourcepub unsafe fn store_aligned(self, ptr: *mut T)
pub unsafe fn store_aligned(self, ptr: *mut T)
Store the Vector elements to an aligned pointer.
§Safety
The host must support Arch’s target features, and ptr must be valid
for writes and aligned to Arch::LANE_COUNT * size_of::<T>() bytes.
Sourcepub unsafe fn store_unaligned(self, ptr: *mut T)
pub unsafe fn store_unaligned(self, ptr: *mut T)
Store the Vector elements to an unaligned pointer.
§Safety
The host must support Arch’s target features, and ptr must be valid
for writes.
Sourcepub unsafe fn masked_load_unaligned(
ptr: *const T,
mask: Mask<T, Arch>,
src: Vector<T, Arch>,
) -> Vector<T, Arch>
pub unsafe fn masked_load_unaligned( ptr: *const T, mask: Mask<T, Arch>, src: Vector<T, Arch>, ) -> Vector<T, Arch>
Masked load from an unaligned pointer: active lanes loaded from ptr, inactive lanes from src.
§Safety
The host must support Arch’s target features, and ptr must be valid
for reads of Arch::LANE_COUNT elements.
Sourcepub unsafe fn masked_store_unaligned(self, ptr: *mut T, mask: Mask<T, Arch>)
pub unsafe fn masked_store_unaligned(self, ptr: *mut T, mask: Mask<T, Arch>)
Masked store to an unaligned pointer: active lanes written to ptr, inactive lanes left unchanged.
§Safety
The host must support Arch’s target features, and ptr must be valid
for writes of Arch::LANE_COUNT elements.
Sourcepub fn load_unaligned_from_slice(
data: &[T],
) -> Result<Vector<T, Arch>, SimdError>
pub fn load_unaligned_from_slice( data: &[T], ) -> Result<Vector<T, Arch>, SimdError>
Load one vector from the start of a slice using the unaligned kernel load.
Returns SimdError::InsufficientInputLength when data has fewer
elements than Arch::LANE_COUNT.
Sourcepub fn load_aligned_from_slice(data: &[T]) -> Result<Vector<T, Arch>, SimdError>
pub fn load_aligned_from_slice(data: &[T]) -> Result<Vector<T, Arch>, SimdError>
Load one vector from the start of a slice using the aligned kernel load.
Returns SimdError::InsufficientInputLength when data has fewer
elements than Arch::LANE_COUNT, and SimdError::UnalignedAddress
when the slice start is not aligned to the vector byte width.
Sourcepub fn store_unaligned_to_slice(self, out: &mut [T]) -> Result<(), SimdError>
pub fn store_unaligned_to_slice(self, out: &mut [T]) -> Result<(), SimdError>
Store this vector to the start of a slice using the unaligned kernel store.
Returns SimdError::InsufficientOutputLength when out has fewer
elements than Arch::LANE_COUNT.
Sourcepub fn store_aligned_to_slice(self, out: &mut [T]) -> Result<(), SimdError>
pub fn store_aligned_to_slice(self, out: &mut [T]) -> Result<(), SimdError>
Store this vector to the start of a slice using the aligned kernel store.
Returns SimdError::InsufficientOutputLength when out has fewer
elements than Arch::LANE_COUNT, and SimdError::UnalignedAddress
when the slice start is not aligned to the vector byte width.
Sourcepub fn masked_load_from_slice(
data: &[T],
mask: Mask<T, Arch>,
src: Vector<T, Arch>,
) -> Result<Vector<T, Arch>, SimdError>
pub fn masked_load_from_slice( data: &[T], mask: Mask<T, Arch>, src: Vector<T, Arch>, ) -> Result<Vector<T, Arch>, SimdError>
Safe masked load from a slice.
Active lanes (according to mask) must reside within the bounds of data.
Inactive lanes are populated from the corresponding lanes of src.
Sourcepub fn masked_store_to_slice(
self,
data: &mut [T],
mask: Mask<T, Arch>,
) -> Result<(), SimdError>
pub fn masked_store_to_slice( self, data: &mut [T], mask: Mask<T, Arch>, ) -> Result<(), SimdError>
Safe masked store to a slice.
Active lanes (according to mask) must reside within the bounds of data.
Inactive lanes in the slice are left unchanged.
Sourcepub fn sum_reduce(self) -> T
pub fn sum_reduce(self) -> T
Horizontal sum reduction of all lanes in the Vector.
Sourcepub fn horizontal_bitwise_and(self) -> T
pub fn horizontal_bitwise_and(self) -> T
Horizontal bitwise AND reduction across all lanes.
Sourcepub fn horizontal_bitwise_or(self) -> T
pub fn horizontal_bitwise_or(self) -> T
Horizontal bitwise OR reduction across all lanes.
Sourcepub fn horizontal_bitwise_xor(self) -> T
pub fn horizontal_bitwise_xor(self) -> T
Horizontal bitwise XOR reduction across all lanes.
Sourcepub fn min(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn min(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise minimum of self and other.
Sourcepub fn max(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn max(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise maximum of self and other.
Sourcepub fn cmp_eq(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn cmp_eq(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise equal comparison (self == other).
Sourcepub fn cmp_ne(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn cmp_ne(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise not-equal comparison (self != other).
Sourcepub fn cmp_lt(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn cmp_lt(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise less-than comparison (self < other).
Sourcepub fn cmp_le(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn cmp_le(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise less-than-or-equal comparison (self <= other).
Sourcepub fn cmp_gt(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn cmp_gt(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise greater-than comparison (self > other).
Sourcepub fn cmp_ge(self, other: Vector<T, Arch>) -> Vector<T, Arch>
pub fn cmp_ge(self, other: Vector<T, Arch>) -> Vector<T, Arch>
Elementwise greater-than-or-equal comparison (self >= other).
Sourcepub fn blend(
self,
true_val: Vector<T, Arch>,
false_val: Vector<T, Arch>,
) -> Vector<T, Arch>
pub fn blend( self, true_val: Vector<T, Arch>, false_val: Vector<T, Arch>, ) -> Vector<T, Arch>
Conditional blend: select lanes from true_val where the mask lane in self is active (sign bit set), and from false_val otherwise.
Sourcepub fn from_array<const N: usize>(arr: [T; N]) -> Vector<T, Arch>
pub fn from_array<const N: usize>(arr: [T; N]) -> Vector<T, Arch>
Create a Vector from an array of size N, where N must equal Arch::LANE_COUNT.
Sourcepub fn try_from_array<const N: usize>(
arr: [T; N],
) -> Result<Vector<T, Arch>, SimdError>
pub fn try_from_array<const N: usize>( arr: [T; N], ) -> Result<Vector<T, Arch>, SimdError>
Try to create a Vector from an array of size N, where N must equal
Arch::LANE_COUNT.
Sourcepub fn to_array<const N: usize>(self) -> [T; N]
pub fn to_array<const N: usize>(self) -> [T; N]
Convert the vector to an array of size N, where N must equal Arch::LANE_COUNT.
Sourcepub fn to_bitmask(self) -> BitMask<64>
pub fn to_bitmask(self) -> BitMask<64>
Convert this vector mask representation (sign bits) into a portable BitMask.
Sourcepub fn cmp_eq_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
pub fn cmp_eq_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
Elementwise equal comparison returning a native Mask.
Sourcepub fn cmp_ne_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
pub fn cmp_ne_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
Elementwise not-equal comparison returning a native Mask.
Sourcepub fn cmp_lt_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
pub fn cmp_lt_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
Elementwise less-than comparison returning a native Mask.
Sourcepub fn cmp_le_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
pub fn cmp_le_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
Elementwise less-than-or-equal comparison returning a native Mask.
Sourcepub fn cmp_gt_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
pub fn cmp_gt_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
Elementwise greater-than comparison returning a native Mask.
Sourcepub fn cmp_ge_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
pub fn cmp_ge_mask(self, other: Vector<T, Arch>) -> Mask<T, Arch>
Elementwise greater-than-or-equal comparison returning a native Mask.
Sourcepub fn cast<U>(self) -> Vector<U, Arch>
pub fn cast<U>(self) -> Vector<U, Arch>
Cast the vector elements to another scalar type U where the lane counts match.
Sourcepub fn extract<const I: usize>(self) -> T
pub fn extract<const I: usize>(self) -> T
Extract a single lane element by index at compile-time.
Sourcepub fn insert<const I: usize>(self, val: T) -> Vector<T, Arch>
pub fn insert<const I: usize>(self, val: T) -> Vector<T, Arch>
Insert a value into a single lane by index at compile-time.
Sourcepub fn from_view_chunk<Align, Mode, Ref>(
view: &SimdView<'_, T, Arch, Align, Mode, Ref>,
chunk_idx: usize,
) -> Vector<T, Arch>
pub fn from_view_chunk<Align, Mode, Ref>( view: &SimdView<'_, T, Arch, Align, Mode, Ref>, chunk_idx: usize, ) -> Vector<T, Arch>
Load a Vector from a chunk index of a SimdView.
Sourcepub fn store_to_view_chunk<'a, Align, Mode>(
self,
view: &mut SimdView<'a, T, Arch, Align, Mode, &'a mut [T]>,
chunk_idx: usize,
)where
Align: Alignment,
Mode: ExecutionMode,
pub fn store_to_view_chunk<'a, Align, Mode>(
self,
view: &mut SimdView<'a, T, Arch, Align, Mode, &'a mut [T]>,
chunk_idx: usize,
)where
Align: Alignment,
Mode: ExecutionMode,
Store this Vector into a mutable chunk of a mutable SimdView.
Trait Implementations§
Source§impl<T, Arch> AddAssign for Vector<T, Arch>
impl<T, Arch> AddAssign for Vector<T, Arch>
Source§fn add_assign(&mut self, rhs: Vector<T, Arch>)
fn add_assign(&mut self, rhs: Vector<T, Arch>)
+= operation. Read moreSource§impl<T, Arch> BitAndAssign for Vector<T, Arch>
impl<T, Arch> BitAndAssign for Vector<T, Arch>
Source§fn bitand_assign(&mut self, rhs: Vector<T, Arch>)
fn bitand_assign(&mut self, rhs: Vector<T, Arch>)
&= operation. Read moreSource§impl<T, Arch> BitOrAssign for Vector<T, Arch>
impl<T, Arch> BitOrAssign for Vector<T, Arch>
Source§fn bitor_assign(&mut self, rhs: Vector<T, Arch>)
fn bitor_assign(&mut self, rhs: Vector<T, Arch>)
|= operation. Read moreSource§impl<T, Arch> BitXorAssign for Vector<T, Arch>
impl<T, Arch> BitXorAssign for Vector<T, Arch>
Source§fn bitxor_assign(&mut self, rhs: Vector<T, Arch>)
fn bitxor_assign(&mut self, rhs: Vector<T, Arch>)
^= operation. Read moreimpl<T, Arch> Copy for Vector<T, Arch>
Source§impl<T, Arch> DivAssign for Vector<T, Arch>
impl<T, Arch> DivAssign for Vector<T, Arch>
Source§fn div_assign(&mut self, rhs: Vector<T, Arch>)
fn div_assign(&mut self, rhs: Vector<T, Arch>)
/= operation. Read moreimpl<T, Arch> Eq for Vector<T, Arch>
Source§impl<T, Arch> MulAssign for Vector<T, Arch>
impl<T, Arch> MulAssign for Vector<T, Arch>
Source§fn mul_assign(&mut self, rhs: Vector<T, Arch>)
fn mul_assign(&mut self, rhs: Vector<T, Arch>)
*= operation. Read more