Don't reuse registers in the x64 div lowering (#5356)

Introduce a temporary for an intermediate value in the lowering of div in the x64 backend. Additionally, add a src argument to the shift_r smart constructor, which is why the diff got larger than just the div lowering.
This commit is contained in:
Trevor Elliott
2022-11-30 14:44:59 -08:00
committed by GitHub
parent 87b63174b1
commit d8dbabfe6b
4 changed files with 37 additions and 6 deletions

View File

@@ -431,6 +431,7 @@ impl Inst {
size: OperandSize,
kind: ShiftKind,
num_bits: Imm8Gpr,
src: Reg,
dst: Writable<Reg>,
) -> Inst {
if let Imm8Reg::Imm8 { imm: num_bits } = num_bits.clone().to_imm8_reg() {
@@ -440,7 +441,7 @@ impl Inst {
Inst::ShiftR {
size,
kind,
src: Gpr::new(dst.to_reg()).unwrap(),
src: Gpr::new(src).unwrap(),
num_bits,
dst: WritableGpr::from_writable_reg(dst).unwrap(),
}