Add MInst.XmmUnaryRmRImm to handle rounding instructions (#4823)
Add a new pseudo-instruction, XmmUnaryRmRImm, to handle instructions like roundss that only use their first register argument for the instruction's result. This has the added benefit of allowing the isle wrappers for those instructions to take an XmmMem argument, allowing for more cases where loads may be merged.
This commit is contained in:
@@ -129,6 +129,7 @@ impl Inst {
|
||||
| Inst::XmmRmR { op, .. }
|
||||
| Inst::XmmRmRImm { op, .. }
|
||||
| Inst::XmmToGpr { op, .. }
|
||||
| Inst::XmmUnaryRmRImm { op, .. }
|
||||
| Inst::XmmUnaryRmR { op, .. } => smallvec![op.available_from()],
|
||||
|
||||
Inst::XmmUnaryRmREvex { op, .. }
|
||||
@@ -896,6 +897,14 @@ impl PrettyPrint for Inst {
|
||||
format!("{} {}, {}", ljustify(op.to_string()), src, dst)
|
||||
}
|
||||
|
||||
Inst::XmmUnaryRmRImm {
|
||||
op, src, dst, imm, ..
|
||||
} => {
|
||||
let dst = pretty_print_reg(dst.to_reg().to_reg(), op.src_size(), allocs);
|
||||
let src = src.pretty_print(op.src_size(), allocs);
|
||||
format!("{} ${}, {}, {}", ljustify(op.to_string()), imm, src, dst)
|
||||
}
|
||||
|
||||
Inst::XmmUnaryRmREvex { op, src, dst, .. } => {
|
||||
let dst = pretty_print_reg(dst.to_reg().to_reg(), 8, allocs);
|
||||
let src = src.pretty_print(8, allocs);
|
||||
@@ -1702,7 +1711,9 @@ fn x64_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandCol
|
||||
collector.reg_def(dst.to_writable_reg());
|
||||
src.get_operands(collector);
|
||||
}
|
||||
Inst::XmmUnaryRmR { src, dst, .. } | Inst::XmmUnaryRmREvex { src, dst, .. } => {
|
||||
Inst::XmmUnaryRmR { src, dst, .. }
|
||||
| Inst::XmmUnaryRmREvex { src, dst, .. }
|
||||
| Inst::XmmUnaryRmRImm { src, dst, .. } => {
|
||||
collector.reg_def(dst.to_writable_reg());
|
||||
src.get_operands(collector);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user