diff --git a/cranelift/codegen/src/ir/instructions.rs b/cranelift/codegen/src/ir/instructions.rs index 8278888d7e..a94b0f3a60 100644 --- a/cranelift/codegen/src/ir/instructions.rs +++ b/cranelift/codegen/src/ir/instructions.rs @@ -498,7 +498,7 @@ enum OperandConstraint { /// This operand is the same type as the controlling type variable. Same, - /// This operand is `ctrlType.lane_type()`. + /// This operand is `ctrlType.lane_of()`. LaneOf, /// This operand is `ctrlType.as_bool()`. @@ -527,7 +527,7 @@ impl OperandConstraint { Concrete(t) => Bound(t), Free(vts) => ResolvedConstraint::Free(TYPE_SETS[vts as usize]), Same => Bound(ctrl_type), - LaneOf => Bound(ctrl_type.lane_type()), + LaneOf => Bound(ctrl_type.lane_of()), AsBool => Bound(ctrl_type.as_bool()), HalfWidth => Bound(ctrl_type.half_width().expect("invalid type for half_width")), DoubleWidth => Bound( diff --git a/cranelift/codegen/src/ir/types.rs b/cranelift/codegen/src/ir/types.rs index 20bed0c4ce..9da5b971b5 100644 --- a/cranelift/codegen/src/ir/types.rs +++ b/cranelift/codegen/src/ir/types.rs @@ -44,10 +44,17 @@ impl Type { if self.0 < VECTOR_BASE { self } else { - Type(LANE_BASE | (self.0 & 0x0f)) + Self(LANE_BASE | (self.0 & 0x0f)) } } + /// The type transformation that returns the lane type of a type variable; it is just a + /// renaming of lane_type() to be used in context where we think in terms of type variable + /// transformations. + pub fn lane_of(self) -> Self { + self.lane_type() + } + /// Get log_2 of the number of bits in a lane. pub fn log2_lane_bits(self) -> u8 { match self.lane_type() {