From 450109e2bbdea31be02b37b35ec84468b900ebc1 Mon Sep 17 00:00:00 2001 From: losfair Date: Sat, 13 Jul 2019 00:17:21 +0800 Subject: [PATCH] Fix singlepass compilation error. --- lib/singlepass-backend/src/codegen_x64.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index f24937b82..16f1ac5f4 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -2417,7 +2417,14 @@ impl FunctionCodeGenerator for X64FunctionCode { loc_b, ); a.emit_jmp(Condition::NotEqual, normal_path); - a.emit_mov(Size::S64, Location::Imm64(0), ret); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S64, + Location::Imm64(0), + ret, + ); a.emit_jmp(Condition::None, end); a.emit_label(normal_path); @@ -4531,9 +4538,14 @@ impl FunctionCodeGenerator for X64FunctionCode { |a, m, addr| { match ret { Location::GPR(_) => {} - _ => { - a.emit_mov(Size::S64, Location::Imm64(0), ret); + Location::Memory(base, offset) => { + a.emit_mov( + Size::S32, + Location::Imm32(0), + Location::Memory(base, offset + 4), + ); // clear upper bits } + _ => unreachable!(), } Self::emit_relaxed_binop( a,