From 84d5b3ee59ecf2922919b8f028fef59cd626db14 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 21 Apr 2024 18:50:17 -0700 Subject: [PATCH] CPUID: Enable enhanced rep movs in more situations Instead of only enabling enhanced rep movs if software TSO is disabled, Enable it if software tso is disabled OR memcpysettso is disabled. This is because now we hit the fast path when memcpysettso is disabled alone but global TSO is disabled. Retested Hades and performance was fine in this configuration. --- FEXCore/Source/Interface/Core/CPUID.cpp | 3 ++- FEXCore/Source/Interface/Core/CPUID.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/FEXCore/Source/Interface/Core/CPUID.cpp b/FEXCore/Source/Interface/Core/CPUID.cpp index dcc5c9001..7fd4e4c45 100644 --- a/FEXCore/Source/Interface/Core/CPUID.cpp +++ b/FEXCore/Source/Interface/Core/CPUID.cpp @@ -595,7 +595,8 @@ FEXCore::CPUID::FunctionResults CPUIDEmu::Function_07h(uint32_t Leaf) const { // Disable Enhanced REP MOVS when TSO is enabled. // vcruntime140 memmove will use `rep movsb` in this case which completely destroys perf in Hades(appId 1145360) // This is due to LRCPC performance on Cortex being abysmal. - const uint32_t SupportsEnhancedREPMOVS = CTX->SoftwareTSORequired() ? 0 : 1; + // Only enable EnhancedREPMOVS if SoftwareTSO isn't required OR if MemcpySetTSO is not enabled. + const uint32_t SupportsEnhancedREPMOVS = CTX->SoftwareTSORequired() == false || MemcpySetTSOEnabled() == false; // Number of subfunctions Res.eax = 0x0; diff --git a/FEXCore/Source/Interface/Core/CPUID.h b/FEXCore/Source/Interface/Core/CPUID.h index 98e0e626f..fb4729749 100644 --- a/FEXCore/Source/Interface/Core/CPUID.h +++ b/FEXCore/Source/Interface/Core/CPUID.h @@ -119,6 +119,7 @@ private: uint32_t Cores {}; FEX_CONFIG_OPT(HideHypervisorBit, HIDEHYPERVISORBIT); FEX_CONFIG_OPT(SmallTSCScale, SMALLTSCSCALE); + FEX_CONFIG_OPT(MemcpySetTSOEnabled, MEMCPYSETTSOENABLED); // XFEATURE_ENABLED_MASK // Mask that configures what features are enabled on the CPU.