From 24203b1a5d312c9a5463c02d8c5a742924d1c54d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 12 Aug 2013 08:40:36 -0700 Subject: [PATCH 1/3] Improve performance on x86 as well using movq. --- Core/CoreTiming.cpp | 2 +- GPU/GPUCommon.h | 30 +++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index a080adb17e..1879a4869f 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -74,7 +74,7 @@ volatile u32 hasTsEvents = false; // as we can already reach that structure through a register. int slicelength; -s64 globalTimer; +MEMORY_ALIGNED16(s64) globalTimer; s64 idledCycles; static std::recursive_mutex externalEventSection; diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 86f3a0b2bd..bec3605760 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -1,8 +1,14 @@ #pragma once +#include "Common/Common.h" #include "Core/ThreadEventQueue.h" #include "GPU/GPUInterface.h" +#ifdef _M_SSE +#include +#pragma warning(disable:4799) +#endif + typedef ThreadEventQueue GPUThreadEventQueue; class GPUCommon : public GPUThreadEventQueue @@ -37,10 +43,15 @@ public: virtual void ReapplyGfxState(); virtual u64 GetTickEstimate() { -#ifndef _M_X64 - lock_guard guard(curTickEstLock_); -#endif +#if defined(_M_X64) return curTickEst_; +#elif defined(_M_SSE) + __m64 result = *(__m64 *)&curTickEst_; + return *(u64 *)&result; +#else + lock_guard guard(curTickEstLock_); + return curTickEst_; +#endif } protected: @@ -94,14 +105,19 @@ protected: bool interruptsEnabled_; // For CPU/GPU sync. - volatile u64 curTickEst_; + volatile MEMORY_ALIGNED16(u64) curTickEst_; recursive_mutex curTickEstLock_; virtual void UpdateTickEstimate(u64 value) { -#ifndef _M_X64 - lock_guard guard(curTickEstLock_); -#endif +#if defined(_M_X64) curTickEst_ = value; +#elif defined(_M_SSE) + __m64 result = *(__m64 *)&value; + *(__m64 *)&curTickEst_ = result; +#else + lock_guard guard(curTickEstLock_); + curTickEst_ = value; +#endif } public: From 49ab98c7fd322d05e7449a579a4c72930eafb7b2 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 12 Aug 2013 08:51:19 -0700 Subject: [PATCH 2/3] Use atomic operations on Android + warning fixes. --- Core/MIPS/MIPSAnalyst.cpp | 2 +- Core/MIPS/MIPSCodeUtils.cpp | 3 +++ GPU/GPUCommon.cpp | 2 +- GPU/GPUCommon.h | 12 +++++++++--- ext/disarm.cpp | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 5f16b37c37..1f0cf6ff57 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -141,7 +141,7 @@ namespace MIPSAnalyst int rd = MIPS_GET_RD(op); if ( - ((info & IN_RS) && !(info & IN_RS_ADDR) && (rs == reg)) || + ((info & IN_RS) && (info & IN_RS_ADDR) == IN_RS && (rs == reg)) || ((info & IN_RT) && (rt == reg))) { if (regAnal[reg].firstRead == -1) diff --git a/Core/MIPS/MIPSCodeUtils.cpp b/Core/MIPS/MIPSCodeUtils.cpp index 91a344e8e6..fad4dddb63 100644 --- a/Core/MIPS/MIPSCodeUtils.cpp +++ b/Core/MIPS/MIPSCodeUtils.cpp @@ -114,6 +114,9 @@ namespace MIPSCodeUtils sure = _RS == 0; takeBranch = false; break; + + default: + sure = false; } if (sure && takeBranch) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index b4001a338f..d013a08256 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -558,7 +558,7 @@ void GPUCommon::ProcessEvent(GPUEvent ev) { break; default: - ERROR_LOG(G3D, "Unexpected GPU event type: %d", ev); + ERROR_LOG(G3D, "Unexpected GPU event type: %d", (int)ev); } } diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index bec3605760..43ae9a5530 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -4,7 +4,9 @@ #include "Core/ThreadEventQueue.h" #include "GPU/GPUInterface.h" -#ifdef _M_SSE +#if defined(ANDROID) +#include +#elif defined(_M_SSE) #include #pragma warning(disable:4799) #endif @@ -43,7 +45,7 @@ public: virtual void ReapplyGfxState(); virtual u64 GetTickEstimate() { -#if defined(_M_X64) +#if defined(_M_X64) || defined(ANDROID) return curTickEst_; #elif defined(_M_SSE) __m64 result = *(__m64 *)&curTickEst_; @@ -105,11 +107,15 @@ protected: bool interruptsEnabled_; // For CPU/GPU sync. +#ifdef ANDROID + std::atomic curTickEst_; +#else volatile MEMORY_ALIGNED16(u64) curTickEst_; recursive_mutex curTickEstLock_; +#endif virtual void UpdateTickEstimate(u64 value) { -#if defined(_M_X64) +#if defined(_M_X64) || defined(ANDROID) curTickEst_ = value; #elif defined(_M_SSE) __m64 result = *(__m64 *)&value; diff --git a/ext/disarm.cpp b/ext/disarm.cpp index cada7c3ef0..4c0f192272 100644 --- a/ext/disarm.cpp +++ b/ext/disarm.cpp @@ -142,7 +142,7 @@ bool DisasmVFP(uint32_t op, char *text) { if ((op & 0xFFF) != 0xA10) break; if (op == 0xEEF1FA10) { - sprintf(text, "VMRS APSR", cond); + sprintf(text, "VMRS%s APSR", cond); } else { sprintf(text, "VMRS%s r%i", cond, (op >> 12) & 0xF); } From c480bbb6790ed9e708c5530d926ccd6846088c13 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 12 Aug 2013 08:54:25 -0700 Subject: [PATCH 3/3] Change default IO thread to false. --- Core/Config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 863184e3df..5f6d8c1f61 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -90,7 +90,7 @@ void Config::Load(const char *iniFileName) cpu->Get("Jit", &bJit, true); #endif cpu->Get("SeparateCPUThread", &bSeparateCPUThread, false); - cpu->Get("SeparateIOThread", &bSeparateIOThread, true); + cpu->Get("SeparateIOThread", &bSeparateIOThread, false); cpu->Get("FastMemory", &bFastMemory, false); cpu->Get("CPUSpeed", &iLockedCPUSpeed, false);