Replace InsertLane format with TernaryImm8
The InsertLane format has an ordering (`value().imm().value()`) and immediate name (`"lane"`) that make it awkward to use for other instructions. This changes the ordering (`value().value().imm()`) and uses the default name (`"imm"`) throughout the codebase.
This commit is contained in:
@@ -1251,10 +1251,10 @@ fn convert_insertlane(
|
||||
let mut pos = FuncCursor::new(func).at_inst(inst);
|
||||
pos.use_srcloc(inst);
|
||||
|
||||
if let ir::InstructionData::InsertLane {
|
||||
if let ir::InstructionData::TernaryImm8 {
|
||||
opcode: ir::Opcode::Insertlane,
|
||||
args: [vector, replacement],
|
||||
lane,
|
||||
imm: lane,
|
||||
} = pos.func.dfg[inst]
|
||||
{
|
||||
let value_type = pos.func.dfg.value_type(vector);
|
||||
@@ -1269,7 +1269,7 @@ fn convert_insertlane(
|
||||
pos.func
|
||||
.dfg
|
||||
.replace(inst)
|
||||
.x86_insertps(vector, immediate, replacement)
|
||||
.x86_insertps(vector, replacement, immediate)
|
||||
}
|
||||
F64X2 => {
|
||||
let replacement_as_vector = pos.ins().raw_bitcast(F64X2, replacement); // only necessary due to SSA types
|
||||
@@ -1297,7 +1297,7 @@ fn convert_insertlane(
|
||||
pos.func
|
||||
.dfg
|
||||
.replace(inst)
|
||||
.x86_pinsr(vector, lane, replacement);
|
||||
.x86_pinsr(vector, replacement, lane);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1340,7 +1340,7 @@ fn expand_dword_to_xmm<'f>(
|
||||
if arg_type == I64 {
|
||||
let (arg_lo, arg_hi) = pos.ins().isplit(arg);
|
||||
let arg = pos.ins().scalar_to_vector(I32X4, arg_lo);
|
||||
let arg = pos.ins().insertlane(arg, 1, arg_hi);
|
||||
let arg = pos.ins().insertlane(arg, arg_hi, 1);
|
||||
let arg = pos.ins().raw_bitcast(I64X2, arg);
|
||||
arg
|
||||
} else {
|
||||
|
||||
@@ -758,7 +758,7 @@ impl<'a> Verifier<'a> {
|
||||
| Binary { .. }
|
||||
| BinaryImm { .. }
|
||||
| Ternary { .. }
|
||||
| InsertLane { .. }
|
||||
| TernaryImm8 { .. }
|
||||
| ExtractLane { .. }
|
||||
| Shuffle { .. }
|
||||
| IntCompare { .. }
|
||||
@@ -1918,14 +1918,14 @@ impl<'a> Verifier<'a> {
|
||||
arg,
|
||||
..
|
||||
}
|
||||
| ir::InstructionData::InsertLane {
|
||||
| ir::InstructionData::TernaryImm8 {
|
||||
opcode: ir::instructions::Opcode::Insertlane,
|
||||
lane,
|
||||
imm: lane,
|
||||
args: [arg, _],
|
||||
..
|
||||
} => {
|
||||
// We must be specific about the opcodes above because other instructions are using
|
||||
// the ExtractLane/InsertLane formats.
|
||||
// the same formats.
|
||||
let ty = self.func.dfg.value_type(arg);
|
||||
if u16::from(lane) >= ty.lane_count() {
|
||||
errors.fatal((
|
||||
|
||||
@@ -518,7 +518,7 @@ pub fn write_operands(
|
||||
}
|
||||
}
|
||||
NullAry { .. } => write!(w, " "),
|
||||
InsertLane { lane, args, .. } => write!(w, " {}, {}, {}", args[0], lane, args[1]),
|
||||
TernaryImm8 { imm, args, .. } => write!(w, " {}, {}, {}", args[0], args[1], imm),
|
||||
ExtractLane { lane, arg, .. } => write!(w, " {}, {}", arg, lane),
|
||||
Shuffle { mask, args, .. } => {
|
||||
let data = dfg.immediates.get(mask).expect(
|
||||
|
||||
Reference in New Issue
Block a user