Simd

Trait Simd 

Source
pub trait Simd: Copy + Debug {
    type Array: AsRef<[Self::Elem]> + Copy + Debug + IntoIterator<Item = Self::Elem> + PartialEq<Self::Array> + Index<usize, Output = Self::Elem> + IndexMut<usize, Output = Self::Elem>;
    type Elem: Elem;
    type Mask: Mask;
    type Isa: Isa;

    // Required methods
    fn to_bits(self) -> <Self::Isa as Isa>::Bits;
    fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self;
    fn to_array(self) -> Self::Array;

    // Provided methods
    fn reinterpret_cast<T>(self) -> T
       where T: Simd<Isa = Self::Isa> { ... }
    fn same_cast<T>(self) -> T
       where T: Simd<Elem = Self::Elem, Isa = Self::Isa> { ... }
}
Expand description

SIMD vector type.

Required Associated Types§

Source

type Array: AsRef<[Self::Elem]> + Copy + Debug + IntoIterator<Item = Self::Elem> + PartialEq<Self::Array> + Index<usize, Output = Self::Elem> + IndexMut<usize, Output = Self::Elem>

Representation of this vector as a [Self::Elem; N] array.

Source

type Elem: Elem

Type of data held in each SIMD lane.

Source

type Mask: Mask

Mask with the same number of elements as this vector.

Source

type Isa: Isa

The ISA associated with this SIMD vector.

Required Methods§

Source

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Convert this SIMD vector to the common “bits” type used by all vectors in this family.

Source

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Convert this SIMD vector from the common “bits” type used by all vectors in this family.

Source

fn to_array(self) -> Self::Array

Convert self to a SIMD array.

This is a cheap transmute in most cases, since SIMD vectors usually have the same layout as [S::Elem; N] but a greater alignment.

Provided Methods§

Source

fn reinterpret_cast<T>(self) -> T
where T: Simd<Isa = Self::Isa>,

Reinterpret the bits of this vector as another vector from the same family.

Source

fn same_cast<T>(self) -> T
where T: Simd<Elem = Self::Elem, Isa = Self::Isa>,

Cast this vector to another with the same ISA and element type.

This cast is a no-op which doesn’t generate any code. It is needed in some cases to downcast a Simd type to one of an Isas associated types, or vice-versa.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Simd for float32x4_t

Source§

type Elem = f32

Source§

type Array = [<float32x4_t as Simd>::Elem; 4]

Source§

type Mask = uint32x4_t

Source§

type Isa = ArmNeonIsa

Source§

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Source§

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Source§

fn to_array(self) -> Self::Array

Source§

impl Simd for int8x16_t

Source§

type Elem = i8

Source§

type Array = [<int8x16_t as Simd>::Elem; 16]

Source§

type Mask = uint8x16_t

Source§

type Isa = ArmNeonIsa

Source§

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Source§

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Source§

fn to_array(self) -> Self::Array

Source§

impl Simd for int16x8_t

Source§

type Elem = i16

Source§

type Array = [<int16x8_t as Simd>::Elem; 8]

Source§

type Mask = uint16x8_t

Source§

type Isa = ArmNeonIsa

Source§

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Source§

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Source§

fn to_array(self) -> Self::Array

Source§

impl Simd for int32x4_t

Source§

type Elem = i32

Source§

type Array = [<int32x4_t as Simd>::Elem; 4]

Source§

type Mask = uint32x4_t

Source§

type Isa = ArmNeonIsa

Source§

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Source§

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Source§

fn to_array(self) -> Self::Array

Source§

impl Simd for uint8x16_t

Source§

type Elem = u8

Source§

type Array = [<uint8x16_t as Simd>::Elem; 16]

Source§

type Mask = uint8x16_t

Source§

type Isa = ArmNeonIsa

Source§

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Source§

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Source§

fn to_array(self) -> Self::Array

Source§

impl Simd for uint16x8_t

Source§

type Elem = u16

Source§

type Array = [<uint16x8_t as Simd>::Elem; 8]

Source§

type Mask = uint16x8_t

Source§

type Isa = ArmNeonIsa

Source§

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Source§

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Source§

fn to_array(self) -> Self::Array

Source§

impl Simd for uint32x4_t

Source§

type Elem = u32

Source§

type Array = [<uint32x4_t as Simd>::Elem; 4]

Source§

type Mask = uint32x4_t

Source§

type Isa = ArmNeonIsa

Source§

fn to_bits(self) -> <Self::Isa as Isa>::Bits

Source§

fn from_bits(bits: <Self::Isa as Isa>::Bits) -> Self

Source§

fn to_array(self) -> Self::Array

Implementors§