Skip to main content

Simd

Struct Simd 

Source
pub struct Simd<T: SimdElement, A: Arch = StaticArch> { /* private fields */ }

Implementations§

Source§

impl<T: SimdElement, A: Arch> Simd<T, A>

Source

pub fn zero() -> Self

Source

pub fn from_aligned_slice(slice: &[T]) -> Self

Source

pub unsafe fn from_aligned_slice_unchecked(slice: &[T]) -> Self

§Safety

Does not check if the slice goes out of bounds.

Source

pub fn from_slice(slice: &[T]) -> Self

Source

pub unsafe fn from_slice_partial(slice: &[T]) -> Self

§Safety

Requires allocated memory to be behind (left) of the slice. Bounds are not checked. Length of the slice must be less than or equal to the number of lanes.

Source

pub unsafe fn from_slice_unchecked(slice: &[T]) -> Self

§Safety

Does not check if the slice goes out of bounds.

Source

pub fn copy_to_aligned_slice(self, slice: &mut [T])

Source

pub unsafe fn copy_to_aligned_slice_unchecked(self, slice: &mut [T])

§Safety

Does not check if the slice goes out of bounds.

Source

pub fn copy_to_slice(self, slice: &mut [T])

Source

pub unsafe fn copy_to_slice_unchecked(self, slice: &mut [T])

§Safety

Does not check if the slice goes out of bounds.

Source

pub fn to_array(self) -> T::Array<A>

Converts the Simd register into an array.

§Example

TODO use simply_simd::

Source

pub fn iota(offset: T) -> Self

Source§

impl<T: SimdElement, A: Arch> Simd<T, A>

Source

pub fn raw_cast<S: SimdElement>(self) -> Simd<S, A>

Source§

impl<T: SimdElement, A: Arch> Simd<T, A>

Source

pub fn clamp(self, lower_bound: Self, upper_bound: Self) -> Self

Clamps the values in a register between two bounds, inclusive.

§Parameters:
  • lower_bound: Minimum value after clamping
  • upper_bound: Maximum value after clamping
Source

pub fn block_left_byte_shift<const N: i32>(self) -> Self

Shifts bytes N to the left within 128-bit blocks.

Source

pub fn block_right_byte_shift<const N: i32>(self) -> Self

Shifts bytes N to the right within 128-bit blocks.

Source

pub fn blend<const N: i32>(self, false_values: Self) -> Self

Blends two registers using an immediate mask.

Source§

impl<T: SimdElement, A: Arch> Simd<T, A>

Source

pub fn splat(val: T) -> Self

Broadcasts a value across the entire register.

Source

pub fn masked_load(slice: &[T], mask: Mask<T, A>) -> Self

Loads a register according to a mask.

Source

pub fn partial_load(slice: &[T], amount: usize) -> Self

Loads only the first amount elements into the register.

Source

pub unsafe fn partial_load_unchecked(slice: &[T], amount: usize) -> Self

Loads only the first amount elements into the register.

§Safety
  • Slice must be greater than or equal to ArchSimd::<T>::LANES
Source

pub fn masked_store(self, slice: &mut [T], mask: Mask<T, A>)

Stores the register using a given mask.

Source

pub fn partial_store(self, slice: &mut [T], amount: usize)

Stores only the first amount elements into the register.

Source

pub fn simd_eq(self, rhs: Self) -> Mask<T, A>

Source

pub fn simd_ne(self, rhs: Self) -> Mask<T, A>

Source

pub fn simd_gt(self, rhs: Self) -> Mask<T, A>

Source

pub fn simd_ge(self, rhs: Self) -> Mask<T, A>

Source

pub fn simd_lt(self, rhs: Self) -> Mask<T, A>

Source

pub fn simd_le(self, rhs: Self) -> Mask<T, A>

Source

pub fn max(self, rhs: Self) -> Self

Source

pub fn min(self, rhs: Self) -> Self

Source§

impl<T: SimdElement + SimdElement<BitWidthType = B32>, A: Arch> Simd<T, A>

Source

pub fn permute_32(self, indices: Simd<u32, A>) -> Self

Source§

impl<T: SimdElement, A: Arch> Simd<T, A>

Source

pub fn permute_8(self, indices: Simd<u8, A>) -> Self

Source

pub fn permute_8_pattern_32(self, indices: [u8; 4]) -> Self

Source§

impl<A: Arch> Simd<u32, A>

Source

pub fn gather<S: SimdElement + SimdElement<BitWidthType = B32>, const N: usize>( self, slice: &[S; N], ) -> Simd<S, A>

Source§

impl<A: Arch> Simd<u64, A>

Source

pub fn gather<S: SimdElement + SimdElement<BitWidthType = B64>, const N: usize>( self, slice: &[S; N], ) -> Simd<S, A>

Source§

impl<T: SimdElement, A: Arch> Simd<T, A>

Source

pub fn left_lane_shift(self, n: u32) -> Self

Source

pub fn right_lane_shift(self, n: u32) -> Self

Source§

impl<T: SimdInteger, A: Arch> Simd<T, A>

Source

pub fn andnot(self, rhs: Self) -> Self

Source§

impl<T: SimdInteger + HasSigned, A: Arch> Simd<T, A>

Source

pub fn cast_signed(self) -> Simd<<T as SimdInteger>::Signed, A>

Source§

impl<T: SimdInteger + HasUnsigned, A: Arch> Simd<T, A>

Source

pub fn cast_unsigned(self) -> Simd<<T as SimdInteger>::Unsigned, A>

Source§

impl<T: SimdInteger + HasFloat, A: Arch> Simd<T, A>

Source

pub fn cast_float(self) -> Simd<<T as HasFloat>::Float, A>

Source§

impl<T: SimdFloat, A: Arch> Simd<T, A>

Source

pub fn floor(self) -> Self

Source

pub fn round(self) -> Self

Source

pub fn ceil(self) -> Self

Source

pub fn fract(self) -> Self

Source

pub fn mul_add(self, mult: Self, add: Self) -> Self

Source

pub fn mul_sub(self, mult: Self, sub: Self) -> Self

Source

pub fn negated_mul_add(self, mult: Self, add: Self) -> Self

Source

pub fn negated_mul_sub(self, mult: Self, sub: Self) -> Self

Source

pub fn cast_int_trunc(self) -> Simd<T::Signed, A>

Source

pub fn cast_int_round(self) -> Simd<T::Signed, A>

Source

pub fn cast_uint_trunc(self) -> Simd<T::Unsigned, A>

Source

pub fn cast_uint_round(self) -> Simd<T::Unsigned, A>

Source

pub fn quintic_lerp(self) -> Self

Source

pub fn cubic_lerp(self) -> Self

Source

pub fn sqrt(self) -> Self

Source

pub fn abs(self) -> Self

Source

pub fn rsqrt(self) -> Self

Only rsqrt_f32 currently supported.

Source§

impl<T: SimdFloat, A: Arch> Simd<T, A>

Source

pub fn exp(self) -> Self

Source

pub unsafe fn exp_unchecked(self) -> Self

§Safety

Does not check for the 0.0 or INF cases. Assumes the given values do not result in 0.0 or INF.

Source

pub fn exp2(self) -> Self

Source

pub unsafe fn exp2_unchecked(self) -> Self

§Safety

Does not check for the 0.0 or INF cases. Assumes the given values do not result in 0.0 or INF.

Source

pub fn log2(self) -> Self

Source

pub unsafe fn log2_unchecked(self) -> Self

§Safety

Does not check for the -INF, INF, or NaN cases. Assumes the given values do not result in 0.0 or INF.

Source

pub fn pow(self, y: Self) -> Self

Source

pub unsafe fn pow_unchecked(self, y: Self) -> Self

§Safety
  • self must be positive, normal, and finite.
  • y must be finite.
  • Result must be representable as an f32.
Source§

impl<T: SimdElement, A: Arch> Simd<T, A>

Source

pub const SIMD_WIDTH: usize = A::SIMD_WIDTH

Source

pub const LANE_SIZE: usize

Source

pub const LANES: usize

Trait Implementations§

Source§

impl<T: SimdElement, A: Arch> Add for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<T: SimdElement, A: Arch> AddAssign for Simd<T, A>
where Self: Add<Output = Self> + Copy,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T: SimdInteger, A: Arch> BitAnd for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
Source§

impl<T: SimdElement, A: Arch> BitAndAssign for Simd<T, A>
where Self: BitAnd<Output = Self> + Copy,

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl<T: SimdInteger, A: Arch> BitOr for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
Source§

impl<T: SimdElement, A: Arch> BitOrAssign for Simd<T, A>
where Self: BitOr<Output = Self> + Copy,

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl<T: SimdInteger, A: Arch> BitXor for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self

Performs the ^ operation. Read more
Source§

impl<T: SimdElement, A: Arch> BitXorAssign for Simd<T, A>
where Self: BitXor<Output = Self> + Copy,

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl<T: Clone + SimdElement, A: Clone + Arch> Clone for Simd<T, A>
where A::Vec: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Copy + SimdElement, A: Copy + Arch> Copy for Simd<T, A>
where A::Vec: Copy,

Source§

impl<T: SimdElement, A: Arch> Debug for Simd<T, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: SimdElement, A: Arch> Default for Simd<T, A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: SimdFloat, A: Arch> Div for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<T: SimdElement, A: Arch> DivAssign for Simd<T, A>
where Self: Div<Output = Self> + Copy,

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<T: SimdElement, A: Arch, const N: usize> FromIterator<Simd<T, A>> for [T; N]

Source§

fn from_iter<I: IntoIterator<Item = Simd<T, A>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: SimdElement, A: Arch> FromIterator<Simd<T, A>> for Vec<T>

Source§

fn from_iter<I: IntoIterator<Item = Simd<T, A>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: SimdMulType, A: Arch> Mul for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<T: SimdElement, A: Arch> MulAssign for Simd<T, A>
where Self: Mul<Output = Self> + Copy,

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<T: SimdElement, A: Arch> Neg for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<T: SimdInteger, A: Arch> Not for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self

Performs the unary ! operation. Read more
Source§

impl<T: SimdElement, A: Arch> RemAssign for Simd<T, A>
where Self: Rem<Output = Self> + Copy,

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<T: SimdIntegerNotByte, A: Arch> Shl<Simd<<T as SimdInteger>::Unsigned, A>> for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: Simd<<T as SimdInteger>::Unsigned, A>) -> Self

Performs the << operation. Read more
Source§

impl<T: SimdIntegerNotByte, A: Arch> Shl<usize> for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: usize) -> Self

Performs the << operation. Read more
Source§

impl<T: SimdIntegerNotByte, A: Arch> Shr<Simd<<T as SimdInteger>::Unsigned, A>> for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: Simd<<T as SimdInteger>::Unsigned, A>) -> Self

Performs the >> operation. Read more
Source§

impl<T: SimdIntegerNotByte, A: Arch> Shr<usize> for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: usize) -> Self

Performs the >> operation. Read more
Source§

impl<T: SimdElement, A: Arch> Sub for Simd<T, A>

Source§

type Output = Simd<T, A>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<T: SimdElement, A: Arch> SubAssign for Simd<T, A>
where Self: Sub<Output = Self> + Copy,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T, A> Freeze for Simd<T, A>
where <A as Arch>::Vec: Freeze, PhantomData<T>: Freeze,

§

impl<T, A> RefUnwindSafe for Simd<T, A>

§

impl<T, A> Send for Simd<T, A>
where <A as Arch>::Vec: Send, PhantomData<T>: Send,

§

impl<T, A> Sync for Simd<T, A>
where <A as Arch>::Vec: Sync, PhantomData<T>: Sync,

§

impl<T, A> Unpin for Simd<T, A>
where <A as Arch>::Vec: Unpin, PhantomData<T>: Unpin,

§

impl<T, A> UnsafeUnpin for Simd<T, A>

§

impl<T, A> UnwindSafe for Simd<T, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.