Add vsplit and vconcat instructions.
Add support for two new type variable functions: half_vector() and double_vector(). Use these two instructions to break down unsupported SIMD types and build them up again.
This commit is contained in:
@@ -708,6 +708,12 @@ enum OperandConstraint {
|
||||
|
||||
/// This operand is `ctrlType.double_width()`.
|
||||
DoubleWidth,
|
||||
|
||||
/// This operand is `ctrlType.half_vector()`.
|
||||
HalfVector,
|
||||
|
||||
/// This operand is `ctrlType.double_vector()`.
|
||||
DoubleVector,
|
||||
}
|
||||
|
||||
impl OperandConstraint {
|
||||
@@ -725,6 +731,8 @@ impl OperandConstraint {
|
||||
AsBool => Some(ctrl_type.as_bool()),
|
||||
HalfWidth => Some(ctrl_type.half_width().expect("invalid type for half_width")),
|
||||
DoubleWidth => Some(ctrl_type.double_width().expect("invalid type for double_width")),
|
||||
HalfVector => Some(ctrl_type.half_vector().expect("invalid type for half_vector")),
|
||||
DoubleVector => Some(ctrl_type.by(2).expect("invalid type for double_vector")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,6 +217,8 @@ impl Type {
|
||||
}
|
||||
|
||||
/// Get a SIMD vector with half the number of lanes.
|
||||
///
|
||||
/// There is no `double_vector()` method. Use `t.by(2)` instead.
|
||||
pub fn half_vector(self) -> Option<Type> {
|
||||
if self.is_scalar() {
|
||||
None
|
||||
|
||||
@@ -173,9 +173,9 @@ fn convert_from_abi(dfg: &mut DataFlowGraph,
|
||||
// Construct a `ty` by concatenating two halves of a vector.
|
||||
ValueConversion::VectorSplit => {
|
||||
let abi_ty = ty.half_vector().expect("Invalid type for conversion");
|
||||
let _lo = convert_from_abi(dfg, pos, entry, abi_arg, abi_types, abi_ty);
|
||||
let _hi = convert_from_abi(dfg, pos, entry, abi_arg, abi_types, abi_ty);
|
||||
unimplemented!()
|
||||
let lo = convert_from_abi(dfg, pos, entry, abi_arg, abi_types, abi_ty);
|
||||
let hi = convert_from_abi(dfg, pos, entry, abi_arg, abi_types, abi_ty);
|
||||
dfg.ins(pos).vconcat(lo, hi)
|
||||
}
|
||||
// Construct a `ty` by bit-casting from an integer type.
|
||||
ValueConversion::IntBits => {
|
||||
|
||||
Reference in New Issue
Block a user