From c186e0244ecb1c4a97a76e991e78fcf8d32e6f94 Mon Sep 17 00:00:00 2001 From: losfair Date: Thu, 11 Jul 2019 20:25:57 +0800 Subject: [PATCH] Fix compile error on `imul`. --- lib/singlepass-backend/src/codegen_x64.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index dde93b57b..6ccd8cf29 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -641,6 +641,13 @@ impl X64FunctionCode { BothToGPR, } let mode = match (src, dst) { + (Location::GPR(_), Location::GPR(_)) + if (op as *const u8 == Assembler::emit_imul as *const u8) => + { + RelaxMode::Direct + } + _ if (op as *const u8 == Assembler::emit_imul as *const u8) => RelaxMode::BothToGPR, + (Location::Memory(_, _), Location::Memory(_, _)) => RelaxMode::SrcToGPR, (Location::Imm64(_), Location::Imm64(_)) | (Location::Imm64(_), Location::Imm32(_)) => { RelaxMode::BothToGPR @@ -653,7 +660,6 @@ impl X64FunctionCode { RelaxMode::SrcToGPR } (_, Location::XMM(_)) => RelaxMode::SrcToGPR, - _ if (op as *const u8 == Assembler::emit_imul as *const u8) => RelaxMode::BothToGPR, // TODO: optimize this _ => RelaxMode::Direct, };