diff --git a/lib/compiler-singlepass/src/machine_x64.rs b/lib/compiler-singlepass/src/machine_x64.rs index 9ed850661d7..3f428fe19fe 100644 --- a/lib/compiler-singlepass/src/machine_x64.rs +++ b/lib/compiler-singlepass/src/machine_x64.rs @@ -1807,15 +1807,11 @@ impl Machine for MachineX86_64 { fn push_location_for_native(&mut self, loc: Location) { match loc { 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.reserve_unused_temp_gpr(GPR::R9); self.move_location(Size::S64, loc, Location::GPR(GPR::R9)); - self.move_location( + self.assembler.emit_xchg( Size::S64, Location::GPR(GPR::R9), Location::Memory(GPR::RSP, 0),