diff --git a/cranelift/codegen/meta/src/cdsl/typevar.rs b/cranelift/codegen/meta/src/cdsl/typevar.rs index 5e722f0063..fb5064f912 100644 --- a/cranelift/codegen/meta/src/cdsl/typevar.rs +++ b/cranelift/codegen/meta/src/cdsl/typevar.rs @@ -36,6 +36,54 @@ pub struct TypeVar { } impl TypeVar { + pub fn new(name: impl Into, doc: impl Into, 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 { match &self.content.base { Some(base) => Rc::new(base.type_var.get_typeset().image(base.derived_func)), @@ -162,7 +210,7 @@ impl Into for &TypeVar { } impl Into for ValueType { 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, +} + +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) -> Self { + assert!(self.ints == Interval::None); + self.ints = interval.into(); + self + } + pub fn floats(mut self, interval: impl Into) -> Self { + assert!(self.floats == Interval::None); + self.floats = interval.into(); + self + } + pub fn bools(mut self, interval: impl Into) -> 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) -> Self { + assert!(self.simd_lanes == Interval::None); + self.simd_lanes = interval.into(); + self + } + pub fn bitvecs(mut self, interval: impl Into) -> Self { + assert!(self.bitvecs == Interval::None); + self.bitvecs = interval.into(); + self + } + pub fn specials(mut self, specials: Vec) -> 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)] pub enum Interval { None, @@ -468,131 +593,6 @@ impl Into 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, -} - -impl TypeVarBuilder { - pub fn new(name: impl Into, doc: impl Into) -> 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) -> Self { - assert!(self.ints == Interval::None); - self.ints = interval.into(); - self - } - pub fn floats(mut self, interval: impl Into) -> Self { - assert!(self.floats == Interval::None); - self.floats = interval.into(); - self - } - pub fn bools(mut self, interval: impl Into) -> 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) -> Self { - assert!(self.simd_lanes == Interval::None); - self.simd_lanes = interval.into(); - self - } - pub fn bitvecs(mut self, interval: impl Into) -> Self { - assert!(self.bitvecs == Interval::None); - self.bitvecs = interval.into(); - self - } - pub fn specials(mut self, specials: Vec) -> 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 { // Only allow legal bit widths for bool types. *bits == 1 || (*bits >= 8 && *bits <= MAX_BITS && bits.is_power_of_two()) @@ -620,91 +620,73 @@ fn range_to_set(range: Option) -> NumSet { #[test] fn test_typevar_builder() { - let typevar = TypeVarBuilder::new("test", "scalar integers") - .ints(Interval::All) - .finish(); - assert_eq!(typevar.type_set.lanes, num_set![1]); - assert!(typevar.type_set.floats.is_empty()); - assert_eq!(typevar.type_set.ints, num_set![8, 16, 32, 64]); - assert!(typevar.type_set.bools.is_empty()); - assert!(typevar.type_set.bitvecs.is_empty()); - assert!(typevar.type_set.specials.is_empty()); + let type_set = TypeSetBuilder::new().ints(Interval::All).finish(); + assert_eq!(type_set.lanes, num_set![1]); + assert!(type_set.floats.is_empty()); + assert_eq!(type_set.ints, num_set![8, 16, 32, 64]); + assert!(type_set.bools.is_empty()); + assert!(type_set.bitvecs.is_empty()); + assert!(type_set.specials.is_empty()); - let typevar = TypeVarBuilder::new("test", "scalar bools") - .bools(Interval::All) - .finish(); - assert_eq!(typevar.type_set.lanes, num_set![1]); - assert!(typevar.type_set.floats.is_empty()); - assert!(typevar.type_set.ints.is_empty()); - assert_eq!(typevar.type_set.bools, num_set![1, 8, 16, 32, 64]); - assert!(typevar.type_set.bitvecs.is_empty()); - assert!(typevar.type_set.specials.is_empty()); + let type_set = TypeSetBuilder::new().bools(Interval::All).finish(); + assert_eq!(type_set.lanes, num_set![1]); + assert!(type_set.floats.is_empty()); + assert!(type_set.ints.is_empty()); + assert_eq!(type_set.bools, num_set![1, 8, 16, 32, 64]); + assert!(type_set.bitvecs.is_empty()); + assert!(type_set.specials.is_empty()); - let typevar = TypeVarBuilder::new("test", "scalar floats") - .floats(Interval::All) - .finish(); - assert_eq!(typevar.type_set.lanes, num_set![1]); - assert_eq!(typevar.type_set.floats, num_set![32, 64]); - assert!(typevar.type_set.ints.is_empty()); - assert!(typevar.type_set.bools.is_empty()); - assert!(typevar.type_set.bitvecs.is_empty()); - assert!(typevar.type_set.specials.is_empty()); + let type_set = TypeSetBuilder::new().floats(Interval::All).finish(); + assert_eq!(type_set.lanes, num_set![1]); + assert_eq!(type_set.floats, num_set![32, 64]); + assert!(type_set.ints.is_empty()); + assert!(type_set.bools.is_empty()); + assert!(type_set.bitvecs.is_empty()); + assert!(type_set.specials.is_empty()); - let typevar = TypeVarBuilder::new("test", "float vectors (but not scalars)") + let type_set = TypeSetBuilder::new() .floats(Interval::All) .simd_lanes(Interval::All) .includes_scalars(false) .finish(); - assert_eq!( - typevar.type_set.lanes, - num_set![2, 4, 8, 16, 32, 64, 128, 256] - ); - assert_eq!(typevar.type_set.floats, num_set![32, 64]); - assert!(typevar.type_set.ints.is_empty()); - assert!(typevar.type_set.bools.is_empty()); - assert!(typevar.type_set.bitvecs.is_empty()); - assert!(typevar.type_set.specials.is_empty()); + assert_eq!(type_set.lanes, num_set![2, 4, 8, 16, 32, 64, 128, 256]); + assert_eq!(type_set.floats, num_set![32, 64]); + assert!(type_set.ints.is_empty()); + assert!(type_set.bools.is_empty()); + assert!(type_set.bitvecs.is_empty()); + assert!(type_set.specials.is_empty()); - let typevar = TypeVarBuilder::new("test", "float vectors and scalars") + let type_set = TypeSetBuilder::new() .floats(Interval::All) .simd_lanes(Interval::All) .includes_scalars(true) .finish(); - assert_eq!( - typevar.type_set.lanes, - num_set![1, 2, 4, 8, 16, 32, 64, 128, 256] - ); - assert_eq!(typevar.type_set.floats, num_set![32, 64]); - assert!(typevar.type_set.ints.is_empty()); - assert!(typevar.type_set.bools.is_empty()); - assert!(typevar.type_set.bitvecs.is_empty()); - assert!(typevar.type_set.specials.is_empty()); + assert_eq!(type_set.lanes, num_set![1, 2, 4, 8, 16, 32, 64, 128, 256]); + assert_eq!(type_set.floats, num_set![32, 64]); + assert!(type_set.ints.is_empty()); + assert!(type_set.bools.is_empty()); + assert!(type_set.bitvecs.is_empty()); + assert!(type_set.specials.is_empty()); - let typevar = TypeVarBuilder::new("test", "range of ints") - .ints(16..64) - .finish(); - assert_eq!(typevar.type_set.lanes, num_set![1]); - assert_eq!(typevar.type_set.ints, num_set![16, 32, 64]); - assert!(typevar.type_set.floats.is_empty()); - assert!(typevar.type_set.bools.is_empty()); - assert!(typevar.type_set.bitvecs.is_empty()); - assert!(typevar.type_set.specials.is_empty()); + let type_set = TypeSetBuilder::new().ints(16..64).finish(); + assert_eq!(type_set.lanes, num_set![1]); + assert_eq!(type_set.ints, num_set![16, 32, 64]); + assert!(type_set.floats.is_empty()); + assert!(type_set.bools.is_empty()); + assert!(type_set.bitvecs.is_empty()); + assert!(type_set.specials.is_empty()); } #[test] #[should_panic] fn test_typevar_builder_too_high_bound_panic() { - TypeVarBuilder::new("test", "invalid range of ints") - .ints(16..2 * MAX_BITS) - .finish(); + TypeSetBuilder::new().ints(16..2 * MAX_BITS).finish(); } #[test] #[should_panic] fn test_typevar_builder_inverted_bounds_panic() { - TypeVarBuilder::new("test", "inverted bounds") - .ints(32..16) - .finish(); + TypeSetBuilder::new().ints(32..16).finish(); } #[test] @@ -714,7 +696,7 @@ fn test_singleton() { // Test i32. 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.type_set.ints, num_set![32]); assert!(typevar.type_set.floats.is_empty()); @@ -724,7 +706,7 @@ fn test_singleton() { assert_eq!(typevar.type_set.lanes, num_set![1]); // 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), 4, ))); diff --git a/cranelift/codegen/meta/src/isa/x86/instructions.rs b/cranelift/codegen/meta/src/isa/x86/instructions.rs index 68c3b56b85..077860cc46 100644 --- a/cranelift/codegen/meta/src/isa/x86/instructions.rs +++ b/cranelift/codegen/meta/src/isa/x86/instructions.rs @@ -4,7 +4,7 @@ use crate::cdsl::formats::FormatRegistry; 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::types::ValueType; -use crate::cdsl::typevar::{Interval, TypeVar, TypeVarBuilder}; +use crate::cdsl::typevar::{Interval, TypeSetBuilder, TypeVar}; use crate::shared::types; 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 iWord = &TypeVarBuilder::new("iWord", "A scalar integer machine word") - .ints(32..64) - .finish(); + let iWord = &TypeVar::new( + "iWord", + "A scalar integer machine word", + TypeSetBuilder::new().ints(32..64).finish(), + ); let nlo = &operand_doc("nlo", iWord, "Low part of numerator"); let nhi = &operand_doc("nhi", iWord, "High part of numerator"); let d = &operand_doc("d", iWord, "Denominator"); @@ -96,14 +98,22 @@ pub fn define(format_registry: &FormatRegistry) -> InstructionGroup { .finish(format_registry), ); - let Float = &TypeVarBuilder::new("Float", "A scalar or vector floating point number") - .floats(Interval::All) - .simd_lanes(Interval::All) - .finish(); - let IntTo = &TypeVarBuilder::new("IntTo", "An integer type with the same number of lanes") - .ints(32..64) - .simd_lanes(Interval::All) - .finish(); + let Float = &TypeVar::new( + "Float", + "A scalar or vector floating point number", + TypeSetBuilder::new() + .floats(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); + let IntTo = &TypeVar::new( + "IntTo", + "An integer type with the same number of lanes", + TypeSetBuilder::new() + .ints(32..64) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", Float); let a = &operand("a", IntTo); diff --git a/cranelift/codegen/meta/src/shared/instructions.rs b/cranelift/codegen/meta/src/shared/instructions.rs index a83515ee04..b0c89b510e 100644 --- a/cranelift/codegen/meta/src/shared/instructions.rs +++ b/cranelift/codegen/meta/src/shared/instructions.rs @@ -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::type_inference::Constraint::WiderOrEq; 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}; pub fn define( @@ -47,59 +47,88 @@ pub fn define( let f64_: &TypeVar = &ValueType::from(LaneType::from(types::Float::F64)).into(); // Starting definitions. - let Int = &TypeVarBuilder::new("Int", "A scalar or vector integer type") - .ints(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let Int = &TypeVar::new( + "Int", + "A scalar or vector integer type", + TypeSetBuilder::new() + .ints(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); - let Bool = &TypeVarBuilder::new("Bool", "A scalar or vector boolean type") - .bools(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let Bool = &TypeVar::new( + "Bool", + "A scalar or vector boolean type", + TypeSetBuilder::new() + .bools(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); - let iB = &TypeVarBuilder::new("iB", "A scalar integer type") - .ints(Interval::All) - .finish(); + let iB = &TypeVar::new( + "iB", + "A scalar integer type", + TypeSetBuilder::new().ints(Interval::All).finish(), + ); - let iAddr = &TypeVarBuilder::new("iAddr", "An integer address type") - .ints(32..64) - .finish(); + let iAddr = &TypeVar::new( + "iAddr", + "An integer address type", + TypeSetBuilder::new().ints(32..64).finish(), + ); - let Testable = &TypeVarBuilder::new("Testable", "A scalar boolean or integer type") - .ints(Interval::All) - .bools(Interval::All) - .finish(); + let Testable = &TypeVar::new( + "Testable", + "A scalar boolean or integer type", + TypeSetBuilder::new() + .ints(Interval::All) + .bools(Interval::All) + .finish(), + ); - let TxN = &TypeVarBuilder::new("TxN", "A SIMD vector type") - .ints(Interval::All) - .floats(Interval::All) - .bools(Interval::All) - .simd_lanes(Interval::All) - .includes_scalars(false) - .finish(); + let TxN = &TypeVar::new( + "TxN", + "A SIMD vector type", + TypeSetBuilder::new() + .ints(Interval::All) + .floats(Interval::All) + .bools(Interval::All) + .simd_lanes(Interval::All) + .includes_scalars(false) + .finish(), + ); - let Any = &TypeVarBuilder::new( + let Any = &TypeVar::new( "Any", "Any integer, float, or boolean scalar or vector type", - ) - .ints(Interval::All) - .floats(Interval::All) - .bools(Interval::All) - .simd_lanes(Interval::All) - .includes_scalars(true) - .finish(); + TypeSetBuilder::new() + .ints(Interval::All) + .floats(Interval::All) + .bools(Interval::All) + .simd_lanes(Interval::All) + .includes_scalars(true) + .finish(), + ); - let Mem = &TypeVarBuilder::new("Mem", "Any type that can be stored in memory") - .ints(Interval::All) - .floats(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let Mem = &TypeVar::new( + "Mem", + "Any type that can be stored in memory", + TypeSetBuilder::new() + .ints(Interval::All) + .floats(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); - let MemTo = &TypeVarBuilder::new("MemTo", "Any type that can be stored in memory") - .ints(Interval::All) - .floats(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let MemTo = &TypeVar::new( + "MemTo", + "Any type that can be stored in memory", + TypeSetBuilder::new() + .ints(Interval::All) + .floats(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let addr = &operand("addr", iAddr); 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 Entry = &TypeVarBuilder::new("Entry", "A scalar integer type") - .ints(Interval::All) - .finish(); + let Entry = &TypeVar::new( + "Entry", + "A scalar integer type", + TypeSetBuilder::new().ints(Interval::All).finish(), + ); let entry = &operand_doc("entry", Entry, "entry of jump table"); let JT = &operand("JT", jump_table); @@ -578,9 +609,11 @@ pub fn define( .finish(format_registry), ); - let iExt8 = &TypeVarBuilder::new("iExt8", "An integer type with more than 8 bits") - .ints(16..64) - .finish(); + let iExt8 = &TypeVar::new( + "iExt8", + "An integer type with more than 8 bits", + TypeSetBuilder::new().ints(16..64).finish(), + ); let x = &operand("x", iExt8); let a = &operand("a", iExt8); @@ -672,9 +705,11 @@ pub fn define( .finish(format_registry), ); - let iExt16 = &TypeVarBuilder::new("iExt16", "An integer type with more than 16 bits") - .ints(32..64) - .finish(); + let iExt16 = &TypeVar::new( + "iExt16", + "An integer type with more than 16 bits", + TypeSetBuilder::new().ints(32..64).finish(), + ); let x = &operand("x", iExt16); let a = &operand("a", iExt16); @@ -766,9 +801,11 @@ pub fn define( .finish(format_registry), ); - let iExt32 = &TypeVarBuilder::new("iExt32", "An integer type with more than 32 bits") - .ints(64..64) - .finish(); + let iExt32 = &TypeVar::new( + "iExt32", + "An integer type with more than 32 bits", + TypeSetBuilder::new().ints(64..64).finish(), + ); let x = &operand("x", iExt32); let a = &operand("a", iExt32); @@ -945,9 +982,11 @@ pub fn define( .finish(format_registry), ); - let HeapOffset = &TypeVarBuilder::new("HeapOffset", "An unsigned heap offset") - .ints(32..64) - .finish(); + let HeapOffset = &TypeVar::new( + "HeapOffset", + "An unsigned heap offset", + TypeSetBuilder::new().ints(32..64).finish(), + ); let H = &operand("H", heap); let p = &operand("p", HeapOffset); @@ -973,9 +1012,11 @@ pub fn define( .finish(format_registry), ); - let TableOffset = &TypeVarBuilder::new("TableOffset", "An unsigned table offset") - .ints(32..64) - .finish(); + let TableOffset = &TypeVar::new( + "TableOffset", + "An unsigned table offset", + TypeSetBuilder::new().ints(32..64).finish(), + ); let T = &operand("T", table); let p = &operand("p", TableOffset); let Offset = &operand_doc("Offset", offset32, "Byte offset from element address"); @@ -1342,13 +1383,17 @@ pub fn define( .finish(format_registry), ); - let Any128 = &TypeVarBuilder::new("Any128", "Any scalar or vector type with as most 128 lanes") - .ints(Interval::All) - .floats(Interval::All) - .bools(Interval::All) - .simd_lanes(1..128) - .includes_scalars(true) - .finish(); + let Any128 = &TypeVar::new( + "Any128", + "Any scalar or vector type with as most 128 lanes", + TypeSetBuilder::new() + .ints(Interval::All) + .floats(Interval::All) + .bools(Interval::All) + .simd_lanes(1..128) + .includes_scalars(true) + .finish(), + ); let x = &operand_doc("x", Any128, "Low-numbered lanes"); let y = &operand_doc("y", Any128, "High-numbered lanes"); @@ -1935,16 +1980,17 @@ pub fn define( .finish(format_registry), ); - let bits = &TypeVarBuilder::new( + let bits = &TypeVar::new( "bits", "Any integer, float, or boolean scalar or vector type", - ) - .ints(Interval::All) - .floats(Interval::All) - .bools(Interval::All) - .simd_lanes(Interval::All) - .includes_scalars(true) - .finish(); + TypeSetBuilder::new() + .ints(Interval::All) + .floats(Interval::All) + .bools(Interval::All) + .simd_lanes(Interval::All) + .includes_scalars(true) + .finish(), + ); let x = &operand("x", bits); let y = &operand("y", bits); let a = &operand("a", bits); @@ -2331,10 +2377,14 @@ pub fn define( .finish(format_registry), ); - let Float = &TypeVarBuilder::new("Float", "A scalar or vector floating point number") - .floats(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let Float = &TypeVar::new( + "Float", + "A scalar or vector floating point number", + TypeSetBuilder::new() + .floats(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let Cond = &operand("Cond", floatcc); let x = &operand("x", Float); let y = &operand("y", Float); @@ -2703,18 +2753,23 @@ pub fn define( .finish(format_registry), ); - let Bool = &TypeVarBuilder::new("Bool", "A scalar or vector boolean type") - .bools(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let Bool = &TypeVar::new( + "Bool", + "A scalar or vector boolean type", + TypeSetBuilder::new() + .bools(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); - let BoolTo = &TypeVarBuilder::new( + let BoolTo = &TypeVar::new( "BoolTo", "A smaller boolean type with the same number of lanes", - ) - .bools(Interval::All) - .simd_lanes(Interval::All) - .finish(); + TypeSetBuilder::new() + .bools(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", Bool); let a = &operand("a", BoolTo); @@ -2736,13 +2791,14 @@ pub fn define( .finish(format_registry), ); - let BoolTo = &TypeVarBuilder::new( + let BoolTo = &TypeVar::new( "BoolTo", "A larger boolean type with the same number of lanes", - ) - .bools(Interval::All) - .simd_lanes(Interval::All) - .finish(); + TypeSetBuilder::new() + .bools(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", Bool); let a = &operand("a", BoolTo); @@ -2763,10 +2819,14 @@ pub fn define( .finish(format_registry), ); - let IntTo = &TypeVarBuilder::new("IntTo", "An integer type with the same number of lanes") - .ints(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let IntTo = &TypeVar::new( + "IntTo", + "An integer type with the same number of lanes", + TypeSetBuilder::new() + .ints(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", Bool); let a = &operand("a", IntTo); @@ -2800,18 +2860,23 @@ pub fn define( .finish(format_registry), ); - let Int = &TypeVarBuilder::new("Int", "A scalar or vector integer type") - .ints(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let Int = &TypeVar::new( + "Int", + "A scalar or vector integer type", + TypeSetBuilder::new() + .ints(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); - let IntTo = &TypeVarBuilder::new( + let IntTo = &TypeVar::new( "IntTo", "A smaller integer type with the same number of lanes", - ) - .ints(Interval::All) - .simd_lanes(Interval::All) - .finish(); + TypeSetBuilder::new() + .ints(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", Int); let a = &operand("a", IntTo); @@ -2836,13 +2901,14 @@ pub fn define( .finish(format_registry), ); - let IntTo = &TypeVarBuilder::new( + let IntTo = &TypeVar::new( "IntTo", "A larger integer type with the same number of lanes", - ) - .ints(Interval::All) - .simd_lanes(Interval::All) - .finish(); + TypeSetBuilder::new() + .ints(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", Int); let a = &operand("a", IntTo); @@ -2888,10 +2954,14 @@ pub fn define( .finish(format_registry), ); - let FloatTo = &TypeVarBuilder::new("FloatTo", "A scalar or vector floating point number") - .floats(Interval::All) - .simd_lanes(Interval::All) - .finish(); + let FloatTo = &TypeVar::new( + "FloatTo", + "A scalar or vector floating point number", + TypeSetBuilder::new() + .floats(Interval::All) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", Float); let a = &operand("a", FloatTo); @@ -3046,10 +3116,14 @@ pub fn define( .finish(format_registry), ); - let WideInt = &TypeVarBuilder::new("WideInt", "An integer type with lanes from `i16` upwards") - .ints(16..64) - .simd_lanes(Interval::All) - .finish(); + let WideInt = &TypeVar::new( + "WideInt", + "An integer type with lanes from `i16` upwards", + TypeSetBuilder::new() + .ints(16..64) + .simd_lanes(Interval::All) + .finish(), + ); let x = &operand("x", WideInt); 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`"); @@ -3073,10 +3147,14 @@ pub fn define( .finish(format_registry), ); - let NarrowInt = &TypeVarBuilder::new("NarrowInt", "An integer type with lanes type to `i32`") - .ints(8..32) - .simd_lanes(Interval::All) - .finish(); + let NarrowInt = &TypeVar::new( + "NarrowInt", + "An integer type with lanes type to `i32`", + TypeSetBuilder::new() + .ints(8..32) + .simd_lanes(Interval::All) + .finish(), + ); let lo = &operand("lo", NarrowInt); let hi = &operand("hi", NarrowInt);