diff --git a/lib/compiler-singlepass/src/codegen_x64.rs b/lib/compiler-singlepass/src/codegen_x64.rs index ab66664377..6b392e4972 100644 --- a/lib/compiler-singlepass/src/codegen_x64.rs +++ b/lib/compiler-singlepass/src/codegen_x64.rs @@ -1313,16 +1313,12 @@ impl<'a> FuncGen<'a> { } match *param { Location::Imm64(_) => { - // Dummy value slot to be filled with `mov`. - self.assembler.emit_push(Size::S64, Location::GPR(GPR::RAX)); - - // Use R9 as the temporary register here, since: - // - It is a temporary register that is not used for any persistent value. - // - This register as an argument location is only written to after `sort_call_movs`.' + // Push R9 value slot to be exchange with `mov`. + self.assembler.emit_push(Size::S64, Location::GPR(GPR::R9)); self.machine.reserve_unused_temp_gpr(GPR::R9); self.assembler .emit_mov(Size::S64, *param, Location::GPR(GPR::R9)); - self.assembler.emit_mov( + self.assembler.emit_xchg( Size::S64, Location::GPR(GPR::R9), Location::Memory(GPR::RSP, 0),