From 84f20a1cadff41b0500dc0a0bfab2549aaa2b7e7 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Tue, 12 Nov 2013 00:18:49 +0100 Subject: [PATCH] Small optimizations --- Core/MIPS/x86/CompVFPU.cpp | 22 ++++++++++++++++++++-- Core/MemMap.h | 17 +++++++++++++++++ Core/MemMapFunctions.cpp | 17 ----------------- GPU/GLES/GLES_GPU.cpp | 7 +++++-- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 4b26b5b47d..bf3196861c 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -64,6 +64,7 @@ static const float zero = 0.0f; const u32 MEMORY_ALIGNED16( noSignMask[4] ) = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF}; const u32 MEMORY_ALIGNED16( signBitLower[4] ) = {0x80000000, 0, 0, 0}; const float MEMORY_ALIGNED16( oneOneOneOne[4] ) = {1.0f, 1.0f, 1.0f, 1.0f}; +const u32 MEMORY_ALIGNED16( solidOnes[4] ) = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; void Jit::Comp_VPFX(MIPSOpcode op) { @@ -881,13 +882,14 @@ void Jit::Comp_Vcmp(MIPSOpcode op) { // Some, we just fall back to the interpreter. switch (cond) { - case VC_EN: // c = my_isnan(s[i]); break; case VC_EI: // c = my_isinf(s[i]); break; case VC_ES: // c = my_isnan(s[i]) || my_isinf(s[i]); break; // Tekken Dark Resurrection - case VC_NN: // c = !my_isnan(s[i]); break; case VC_NI: // c = !my_isinf(s[i]); break; case VC_NS: // c = !my_isnan(s[i]) && !my_isinf(s[i]); break; DISABLE; + break; + case VC_EN: // c = my_isnan(s[i]); break; + case VC_NN: // c = !my_isnan(s[i]); break; default: break; } @@ -916,7 +918,20 @@ void Jit::Comp_Vcmp(MIPSOpcode op) { bool compareToZero = false; int comparison = -1; bool flip = false; + bool inverse = false; + switch (cond) { + case VC_EN: + comparison = CMP_UNORD; + compareTwo = true; + break; + + case VC_NN: + comparison = CMP_UNORD; + compareTwo = true; + inverse = true; + break; + case VC_EQ: // c = s[i] == t[i]; break; comparison = CMP_EQ; compareTwo = true; @@ -975,6 +990,9 @@ void Jit::Comp_Vcmp(MIPSOpcode op) { MOVSS(XMM1, fpr.V(sregs[i])); CMPSS(XMM1, R(XMM0), comparison); } + if (inverse) { + XORPS(XMM1, M((void *)&solidOnes)); + } MOVSS(M((void *) &ssCompareTemp), XMM1); if (i == 0 && n == 1) { diff --git a/Core/MemMap.h b/Core/MemMap.h index 3fd45ddf54..7cd098555b 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -274,6 +274,23 @@ inline void MemcpyUnchecked(void *to_data, const u32 from_address, const u32 len memcpy(to_data, GetPointerUnchecked(from_address), len); } +inline bool IsValidAddress(const u32 address) { + if ((address & 0x3E000000) == 0x08000000) { + return true; + } + else if ((address & 0x3F800000) == 0x04000000) { + return true; + } + else if ((address & 0xBFFF0000) == 0x00010000) { + return true; + } + else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { + return true; + } + else + return false; +} + template void ReadStruct(u32 address, T *ptr) diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index c8f1ec7089..3938b918cf 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -145,23 +145,6 @@ inline void WriteToHardware(u32 address, const T data) // ===================== -bool IsValidAddress(const u32 address) { - if ((address & 0x3E000000) == 0x08000000) { - return true; - } - else if ((address & 0x3F800000) == 0x04000000) { - return true; - } - else if ((address & 0xBFFF0000) == 0x00010000) { - return true; - } - else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { - return true; - } - else - return false; -} - bool IsRAMAddress(const u32 address) { if ((address & 0x3E000000) == 0x08000000) { return true; diff --git a/GPU/GLES/GLES_GPU.cpp b/GPU/GLES/GLES_GPU.cpp index 84ca8c4368..47efbcc2c0 100644 --- a/GPU/GLES/GLES_GPU.cpp +++ b/GPU/GLES/GLES_GPU.cpp @@ -994,8 +994,6 @@ void GLES_GPU::ExecuteOpInternal(u32 op, u32 diff) { } break; - case GE_CMD_CLUTADDR: - case GE_CMD_CLUTADDRUPPER: case GE_CMD_CLUTFORMAT: if (diff) { gstate_c.textureChanged = true; @@ -1003,6 +1001,11 @@ void GLES_GPU::ExecuteOpInternal(u32 op, u32 diff) { // This could be used to "dirty" textures with clut. break; + case GE_CMD_CLUTADDR: + case GE_CMD_CLUTADDRUPPER: + // Hm, LOADCLUT actually changes the CLUT so no need to dirty here. + break; + case GE_CMD_LOADCLUT: gstate_c.textureChanged = true; textureCache_.LoadClut();