[meta] Move the TypeSet building out of the TypeVar builder so as to test it;
This commit is contained in:
@@ -36,6 +36,54 @@ pub struct TypeVar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TypeVar {
|
impl TypeVar {
|
||||||
|
pub fn new(name: impl Into<String>, doc: impl Into<String>, type_set: TypeSet) -> Self {
|
||||||
|
Self {
|
||||||
|
content: Rc::new(TypeVarContent {
|
||||||
|
name: name.into(),
|
||||||
|
doc: doc.into(),
|
||||||
|
type_set: Rc::new(type_set),
|
||||||
|
base: None,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_singleton(value_type: ValueType) -> Self {
|
||||||
|
let (name, doc) = (value_type.to_string(), value_type.doc());
|
||||||
|
let mut builder = TypeSetBuilder::new();
|
||||||
|
|
||||||
|
let (scalar_type, num_lanes) = match value_type {
|
||||||
|
ValueType::BV(bitvec_type) => {
|
||||||
|
let bits = bitvec_type.lane_bits() as RangeBound;
|
||||||
|
return TypeVar::new(name, doc, builder.bitvecs(bits..bits).finish());
|
||||||
|
}
|
||||||
|
ValueType::Special(special_type) => {
|
||||||
|
return TypeVar::new(name, doc, builder.specials(vec![special_type]).finish());
|
||||||
|
}
|
||||||
|
ValueType::Lane(lane_type) => (lane_type, 1),
|
||||||
|
ValueType::Vector(vec_type) => {
|
||||||
|
(vec_type.lane_type(), vec_type.lane_count() as RangeBound)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
builder = builder.simd_lanes(num_lanes..num_lanes);
|
||||||
|
|
||||||
|
let builder = match scalar_type {
|
||||||
|
LaneType::IntType(int_type) => {
|
||||||
|
let bits = int_type as RangeBound;
|
||||||
|
builder.ints(bits..bits)
|
||||||
|
}
|
||||||
|
LaneType::FloatType(float_type) => {
|
||||||
|
let bits = float_type as RangeBound;
|
||||||
|
builder.floats(bits..bits)
|
||||||
|
}
|
||||||
|
LaneType::BoolType(bool_type) => {
|
||||||
|
let bits = bool_type as RangeBound;
|
||||||
|
builder.bools(bits..bits)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TypeVar::new(name, doc, builder.finish())
|
||||||
|
}
|
||||||
|
|
||||||
fn get_typeset(&self) -> Rc<TypeSet> {
|
fn get_typeset(&self) -> Rc<TypeSet> {
|
||||||
match &self.content.base {
|
match &self.content.base {
|
||||||
Some(base) => Rc::new(base.type_var.get_typeset().image(base.derived_func)),
|
Some(base) => Rc::new(base.type_var.get_typeset().image(base.derived_func)),
|
||||||
@@ -162,7 +210,7 @@ impl Into<TypeVar> for &TypeVar {
|
|||||||
}
|
}
|
||||||
impl Into<TypeVar> for ValueType {
|
impl Into<TypeVar> for ValueType {
|
||||||
fn into(self) -> TypeVar {
|
fn into(self) -> TypeVar {
|
||||||
TypeVarBuilder::singleton(self)
|
TypeVar::new_singleton(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,6 +477,83 @@ impl TypeSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct TypeSetBuilder {
|
||||||
|
ints: Interval,
|
||||||
|
floats: Interval,
|
||||||
|
bools: Interval,
|
||||||
|
bitvecs: Interval,
|
||||||
|
includes_scalars: bool,
|
||||||
|
simd_lanes: Interval,
|
||||||
|
specials: Vec<SpecialType>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeSetBuilder {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
ints: Interval::None,
|
||||||
|
floats: Interval::None,
|
||||||
|
bools: Interval::None,
|
||||||
|
bitvecs: Interval::None,
|
||||||
|
includes_scalars: true,
|
||||||
|
simd_lanes: Interval::None,
|
||||||
|
specials: Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ints(mut self, interval: impl Into<Interval>) -> Self {
|
||||||
|
assert!(self.ints == Interval::None);
|
||||||
|
self.ints = interval.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
pub fn floats(mut self, interval: impl Into<Interval>) -> Self {
|
||||||
|
assert!(self.floats == Interval::None);
|
||||||
|
self.floats = interval.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
pub fn bools(mut self, interval: impl Into<Interval>) -> Self {
|
||||||
|
assert!(self.bools == Interval::None);
|
||||||
|
self.bools = interval.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
pub fn includes_scalars(mut self, includes_scalars: bool) -> Self {
|
||||||
|
self.includes_scalars = includes_scalars;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
pub fn simd_lanes(mut self, interval: impl Into<Interval>) -> Self {
|
||||||
|
assert!(self.simd_lanes == Interval::None);
|
||||||
|
self.simd_lanes = interval.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
pub fn bitvecs(mut self, interval: impl Into<Interval>) -> Self {
|
||||||
|
assert!(self.bitvecs == Interval::None);
|
||||||
|
self.bitvecs = interval.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
pub fn specials(mut self, specials: Vec<SpecialType>) -> Self {
|
||||||
|
assert!(self.specials.is_empty());
|
||||||
|
self.specials = specials;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn finish(self) -> TypeSet {
|
||||||
|
let min_lanes = if self.includes_scalars { 1 } else { 2 };
|
||||||
|
;
|
||||||
|
let bools = range_to_set(self.bools.to_range(1..MAX_BITS, None))
|
||||||
|
.into_iter()
|
||||||
|
.filter(legal_bool)
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
TypeSet::new(
|
||||||
|
range_to_set(self.simd_lanes.to_range(min_lanes..MAX_LANES, Some(1))),
|
||||||
|
range_to_set(self.ints.to_range(8..MAX_BITS, None)),
|
||||||
|
range_to_set(self.floats.to_range(32..64, None)),
|
||||||
|
bools,
|
||||||
|
range_to_set(self.bitvecs.to_range(1..MAX_BITVEC, None)),
|
||||||
|
self.specials,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
pub enum Interval {
|
pub enum Interval {
|
||||||
None,
|
None,
|
||||||
@@ -468,131 +593,6 @@ impl Into<Interval> for Range {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TypeVarBuilder {
|
|
||||||
name: String,
|
|
||||||
doc: String,
|
|
||||||
ints: Interval,
|
|
||||||
floats: Interval,
|
|
||||||
bools: Interval,
|
|
||||||
bitvecs: Interval,
|
|
||||||
includes_scalars: bool,
|
|
||||||
simd_lanes: Interval,
|
|
||||||
specials: Vec<SpecialType>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TypeVarBuilder {
|
|
||||||
pub fn new(name: impl Into<String>, doc: impl Into<String>) -> Self {
|
|
||||||
Self {
|
|
||||||
name: name.into(),
|
|
||||||
doc: doc.into(),
|
|
||||||
ints: Interval::None,
|
|
||||||
floats: Interval::None,
|
|
||||||
bools: Interval::None,
|
|
||||||
bitvecs: Interval::None,
|
|
||||||
includes_scalars: true,
|
|
||||||
simd_lanes: Interval::None,
|
|
||||||
specials: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn singleton(value_type: ValueType) -> TypeVar {
|
|
||||||
let mut builder = TypeVarBuilder::new(value_type.to_string(), value_type.doc());
|
|
||||||
|
|
||||||
let (scalar_type, num_lanes) = match value_type {
|
|
||||||
ValueType::BV(bitvec_type) => {
|
|
||||||
let bits = bitvec_type.lane_bits() as RangeBound;
|
|
||||||
return builder.bitvecs(bits..bits).finish();
|
|
||||||
}
|
|
||||||
ValueType::Special(special_type) => {
|
|
||||||
return builder.specials(vec![special_type]).finish();
|
|
||||||
}
|
|
||||||
ValueType::Lane(lane_type) => (lane_type, 1),
|
|
||||||
ValueType::Vector(vec_type) => {
|
|
||||||
(vec_type.lane_type(), vec_type.lane_count() as RangeBound)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
builder = builder.simd_lanes(num_lanes..num_lanes);
|
|
||||||
|
|
||||||
match scalar_type {
|
|
||||||
LaneType::IntType(int_type) => {
|
|
||||||
let bits = int_type as RangeBound;
|
|
||||||
return builder.ints(bits..bits).finish();
|
|
||||||
}
|
|
||||||
LaneType::FloatType(float_type) => {
|
|
||||||
let bits = float_type as RangeBound;
|
|
||||||
return builder.floats(bits..bits).finish();
|
|
||||||
}
|
|
||||||
LaneType::BoolType(bool_type) => {
|
|
||||||
let bits = bool_type as RangeBound;
|
|
||||||
return builder.bools(bits..bits).finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn ints(mut self, interval: impl Into<Interval>) -> Self {
|
|
||||||
assert!(self.ints == Interval::None);
|
|
||||||
self.ints = interval.into();
|
|
||||||
self
|
|
||||||
}
|
|
||||||
pub fn floats(mut self, interval: impl Into<Interval>) -> Self {
|
|
||||||
assert!(self.floats == Interval::None);
|
|
||||||
self.floats = interval.into();
|
|
||||||
self
|
|
||||||
}
|
|
||||||
pub fn bools(mut self, interval: impl Into<Interval>) -> Self {
|
|
||||||
assert!(self.bools == Interval::None);
|
|
||||||
self.bools = interval.into();
|
|
||||||
self
|
|
||||||
}
|
|
||||||
pub fn includes_scalars(mut self, includes_scalars: bool) -> Self {
|
|
||||||
self.includes_scalars = includes_scalars;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
pub fn simd_lanes(mut self, interval: impl Into<Interval>) -> Self {
|
|
||||||
assert!(self.simd_lanes == Interval::None);
|
|
||||||
self.simd_lanes = interval.into();
|
|
||||||
self
|
|
||||||
}
|
|
||||||
pub fn bitvecs(mut self, interval: impl Into<Interval>) -> Self {
|
|
||||||
assert!(self.bitvecs == Interval::None);
|
|
||||||
self.bitvecs = interval.into();
|
|
||||||
self
|
|
||||||
}
|
|
||||||
pub fn specials(mut self, specials: Vec<SpecialType>) -> Self {
|
|
||||||
assert!(self.specials.is_empty());
|
|
||||||
self.specials = specials;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn finish(self) -> TypeVar {
|
|
||||||
let min_lanes = if self.includes_scalars { 1 } else { 2 };
|
|
||||||
|
|
||||||
let bools = range_to_set(self.bools.to_range(1..MAX_BITS, None))
|
|
||||||
.into_iter()
|
|
||||||
.filter(legal_bool)
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let type_set = Rc::new(TypeSet::new(
|
|
||||||
range_to_set(self.simd_lanes.to_range(min_lanes..MAX_LANES, Some(1))),
|
|
||||||
range_to_set(self.ints.to_range(8..MAX_BITS, None)),
|
|
||||||
range_to_set(self.floats.to_range(32..64, None)),
|
|
||||||
bools,
|
|
||||||
range_to_set(self.bitvecs.to_range(1..MAX_BITVEC, None)),
|
|
||||||
self.specials,
|
|
||||||
));
|
|
||||||
|
|
||||||
TypeVar {
|
|
||||||
content: Rc::new(TypeVarContent {
|
|
||||||
name: self.name.to_string(),
|
|
||||||
doc: self.doc.to_string(),
|
|
||||||
type_set,
|
|
||||||
base: None,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn legal_bool(bits: &RangeBound) -> bool {
|
fn legal_bool(bits: &RangeBound) -> bool {
|
||||||
// Only allow legal bit widths for bool types.
|
// Only allow legal bit widths for bool types.
|
||||||
*bits == 1 || (*bits >= 8 && *bits <= MAX_BITS && bits.is_power_of_two())
|
*bits == 1 || (*bits >= 8 && *bits <= MAX_BITS && bits.is_power_of_two())
|
||||||
@@ -620,91 +620,73 @@ fn range_to_set(range: Option<Range>) -> NumSet {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_typevar_builder() {
|
fn test_typevar_builder() {
|
||||||
let typevar = TypeVarBuilder::new("test", "scalar integers")
|
let type_set = TypeSetBuilder::new().ints(Interval::All).finish();
|
||||||
.ints(Interval::All)
|
assert_eq!(type_set.lanes, num_set![1]);
|
||||||
.finish();
|
assert!(type_set.floats.is_empty());
|
||||||
assert_eq!(typevar.type_set.lanes, num_set![1]);
|
assert_eq!(type_set.ints, num_set![8, 16, 32, 64]);
|
||||||
assert!(typevar.type_set.floats.is_empty());
|
assert!(type_set.bools.is_empty());
|
||||||
assert_eq!(typevar.type_set.ints, num_set![8, 16, 32, 64]);
|
assert!(type_set.bitvecs.is_empty());
|
||||||
assert!(typevar.type_set.bools.is_empty());
|
assert!(type_set.specials.is_empty());
|
||||||
assert!(typevar.type_set.bitvecs.is_empty());
|
|
||||||
assert!(typevar.type_set.specials.is_empty());
|
|
||||||
|
|
||||||
let typevar = TypeVarBuilder::new("test", "scalar bools")
|
let type_set = TypeSetBuilder::new().bools(Interval::All).finish();
|
||||||
.bools(Interval::All)
|
assert_eq!(type_set.lanes, num_set![1]);
|
||||||
.finish();
|
assert!(type_set.floats.is_empty());
|
||||||
assert_eq!(typevar.type_set.lanes, num_set![1]);
|
assert!(type_set.ints.is_empty());
|
||||||
assert!(typevar.type_set.floats.is_empty());
|
assert_eq!(type_set.bools, num_set![1, 8, 16, 32, 64]);
|
||||||
assert!(typevar.type_set.ints.is_empty());
|
assert!(type_set.bitvecs.is_empty());
|
||||||
assert_eq!(typevar.type_set.bools, num_set![1, 8, 16, 32, 64]);
|
assert!(type_set.specials.is_empty());
|
||||||
assert!(typevar.type_set.bitvecs.is_empty());
|
|
||||||
assert!(typevar.type_set.specials.is_empty());
|
|
||||||
|
|
||||||
let typevar = TypeVarBuilder::new("test", "scalar floats")
|
let type_set = TypeSetBuilder::new().floats(Interval::All).finish();
|
||||||
.floats(Interval::All)
|
assert_eq!(type_set.lanes, num_set![1]);
|
||||||
.finish();
|
assert_eq!(type_set.floats, num_set![32, 64]);
|
||||||
assert_eq!(typevar.type_set.lanes, num_set![1]);
|
assert!(type_set.ints.is_empty());
|
||||||
assert_eq!(typevar.type_set.floats, num_set![32, 64]);
|
assert!(type_set.bools.is_empty());
|
||||||
assert!(typevar.type_set.ints.is_empty());
|
assert!(type_set.bitvecs.is_empty());
|
||||||
assert!(typevar.type_set.bools.is_empty());
|
assert!(type_set.specials.is_empty());
|
||||||
assert!(typevar.type_set.bitvecs.is_empty());
|
|
||||||
assert!(typevar.type_set.specials.is_empty());
|
|
||||||
|
|
||||||
let typevar = TypeVarBuilder::new("test", "float vectors (but not scalars)")
|
let type_set = TypeSetBuilder::new()
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.includes_scalars(false)
|
.includes_scalars(false)
|
||||||
.finish();
|
.finish();
|
||||||
assert_eq!(
|
assert_eq!(type_set.lanes, num_set![2, 4, 8, 16, 32, 64, 128, 256]);
|
||||||
typevar.type_set.lanes,
|
assert_eq!(type_set.floats, num_set![32, 64]);
|
||||||
num_set![2, 4, 8, 16, 32, 64, 128, 256]
|
assert!(type_set.ints.is_empty());
|
||||||
);
|
assert!(type_set.bools.is_empty());
|
||||||
assert_eq!(typevar.type_set.floats, num_set![32, 64]);
|
assert!(type_set.bitvecs.is_empty());
|
||||||
assert!(typevar.type_set.ints.is_empty());
|
assert!(type_set.specials.is_empty());
|
||||||
assert!(typevar.type_set.bools.is_empty());
|
|
||||||
assert!(typevar.type_set.bitvecs.is_empty());
|
|
||||||
assert!(typevar.type_set.specials.is_empty());
|
|
||||||
|
|
||||||
let typevar = TypeVarBuilder::new("test", "float vectors and scalars")
|
let type_set = TypeSetBuilder::new()
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.includes_scalars(true)
|
.includes_scalars(true)
|
||||||
.finish();
|
.finish();
|
||||||
assert_eq!(
|
assert_eq!(type_set.lanes, num_set![1, 2, 4, 8, 16, 32, 64, 128, 256]);
|
||||||
typevar.type_set.lanes,
|
assert_eq!(type_set.floats, num_set![32, 64]);
|
||||||
num_set![1, 2, 4, 8, 16, 32, 64, 128, 256]
|
assert!(type_set.ints.is_empty());
|
||||||
);
|
assert!(type_set.bools.is_empty());
|
||||||
assert_eq!(typevar.type_set.floats, num_set![32, 64]);
|
assert!(type_set.bitvecs.is_empty());
|
||||||
assert!(typevar.type_set.ints.is_empty());
|
assert!(type_set.specials.is_empty());
|
||||||
assert!(typevar.type_set.bools.is_empty());
|
|
||||||
assert!(typevar.type_set.bitvecs.is_empty());
|
|
||||||
assert!(typevar.type_set.specials.is_empty());
|
|
||||||
|
|
||||||
let typevar = TypeVarBuilder::new("test", "range of ints")
|
let type_set = TypeSetBuilder::new().ints(16..64).finish();
|
||||||
.ints(16..64)
|
assert_eq!(type_set.lanes, num_set![1]);
|
||||||
.finish();
|
assert_eq!(type_set.ints, num_set![16, 32, 64]);
|
||||||
assert_eq!(typevar.type_set.lanes, num_set![1]);
|
assert!(type_set.floats.is_empty());
|
||||||
assert_eq!(typevar.type_set.ints, num_set![16, 32, 64]);
|
assert!(type_set.bools.is_empty());
|
||||||
assert!(typevar.type_set.floats.is_empty());
|
assert!(type_set.bitvecs.is_empty());
|
||||||
assert!(typevar.type_set.bools.is_empty());
|
assert!(type_set.specials.is_empty());
|
||||||
assert!(typevar.type_set.bitvecs.is_empty());
|
|
||||||
assert!(typevar.type_set.specials.is_empty());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_typevar_builder_too_high_bound_panic() {
|
fn test_typevar_builder_too_high_bound_panic() {
|
||||||
TypeVarBuilder::new("test", "invalid range of ints")
|
TypeSetBuilder::new().ints(16..2 * MAX_BITS).finish();
|
||||||
.ints(16..2 * MAX_BITS)
|
|
||||||
.finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_typevar_builder_inverted_bounds_panic() {
|
fn test_typevar_builder_inverted_bounds_panic() {
|
||||||
TypeVarBuilder::new("test", "inverted bounds")
|
TypeSetBuilder::new().ints(32..16).finish();
|
||||||
.ints(32..16)
|
|
||||||
.finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -714,7 +696,7 @@ fn test_singleton() {
|
|||||||
|
|
||||||
// Test i32.
|
// Test i32.
|
||||||
let typevar =
|
let typevar =
|
||||||
TypeVarBuilder::singleton(ValueType::Lane(LaneType::IntType(shared_types::Int::I32)));
|
TypeVar::new_singleton(ValueType::Lane(LaneType::IntType(shared_types::Int::I32)));
|
||||||
assert_eq!(typevar.name, "i32");
|
assert_eq!(typevar.name, "i32");
|
||||||
assert_eq!(typevar.type_set.ints, num_set![32]);
|
assert_eq!(typevar.type_set.ints, num_set![32]);
|
||||||
assert!(typevar.type_set.floats.is_empty());
|
assert!(typevar.type_set.floats.is_empty());
|
||||||
@@ -724,7 +706,7 @@ fn test_singleton() {
|
|||||||
assert_eq!(typevar.type_set.lanes, num_set![1]);
|
assert_eq!(typevar.type_set.lanes, num_set![1]);
|
||||||
|
|
||||||
// Test f32x4.
|
// Test f32x4.
|
||||||
let typevar = TypeVarBuilder::singleton(ValueType::Vector(VectorType::new(
|
let typevar = TypeVar::new_singleton(ValueType::Vector(VectorType::new(
|
||||||
LaneType::FloatType(shared_types::Float::F32),
|
LaneType::FloatType(shared_types::Float::F32),
|
||||||
4,
|
4,
|
||||||
)));
|
)));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::cdsl::formats::FormatRegistry;
|
|||||||
use crate::cdsl::inst::{InstructionBuilder as Inst, InstructionGroup};
|
use crate::cdsl::inst::{InstructionBuilder as Inst, InstructionGroup};
|
||||||
use crate::cdsl::operands::{create_operand as operand, create_operand_doc as operand_doc};
|
use crate::cdsl::operands::{create_operand as operand, create_operand_doc as operand_doc};
|
||||||
use crate::cdsl::types::ValueType;
|
use crate::cdsl::types::ValueType;
|
||||||
use crate::cdsl::typevar::{Interval, TypeVar, TypeVarBuilder};
|
use crate::cdsl::typevar::{Interval, TypeSetBuilder, TypeVar};
|
||||||
use crate::shared::types;
|
use crate::shared::types;
|
||||||
|
|
||||||
pub fn define(format_registry: &FormatRegistry) -> InstructionGroup {
|
pub fn define(format_registry: &FormatRegistry) -> InstructionGroup {
|
||||||
@@ -12,9 +12,11 @@ pub fn define(format_registry: &FormatRegistry) -> InstructionGroup {
|
|||||||
|
|
||||||
let iflags: &TypeVar = &ValueType::Special(types::Flag::IFlags.into()).into();
|
let iflags: &TypeVar = &ValueType::Special(types::Flag::IFlags.into()).into();
|
||||||
|
|
||||||
let iWord = &TypeVarBuilder::new("iWord", "A scalar integer machine word")
|
let iWord = &TypeVar::new(
|
||||||
.ints(32..64)
|
"iWord",
|
||||||
.finish();
|
"A scalar integer machine word",
|
||||||
|
TypeSetBuilder::new().ints(32..64).finish(),
|
||||||
|
);
|
||||||
let nlo = &operand_doc("nlo", iWord, "Low part of numerator");
|
let nlo = &operand_doc("nlo", iWord, "Low part of numerator");
|
||||||
let nhi = &operand_doc("nhi", iWord, "High part of numerator");
|
let nhi = &operand_doc("nhi", iWord, "High part of numerator");
|
||||||
let d = &operand_doc("d", iWord, "Denominator");
|
let d = &operand_doc("d", iWord, "Denominator");
|
||||||
@@ -96,14 +98,22 @@ pub fn define(format_registry: &FormatRegistry) -> InstructionGroup {
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let Float = &TypeVarBuilder::new("Float", "A scalar or vector floating point number")
|
let Float = &TypeVar::new(
|
||||||
|
"Float",
|
||||||
|
"A scalar or vector floating point number",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
let IntTo = &TypeVarBuilder::new("IntTo", "An integer type with the same number of lanes")
|
);
|
||||||
|
let IntTo = &TypeVar::new(
|
||||||
|
"IntTo",
|
||||||
|
"An integer type with the same number of lanes",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(32..64)
|
.ints(32..64)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", Float);
|
let x = &operand("x", Float);
|
||||||
let a = &operand("a", IntTo);
|
let a = &operand("a", IntTo);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use crate::cdsl::inst::{InstructionBuilder as Inst, InstructionGroup};
|
|||||||
use crate::cdsl::operands::{create_operand as operand, create_operand_doc as operand_doc};
|
use crate::cdsl::operands::{create_operand as operand, create_operand_doc as operand_doc};
|
||||||
use crate::cdsl::type_inference::Constraint::WiderOrEq;
|
use crate::cdsl::type_inference::Constraint::WiderOrEq;
|
||||||
use crate::cdsl::types::{LaneType, ValueType};
|
use crate::cdsl::types::{LaneType, ValueType};
|
||||||
use crate::cdsl::typevar::{Interval, TypeVar, TypeVarBuilder};
|
use crate::cdsl::typevar::{Interval, TypeSetBuilder, TypeVar};
|
||||||
use crate::shared::{types, OperandKinds};
|
use crate::shared::{types, OperandKinds};
|
||||||
|
|
||||||
pub fn define(
|
pub fn define(
|
||||||
@@ -47,59 +47,88 @@ pub fn define(
|
|||||||
let f64_: &TypeVar = &ValueType::from(LaneType::from(types::Float::F64)).into();
|
let f64_: &TypeVar = &ValueType::from(LaneType::from(types::Float::F64)).into();
|
||||||
|
|
||||||
// Starting definitions.
|
// Starting definitions.
|
||||||
let Int = &TypeVarBuilder::new("Int", "A scalar or vector integer type")
|
let Int = &TypeVar::new(
|
||||||
|
"Int",
|
||||||
|
"A scalar or vector integer type",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let Bool = &TypeVarBuilder::new("Bool", "A scalar or vector boolean type")
|
let Bool = &TypeVar::new(
|
||||||
|
"Bool",
|
||||||
|
"A scalar or vector boolean type",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let iB = &TypeVarBuilder::new("iB", "A scalar integer type")
|
let iB = &TypeVar::new(
|
||||||
.ints(Interval::All)
|
"iB",
|
||||||
.finish();
|
"A scalar integer type",
|
||||||
|
TypeSetBuilder::new().ints(Interval::All).finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let iAddr = &TypeVarBuilder::new("iAddr", "An integer address type")
|
let iAddr = &TypeVar::new(
|
||||||
.ints(32..64)
|
"iAddr",
|
||||||
.finish();
|
"An integer address type",
|
||||||
|
TypeSetBuilder::new().ints(32..64).finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let Testable = &TypeVarBuilder::new("Testable", "A scalar boolean or integer type")
|
let Testable = &TypeVar::new(
|
||||||
|
"Testable",
|
||||||
|
"A scalar boolean or integer type",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let TxN = &TypeVarBuilder::new("TxN", "A SIMD vector type")
|
let TxN = &TypeVar::new(
|
||||||
|
"TxN",
|
||||||
|
"A SIMD vector type",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.includes_scalars(false)
|
.includes_scalars(false)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let Any = &TypeVarBuilder::new(
|
let Any = &TypeVar::new(
|
||||||
"Any",
|
"Any",
|
||||||
"Any integer, float, or boolean scalar or vector type",
|
"Any integer, float, or boolean scalar or vector type",
|
||||||
)
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.includes_scalars(true)
|
.includes_scalars(true)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let Mem = &TypeVarBuilder::new("Mem", "Any type that can be stored in memory")
|
let Mem = &TypeVar::new(
|
||||||
|
"Mem",
|
||||||
|
"Any type that can be stored in memory",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let MemTo = &TypeVarBuilder::new("MemTo", "Any type that can be stored in memory")
|
let MemTo = &TypeVar::new(
|
||||||
|
"MemTo",
|
||||||
|
"Any type that can be stored in memory",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let addr = &operand("addr", iAddr);
|
let addr = &operand("addr", iAddr);
|
||||||
let c = &operand_doc("c", Testable, "Controlling value to test");
|
let c = &operand_doc("c", Testable, "Controlling value to test");
|
||||||
@@ -233,9 +262,11 @@ pub fn define(
|
|||||||
|
|
||||||
let x = &operand_doc("x", iB, "index into jump table");
|
let x = &operand_doc("x", iB, "index into jump table");
|
||||||
|
|
||||||
let Entry = &TypeVarBuilder::new("Entry", "A scalar integer type")
|
let Entry = &TypeVar::new(
|
||||||
.ints(Interval::All)
|
"Entry",
|
||||||
.finish();
|
"A scalar integer type",
|
||||||
|
TypeSetBuilder::new().ints(Interval::All).finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let entry = &operand_doc("entry", Entry, "entry of jump table");
|
let entry = &operand_doc("entry", Entry, "entry of jump table");
|
||||||
let JT = &operand("JT", jump_table);
|
let JT = &operand("JT", jump_table);
|
||||||
@@ -578,9 +609,11 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let iExt8 = &TypeVarBuilder::new("iExt8", "An integer type with more than 8 bits")
|
let iExt8 = &TypeVar::new(
|
||||||
.ints(16..64)
|
"iExt8",
|
||||||
.finish();
|
"An integer type with more than 8 bits",
|
||||||
|
TypeSetBuilder::new().ints(16..64).finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", iExt8);
|
let x = &operand("x", iExt8);
|
||||||
let a = &operand("a", iExt8);
|
let a = &operand("a", iExt8);
|
||||||
|
|
||||||
@@ -672,9 +705,11 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let iExt16 = &TypeVarBuilder::new("iExt16", "An integer type with more than 16 bits")
|
let iExt16 = &TypeVar::new(
|
||||||
.ints(32..64)
|
"iExt16",
|
||||||
.finish();
|
"An integer type with more than 16 bits",
|
||||||
|
TypeSetBuilder::new().ints(32..64).finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", iExt16);
|
let x = &operand("x", iExt16);
|
||||||
let a = &operand("a", iExt16);
|
let a = &operand("a", iExt16);
|
||||||
|
|
||||||
@@ -766,9 +801,11 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let iExt32 = &TypeVarBuilder::new("iExt32", "An integer type with more than 32 bits")
|
let iExt32 = &TypeVar::new(
|
||||||
.ints(64..64)
|
"iExt32",
|
||||||
.finish();
|
"An integer type with more than 32 bits",
|
||||||
|
TypeSetBuilder::new().ints(64..64).finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", iExt32);
|
let x = &operand("x", iExt32);
|
||||||
let a = &operand("a", iExt32);
|
let a = &operand("a", iExt32);
|
||||||
|
|
||||||
@@ -945,9 +982,11 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let HeapOffset = &TypeVarBuilder::new("HeapOffset", "An unsigned heap offset")
|
let HeapOffset = &TypeVar::new(
|
||||||
.ints(32..64)
|
"HeapOffset",
|
||||||
.finish();
|
"An unsigned heap offset",
|
||||||
|
TypeSetBuilder::new().ints(32..64).finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let H = &operand("H", heap);
|
let H = &operand("H", heap);
|
||||||
let p = &operand("p", HeapOffset);
|
let p = &operand("p", HeapOffset);
|
||||||
@@ -973,9 +1012,11 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let TableOffset = &TypeVarBuilder::new("TableOffset", "An unsigned table offset")
|
let TableOffset = &TypeVar::new(
|
||||||
.ints(32..64)
|
"TableOffset",
|
||||||
.finish();
|
"An unsigned table offset",
|
||||||
|
TypeSetBuilder::new().ints(32..64).finish(),
|
||||||
|
);
|
||||||
let T = &operand("T", table);
|
let T = &operand("T", table);
|
||||||
let p = &operand("p", TableOffset);
|
let p = &operand("p", TableOffset);
|
||||||
let Offset = &operand_doc("Offset", offset32, "Byte offset from element address");
|
let Offset = &operand_doc("Offset", offset32, "Byte offset from element address");
|
||||||
@@ -1342,13 +1383,17 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let Any128 = &TypeVarBuilder::new("Any128", "Any scalar or vector type with as most 128 lanes")
|
let Any128 = &TypeVar::new(
|
||||||
|
"Any128",
|
||||||
|
"Any scalar or vector type with as most 128 lanes",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(1..128)
|
.simd_lanes(1..128)
|
||||||
.includes_scalars(true)
|
.includes_scalars(true)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let x = &operand_doc("x", Any128, "Low-numbered lanes");
|
let x = &operand_doc("x", Any128, "Low-numbered lanes");
|
||||||
let y = &operand_doc("y", Any128, "High-numbered lanes");
|
let y = &operand_doc("y", Any128, "High-numbered lanes");
|
||||||
@@ -1935,16 +1980,17 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let bits = &TypeVarBuilder::new(
|
let bits = &TypeVar::new(
|
||||||
"bits",
|
"bits",
|
||||||
"Any integer, float, or boolean scalar or vector type",
|
"Any integer, float, or boolean scalar or vector type",
|
||||||
)
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.includes_scalars(true)
|
.includes_scalars(true)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", bits);
|
let x = &operand("x", bits);
|
||||||
let y = &operand("y", bits);
|
let y = &operand("y", bits);
|
||||||
let a = &operand("a", bits);
|
let a = &operand("a", bits);
|
||||||
@@ -2331,10 +2377,14 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let Float = &TypeVarBuilder::new("Float", "A scalar or vector floating point number")
|
let Float = &TypeVar::new(
|
||||||
|
"Float",
|
||||||
|
"A scalar or vector floating point number",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let Cond = &operand("Cond", floatcc);
|
let Cond = &operand("Cond", floatcc);
|
||||||
let x = &operand("x", Float);
|
let x = &operand("x", Float);
|
||||||
let y = &operand("y", Float);
|
let y = &operand("y", Float);
|
||||||
@@ -2703,18 +2753,23 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let Bool = &TypeVarBuilder::new("Bool", "A scalar or vector boolean type")
|
let Bool = &TypeVar::new(
|
||||||
|
"Bool",
|
||||||
|
"A scalar or vector boolean type",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let BoolTo = &TypeVarBuilder::new(
|
let BoolTo = &TypeVar::new(
|
||||||
"BoolTo",
|
"BoolTo",
|
||||||
"A smaller boolean type with the same number of lanes",
|
"A smaller boolean type with the same number of lanes",
|
||||||
)
|
TypeSetBuilder::new()
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let x = &operand("x", Bool);
|
let x = &operand("x", Bool);
|
||||||
let a = &operand("a", BoolTo);
|
let a = &operand("a", BoolTo);
|
||||||
@@ -2736,13 +2791,14 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let BoolTo = &TypeVarBuilder::new(
|
let BoolTo = &TypeVar::new(
|
||||||
"BoolTo",
|
"BoolTo",
|
||||||
"A larger boolean type with the same number of lanes",
|
"A larger boolean type with the same number of lanes",
|
||||||
)
|
TypeSetBuilder::new()
|
||||||
.bools(Interval::All)
|
.bools(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", Bool);
|
let x = &operand("x", Bool);
|
||||||
let a = &operand("a", BoolTo);
|
let a = &operand("a", BoolTo);
|
||||||
|
|
||||||
@@ -2763,10 +2819,14 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let IntTo = &TypeVarBuilder::new("IntTo", "An integer type with the same number of lanes")
|
let IntTo = &TypeVar::new(
|
||||||
|
"IntTo",
|
||||||
|
"An integer type with the same number of lanes",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", Bool);
|
let x = &operand("x", Bool);
|
||||||
let a = &operand("a", IntTo);
|
let a = &operand("a", IntTo);
|
||||||
|
|
||||||
@@ -2800,18 +2860,23 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let Int = &TypeVarBuilder::new("Int", "A scalar or vector integer type")
|
let Int = &TypeVar::new(
|
||||||
|
"Int",
|
||||||
|
"A scalar or vector integer type",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let IntTo = &TypeVarBuilder::new(
|
let IntTo = &TypeVar::new(
|
||||||
"IntTo",
|
"IntTo",
|
||||||
"A smaller integer type with the same number of lanes",
|
"A smaller integer type with the same number of lanes",
|
||||||
)
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", Int);
|
let x = &operand("x", Int);
|
||||||
let a = &operand("a", IntTo);
|
let a = &operand("a", IntTo);
|
||||||
|
|
||||||
@@ -2836,13 +2901,14 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let IntTo = &TypeVarBuilder::new(
|
let IntTo = &TypeVar::new(
|
||||||
"IntTo",
|
"IntTo",
|
||||||
"A larger integer type with the same number of lanes",
|
"A larger integer type with the same number of lanes",
|
||||||
)
|
TypeSetBuilder::new()
|
||||||
.ints(Interval::All)
|
.ints(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", Int);
|
let x = &operand("x", Int);
|
||||||
let a = &operand("a", IntTo);
|
let a = &operand("a", IntTo);
|
||||||
|
|
||||||
@@ -2888,10 +2954,14 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let FloatTo = &TypeVarBuilder::new("FloatTo", "A scalar or vector floating point number")
|
let FloatTo = &TypeVar::new(
|
||||||
|
"FloatTo",
|
||||||
|
"A scalar or vector floating point number",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.floats(Interval::All)
|
.floats(Interval::All)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", Float);
|
let x = &operand("x", Float);
|
||||||
let a = &operand("a", FloatTo);
|
let a = &operand("a", FloatTo);
|
||||||
|
|
||||||
@@ -3046,10 +3116,14 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let WideInt = &TypeVarBuilder::new("WideInt", "An integer type with lanes from `i16` upwards")
|
let WideInt = &TypeVar::new(
|
||||||
|
"WideInt",
|
||||||
|
"An integer type with lanes from `i16` upwards",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(16..64)
|
.ints(16..64)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
let x = &operand("x", WideInt);
|
let x = &operand("x", WideInt);
|
||||||
let lo = &operand_doc("lo", &WideInt.half_width(), "The low bits of `x`");
|
let lo = &operand_doc("lo", &WideInt.half_width(), "The low bits of `x`");
|
||||||
let hi = &operand_doc("hi", &WideInt.half_width(), "The high bits of `x`");
|
let hi = &operand_doc("hi", &WideInt.half_width(), "The high bits of `x`");
|
||||||
@@ -3073,10 +3147,14 @@ pub fn define(
|
|||||||
.finish(format_registry),
|
.finish(format_registry),
|
||||||
);
|
);
|
||||||
|
|
||||||
let NarrowInt = &TypeVarBuilder::new("NarrowInt", "An integer type with lanes type to `i32`")
|
let NarrowInt = &TypeVar::new(
|
||||||
|
"NarrowInt",
|
||||||
|
"An integer type with lanes type to `i32`",
|
||||||
|
TypeSetBuilder::new()
|
||||||
.ints(8..32)
|
.ints(8..32)
|
||||||
.simd_lanes(Interval::All)
|
.simd_lanes(Interval::All)
|
||||||
.finish();
|
.finish(),
|
||||||
|
);
|
||||||
|
|
||||||
let lo = &operand("lo", NarrowInt);
|
let lo = &operand("lo", NarrowInt);
|
||||||
let hi = &operand("hi", NarrowInt);
|
let hi = &operand("hi", NarrowInt);
|
||||||
|
|||||||
Reference in New Issue
Block a user