From 84395b65f6f1c4e8f9579aab63b5c8c0584dab1f Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 12 Feb 2016 11:22:44 +0100 Subject: [PATCH] JitArm64: Track singles in psq_st. --- .../PowerPC/JitArm64/JitArm64_BackPatch.cpp | 12 +++++++ .../JitArm64/JitArm64_LoadStorePaired.cpp | 24 ++++++++++--- .../Core/PowerPC/JitArmCommon/BackPatch.h | 34 ++++++++++--------- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp index 0a69bf2c9c..5f4421ee93 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp @@ -73,6 +73,11 @@ void JitArm64::EmitBackpatchRoutine(u32 flags, bool fastmem, bool do_farcode, m_float_emit.REV32(8, D0, D0); m_float_emit.STR(64, Q0, X28, addr); } + else if (flags & BackPatchInfo::FLAG_SIZE_F32X2I) + { + m_float_emit.REV32(8, D0, RS); + m_float_emit.STR(64, Q0, X28, addr); + } else { m_float_emit.REV64(8, Q0, RS); @@ -197,6 +202,13 @@ void JitArm64::EmitBackpatchRoutine(u32 flags, bool fastmem, bool do_farcode, MOVI2R(X30, (u64)PowerPC::Write_U64); BLR(X30); } + else if (flags & BackPatchInfo::FLAG_SIZE_F32X2I) + { + m_float_emit.UMOV(64, X0, RS, 0); + ORR(X0, SP, X0, ArithOption(X0, ST_ROR, 32)); + MOVI2R(X30, (u64)PowerPC::Write_U64); + BLR(X30); + } else { MOVI2R(X30, (u64)&PowerPC::Write_U64); diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp index 9878d98511..dde52cfad5 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp @@ -115,8 +115,10 @@ void JitArm64::psq_st(UGeckoInstruction inst) gpr.Lock(W0, W1, W2, W30); fpr.Lock(Q0, Q1); + bool single = fpr.IsSingle(inst.RS); + ARM64Reg arm_addr = gpr.R(inst.RA); - ARM64Reg VS = fpr.R(inst.RS, REG_REG); + ARM64Reg VS = fpr.R(inst.RS, single ? REG_REG_SINGLE : REG_REG); ARM64Reg scale_reg = W0; ARM64Reg addr_reg = W1; @@ -150,7 +152,12 @@ void JitArm64::psq_st(UGeckoInstruction inst) if (js.assumeNoPairedQuantize) { u32 flags = BackPatchInfo::FLAG_STORE; - flags |= (inst.W ? BackPatchInfo::FLAG_SIZE_F32 : BackPatchInfo::FLAG_SIZE_F32X2); + + if (single) + flags |= (inst.W ? BackPatchInfo::FLAG_SIZE_F32I : BackPatchInfo::FLAG_SIZE_F32X2I); + else + flags |= (inst.W ? BackPatchInfo::FLAG_SIZE_F32 : BackPatchInfo::FLAG_SIZE_F32X2); + EmitBackpatchRoutine(flags, jo.fastmem, jo.fastmem, @@ -160,10 +167,17 @@ void JitArm64::psq_st(UGeckoInstruction inst) } else { - if (inst.W) - m_float_emit.FCVT(32, 64, D0, VS); + if (single) + { + m_float_emit.ORR(D0, VS, VS); + } else - m_float_emit.FCVTN(32, D0, VS); + { + if (inst.W) + m_float_emit.FCVT(32, 64, D0, VS); + else + m_float_emit.FCVTN(32, D0, VS); + } LDR(INDEX_UNSIGNED, scale_reg, X29, PPCSTATE_OFF(spr[SPR_GQR0 + inst.I])); UBFM(type_reg, scale_reg, 0, 2); // Type diff --git a/Source/Core/Core/PowerPC/JitArmCommon/BackPatch.h b/Source/Core/Core/PowerPC/JitArmCommon/BackPatch.h index c712918883..4e9f7ca199 100644 --- a/Source/Core/Core/PowerPC/JitArmCommon/BackPatch.h +++ b/Source/Core/Core/PowerPC/JitArmCommon/BackPatch.h @@ -9,22 +9,24 @@ struct BackPatchInfo { enum { - FLAG_STORE = (1 << 0), - FLAG_LOAD = (1 << 1), - FLAG_SIZE_8 = (1 << 2), - FLAG_SIZE_16 = (1 << 3), - FLAG_SIZE_32 = (1 << 4), - FLAG_SIZE_F32 = (1 << 5), - FLAG_SIZE_F32X2 = (1 << 6), - FLAG_SIZE_F64 = (1 << 7), - FLAG_REVERSE = (1 << 8), - FLAG_EXTEND = (1 << 9), - FLAG_SIZE_F32I = (1 << 10), - FLAG_ZERO_256 = (1 << 11), - FLAG_MASK_FLOAT = FLAG_SIZE_F32 | - FLAG_SIZE_F32X2 | - FLAG_SIZE_F64 | - FLAG_SIZE_F32I, + FLAG_STORE = (1 << 0), + FLAG_LOAD = (1 << 1), + FLAG_SIZE_8 = (1 << 2), + FLAG_SIZE_16 = (1 << 3), + FLAG_SIZE_32 = (1 << 4), + FLAG_SIZE_F32 = (1 << 5), + FLAG_SIZE_F32X2 = (1 << 6), + FLAG_SIZE_F32X2I = (1 << 7), + FLAG_SIZE_F64 = (1 << 8), + FLAG_REVERSE = (1 << 9), + FLAG_EXTEND = (1 << 10), + FLAG_SIZE_F32I = (1 << 11), + FLAG_ZERO_256 = (1 << 12), + FLAG_MASK_FLOAT = FLAG_SIZE_F32 | + FLAG_SIZE_F32X2 | + FLAG_SIZE_F32X2I | + FLAG_SIZE_F64 | + FLAG_SIZE_F32I, }; static u32 GetFlagSize(u32 flags)