From 9ac1c87a518b7dc8094b53ba9bb52d23f6e8ef45 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Tue, 12 Dec 2017 15:28:37 +0000 Subject: [PATCH] emit_x64: EmitSet{Register,ExtendedRegister32,ExtendedRegister64}: Store from current source --- src/backend_x64/emit_x64.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/backend_x64/emit_x64.cpp b/src/backend_x64/emit_x64.cpp index 703836a4..3f9ee072 100644 --- a/src/backend_x64/emit_x64.cpp +++ b/src/backend_x64/emit_x64.cpp @@ -174,6 +174,9 @@ void EmitX64::EmitSetRegister(RegAlloc& reg_alloc, IR::Block&, IR::Inst* inst) { Arm::Reg reg = inst->GetArg(0).GetRegRef(); if (args[1].IsImmediate()) { code->mov(MJitStateReg(reg), args[1].GetImmediateU32()); + } else if (args[1].IsInXmm()) { + Xbyak::Xmm to_store = reg_alloc.UseXmm(args[1]); + code->movd(MJitStateReg(reg), to_store); } else { Xbyak::Reg32 to_store = reg_alloc.UseGpr(args[1]).cvt32(); code->mov(MJitStateReg(reg), to_store); @@ -184,16 +187,26 @@ void EmitX64::EmitSetExtendedRegister32(RegAlloc& reg_alloc, IR::Block&, IR::Ins auto args = reg_alloc.GetArgumentInfo(inst); Arm::ExtReg reg = inst->GetArg(0).GetExtRegRef(); ASSERT(Arm::IsSingleExtReg(reg)); - Xbyak::Xmm source = reg_alloc.UseXmm(args[1]); - code->movss(MJitStateExtReg(reg), source); + if (args[1].IsInXmm()) { + Xbyak::Xmm to_store = reg_alloc.UseXmm(args[1]); + code->movss(MJitStateExtReg(reg), to_store); + } else { + Xbyak::Reg32 to_store = reg_alloc.UseGpr(args[1]).cvt32(); + code->mov(MJitStateExtReg(reg), to_store); + } } void EmitX64::EmitSetExtendedRegister64(RegAlloc& reg_alloc, IR::Block&, IR::Inst* inst) { auto args = reg_alloc.GetArgumentInfo(inst); Arm::ExtReg reg = inst->GetArg(0).GetExtRegRef(); ASSERT(Arm::IsDoubleExtReg(reg)); - Xbyak::Xmm source = reg_alloc.UseXmm(args[1]); - code->movsd(MJitStateExtReg(reg), source); + if (args[1].IsInXmm()) { + Xbyak::Xmm to_store = reg_alloc.UseXmm(args[1]); + code->movsd(MJitStateExtReg(reg), to_store); + } else { + Xbyak::Reg64 to_store = reg_alloc.UseGpr(args[1]); + code->mov(MJitStateExtReg(reg), to_store); + } } void EmitX64::EmitGetCpsr(RegAlloc& reg_alloc, IR::Block&, IR::Inst* inst) {