Skip to main content

Simd

Struct Simd 

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

Implementations§

Source§

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

Source

pub fn zero() -> Simd<T, A>

Source

pub fn from_aligned_slice(slice: &[T]) -> Simd<T, A>

Source

pub unsafe fn from_aligned_slice_unchecked(slice: &[T]) -> Simd<T, A>

§Safety

Does not check if the slice goes out of bounds.

Source

pub fn from_slice(slice: &[T]) -> Simd<T, A>

Source

pub unsafe fn from_slice_partial(slice: &[T]) -> Simd<T, A>

§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]) -> Simd<T, A>

§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 as SimdElement>::Array<A>

Converts the Simd register into an array.

§Example

TODO use simply_simd::

Source

pub fn iota(offset: T) -> Simd<T, A>

Source§

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

Source

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

Source§

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

Source

pub fn clamp( self, lower_bound: Simd<T, A>, upper_bound: Simd<T, A>, ) -> Simd<T, A>

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) -> Simd<T, A>

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

Source

pub fn block_right_byte_shift<const N: i32>(self) -> Simd<T, A>

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

Source

pub fn blend<const N: i32>(self, false_values: Simd<T, A>) -> Simd<T, A>

Blends two registers using an immediate mask.

Source§

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

Source

pub fn splat(val: T) -> Simd<T, A>

Broadcasts a value across the entire register.

Source

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

Loads a register according to a mask.

Source

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

Loads only the first amount elements into the register.

Source

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

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: Simd<T, A>) -> Mask<T, A>

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn max(self, rhs: Simd<T, A>) -> Simd<T, A>

Source

pub fn min(self, rhs: Simd<T, A>) -> Simd<T, A>

Source§

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

Source

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

Source§

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

Source

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

Source

pub fn permute_8_pattern_32(self, indices: [u8; 4]) -> Simd<T, A>

Source§

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

Source

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

Source§

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

Source

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

Source§

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

Source

pub fn left_lane_shift(self, n: u32) -> Simd<T, A>

Source

pub fn right_lane_shift(self, n: u32) -> Simd<T, A>

Source§

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

Source

pub fn andnot(self, rhs: Simd<T, A>) -> Simd<T, A>

Source§

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

Source

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

Source§

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

Source

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

Source§

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

Source

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

Source§

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

Source

pub fn floor(self) -> Simd<T, A>

Source

pub fn round(self) -> Simd<T, A>

Source

pub fn ceil(self) -> Simd<T, A>

Source

pub fn fract(self) -> Simd<T, A>

Source

pub fn mul_add(self, mult: Simd<T, A>, add: Simd<T, A>) -> Simd<T, A>

Source

pub fn mul_sub(self, mult: Simd<T, A>, sub: Simd<T, A>) -> Simd<T, A>

Source

pub fn negated_mul_add(self, mult: Simd<T, A>, add: Simd<T, A>) -> Simd<T, A>

Source

pub fn negated_mul_sub(self, mult: Simd<T, A>, sub: Simd<T, A>) -> Simd<T, A>

Source

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

Source

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

Source

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

Source

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

Source

pub fn quintic_lerp(self) -> Simd<T, A>

Source

pub fn cubic_lerp(self) -> Simd<T, A>

Source

pub fn sqrt(self) -> Simd<T, A>

Source

pub fn abs(self) -> Simd<T, A>

Source

pub fn rsqrt(self) -> Simd<T, A>

Only rsqrt_f32 currently supported.

Source§

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

Source

pub fn exp(self) -> Simd<T, A>

Source

pub unsafe fn exp_unchecked(self) -> Simd<T, A>

§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) -> Simd<T, A>

Source

pub unsafe fn exp2_unchecked(self) -> Simd<T, A>

§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) -> Simd<T, A>

Source

pub unsafe fn log2_unchecked(self) -> Simd<T, A>

§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: Simd<T, A>) -> Simd<T, A>

Source

pub unsafe fn pow_unchecked(self, y: Simd<T, A>) -> Simd<T, A>

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

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

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, A> Add for Simd<T, A>
where T: SimdElement, A: Arch,

Source§

type Output = Simd<T, A>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Simd<T, A>) -> Simd<T, A>

Performs the + operation. Read more
Source§

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

Source§

fn add_assign(&mut self, rhs: Simd<T, A>)

Performs the += operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Simd<T, A>) -> Simd<T, A>

Performs the & operation. Read more
Source§

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

Source§

fn bitand_assign(&mut self, rhs: Simd<T, A>)

Performs the &= operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Simd<T, A>) -> Simd<T, A>

Performs the | operation. Read more
Source§

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

Source§

fn bitor_assign(&mut self, rhs: Simd<T, A>)

Performs the |= operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Simd<T, A>) -> Simd<T, A>

Performs the ^ operation. Read more
Source§

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

Source§

fn bitxor_assign(&mut self, rhs: Simd<T, A>)

Performs the ^= operation. Read more
Source§

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

Source§

fn clone(&self) -> Simd<T, A>

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, A> Copy for Simd<T, A>
where T: Copy + SimdElement, A: Copy + Arch, <A as Arch>::Vec: Copy,

Source§

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

Source§

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

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

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

Source§

fn default() -> Simd<T, A>

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

impl<A: Arch> DimTuple<A, 1> for Simd<f32, A>

Source§

fn into_array(self) -> [Simd<f32, A>; 1]

Converts the internal iterator representation into a generically sized array.
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Simd<T, A>) -> Simd<T, A>

Performs the / operation. Read more
Source§

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

Source§

fn div_assign(&mut self, rhs: Simd<T, A>)

Performs the /= operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Simd<T, A>) -> Simd<T, A>

Performs the * operation. Read more
Source§

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

Source§

fn mul_assign(&mut self, rhs: Simd<T, A>)

Performs the *= operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Simd<T, A>

Performs the unary - operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Simd<T, A>

Performs the unary ! operation. Read more
Source§

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

Source§

fn rem_assign(&mut self, rhs: Simd<T, A>)

Performs the %= operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

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

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

Performs the << operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

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

fn shl(self, rhs: usize) -> Simd<T, A>

Performs the << operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

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

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

Performs the >> operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

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

fn shr(self, rhs: usize) -> Simd<T, A>

Performs the >> operation. Read more
Source§

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

Source§

type Output = Simd<T, A>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Simd<T, A>) -> Simd<T, A>

Performs the - operation. Read more
Source§

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

Source§

fn sub_assign(&mut self, rhs: Simd<T, A>)

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.