Struct cranelift_codegen::ir::types::Type [−][src]
pub struct Type(_);
The type of an SSA value.
The VOID
type is only used for instructions that produce no value. It can't be part of a SIMD
vector.
Basic integer types: I8
, I16
, I32
, and I64
. These types are sign-agnostic.
Basic floating point types: F32
and F64
. IEEE single and double precision.
Boolean types: B1
, B8
, B16
, B32
, and B64
. These all encode 'true' or 'false'. The
larger types use redundant bits.
SIMD vector types have power-of-two lanes, up to 256. Lanes can be any int/float/bool type.
Methods
impl Type
[src]
impl Type
pub fn lane_type(self) -> Self
[src]
pub fn lane_type(self) -> Self
Get the lane type of this SIMD vector type.
A lane type is the same as a SIMD vector type with one lane, so it returns itself.
pub fn log2_lane_bits(self) -> u8
[src]
pub fn log2_lane_bits(self) -> u8
Get log_2 of the number of bits in a lane.
pub fn lane_bits(self) -> u8
[src]
pub fn lane_bits(self) -> u8
Get the number of bits in a lane.
pub fn int(bits: u16) -> Option<Self>
[src]
pub fn int(bits: u16) -> Option<Self>
Get an integer type with the requested number of bits.
pub fn as_bool_pedantic(self) -> Self
[src]
pub fn as_bool_pedantic(self) -> Self
Get a type with the same number of lanes as this type, but with the lanes replaced by booleans of the same size.
Scalar types are treated as vectors with one lane, so they are converted to the multi-bit boolean types.
pub fn as_bool(self) -> Self
[src]
pub fn as_bool(self) -> Self
Get a type with the same number of lanes as this type, but with the lanes replaced by booleans of the same size.
Scalar types are all converted to b1
which is usually what you want.
pub fn half_width(self) -> Option<Self>
[src]
pub fn half_width(self) -> Option<Self>
Get a type with the same number of lanes as this type, but with lanes that are half the number of bits.
pub fn double_width(self) -> Option<Self>
[src]
pub fn double_width(self) -> Option<Self>
Get a type with the same number of lanes as this type, but with lanes that are twice the number of bits.
pub fn is_void(self) -> bool
[src]
pub fn is_void(self) -> bool
Is this the VOID type?
pub fn is_special(self) -> bool
[src]
pub fn is_special(self) -> bool
Is this a special type?
pub fn is_lane(self) -> bool
[src]
pub fn is_lane(self) -> bool
Is this a lane type?
This is a scalar type that can also appear as the lane type of a SIMD vector.
pub fn is_vector(self) -> bool
[src]
pub fn is_vector(self) -> bool
Is this a SIMD vector type?
A vector type has 2 or more lanes.
pub fn is_bool(self) -> bool
[src]
pub fn is_bool(self) -> bool
Is this a scalar boolean type?
pub fn is_int(self) -> bool
[src]
pub fn is_int(self) -> bool
Is this a scalar integer type?
pub fn is_float(self) -> bool
[src]
pub fn is_float(self) -> bool
Is this a scalar floating point type?
pub fn is_flags(self) -> bool
[src]
pub fn is_flags(self) -> bool
Is this a CPU flags type?
pub fn log2_lane_count(self) -> u8
[src]
pub fn log2_lane_count(self) -> u8
Get log_2 of the number of lanes in this SIMD vector type.
All SIMD types have a lane count that is a power of two and no larger than 256, so this will be a number in the range 0-8.
A scalar type is the same as a SIMD vector type with one lane, so it returns 0.
pub fn lane_count(self) -> u16
[src]
pub fn lane_count(self) -> u16
Get the number of lanes in this SIMD vector type.
A scalar type is the same as a SIMD vector type with one lane, so it returns 1.
pub fn bits(self) -> u16
[src]
pub fn bits(self) -> u16
Get the total number of bits used to represent this type.
pub fn bytes(self) -> u32
[src]
pub fn bytes(self) -> u32
Get the number of bytes used to store this type in memory.
pub fn by(self, n: u16) -> Option<Self>
[src]
pub fn by(self, n: u16) -> Option<Self>
Get a SIMD vector type with n
times more lanes than this one.
If this is a scalar type, this produces a SIMD type with this as a lane type and n
lanes.
If this is already a SIMD vector type, this produces a SIMD vector type with n * self.lane_count()
lanes.
pub fn half_vector(self) -> Option<Self>
[src]
pub fn half_vector(self) -> Option<Self>
Get a SIMD vector with half the number of lanes.
There is no double_vector()
method. Use t.by(2)
instead.
pub fn index(self) -> usize
[src]
pub fn index(self) -> usize
Index of this type, for use with hash tables etc.
pub fn wider_or_equal(self, other: Self) -> bool
[src]
pub fn wider_or_equal(self, other: Self) -> bool
True iff:
self.lane_count() == other.lane_count()
andself.lane_bits() >= other.lane_bits()
Trait Implementations
impl Copy for Type
[src]
impl Copy for Type
impl Clone for Type
[src]
impl Clone for Type
fn clone(&self) -> Type
[src]
fn clone(&self) -> Type
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Type
[src]
impl PartialEq for Type
fn eq(&self, other: &Type) -> bool
[src]
fn eq(&self, other: &Type) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Type) -> bool
[src]
fn ne(&self, other: &Type) -> bool
This method tests for !=
.
impl Eq for Type
[src]
impl Eq for Type
impl Hash for Type
[src]
impl Hash for Type
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Type
[src]
impl Display for Type
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Debug for Type
[src]
impl Debug for Type
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Type
[src]
impl Default for Type