Add vector instructions.
Use derived type variables with the 'LaneOf' function. Add u8 immediates to be used for lane indexes and bit shifts.
This commit is contained in:
@@ -669,37 +669,9 @@ Vector operations
|
||||
|
||||
Build a vector value from the provided lanes.
|
||||
|
||||
.. inst:: a = splat x
|
||||
|
||||
Vector splat.
|
||||
|
||||
Return a vector whose lanes are all ``x``.
|
||||
|
||||
:arg T x: Scalar value to be replicated.
|
||||
:result TxN a: Vector with identical lanes.
|
||||
|
||||
.. inst:: a = insertlane x, Idx, y
|
||||
|
||||
Insert ``y`` as lane ``Idx`` in x.
|
||||
|
||||
The lane index, ``Idx``, is an immediate value, not an SSA value. It must
|
||||
indicate a valid lane index for the type of ``x``.
|
||||
|
||||
:arg TxN x: Vector to modify.
|
||||
:arg Idx: Lane index smaller than N.
|
||||
:arg T y: New lane value.
|
||||
:result TxN y: Updated vector.
|
||||
|
||||
.. inst:: a = extractlane x, Idx
|
||||
|
||||
Extract lane ``Idx`` from ``x``.
|
||||
|
||||
The lane index, ``Idx``, is an immediate value, not an SSA value. It must
|
||||
indicate a valid lane index for the type of ``x``.
|
||||
|
||||
:arg TxN x: Source vector
|
||||
:arg Idx: Lane index
|
||||
:result T a: Lane value.
|
||||
.. autoinst:: splat
|
||||
.. autoinst:: insertlane
|
||||
.. autoinst:: extractlane
|
||||
|
||||
Integer operations
|
||||
------------------
|
||||
|
||||
@@ -163,6 +163,18 @@ pub enum InstructionData {
|
||||
ty: Type,
|
||||
args: [Value; 3],
|
||||
},
|
||||
InsertLane {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
lane: u8,
|
||||
args: [Value; 2],
|
||||
},
|
||||
ExtractLane {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
lane: u8,
|
||||
arg: Value,
|
||||
},
|
||||
Jump {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
@@ -401,7 +413,7 @@ enum OperandConstraint {
|
||||
Same,
|
||||
|
||||
/// This operand is `ctrlType.lane_type()`.
|
||||
Lane,
|
||||
LaneOf,
|
||||
|
||||
/// This operand is `ctrlType.as_bool()`.
|
||||
AsBool,
|
||||
@@ -418,7 +430,7 @@ impl OperandConstraint {
|
||||
Concrete(t) => Some(t),
|
||||
Free(_) => None,
|
||||
Same => Some(ctrl_type),
|
||||
Lane => Some(ctrl_type.lane_type()),
|
||||
LaneOf => Some(ctrl_type.lane_type()),
|
||||
AsBool => Some(ctrl_type.as_bool()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,6 +159,10 @@ pub fn write_instruction(w: &mut Write, func: &Function, inst: Inst) -> Result {
|
||||
Select { opcode, args, .. } => {
|
||||
writeln!(w, "{} {}, {}, {}", opcode, args[0], args[1], args[2])
|
||||
}
|
||||
InsertLane { opcode, lane, args, .. } => {
|
||||
writeln!(w, "{} {}, {}, {}", opcode, args[0], lane, args[1])
|
||||
}
|
||||
ExtractLane { opcode, lane, arg, .. } => writeln!(w, "{} {}, {}", opcode, arg, lane),
|
||||
Jump { opcode, ref data, .. } => writeln!(w, "{} {}", opcode, data),
|
||||
Branch { opcode, ref data, .. } => writeln!(w, "{} {}", opcode, data),
|
||||
BranchTable { opcode, arg, table, .. } => writeln!(w, "{} {}, {}", opcode, arg, table),
|
||||
|
||||
@@ -669,6 +669,8 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
InstructionFormat::Select |
|
||||
InstructionFormat::InsertLane |
|
||||
InstructionFormat::ExtractLane |
|
||||
InstructionFormat::Jump |
|
||||
InstructionFormat::Branch |
|
||||
InstructionFormat::BranchTable |
|
||||
|
||||
Reference in New Issue
Block a user