FEXCore: Disable Enhanced REP MOVSB if TSO is enabled

Hades and the vcruntime hits this very hard in memmove.

`86.56%  [JIT] tid 458574        [.] JIT_0x18000c375_0x7fffc94790c8`

```asm
   0x00007fffc94790f8:  ldaprb  w3, [x2]
   0x00007fffc94790fc:  stlrb   w3, [x1]
   0x00007fffc9479100:  add     x1, x1, #0x1
   0x00007fffc9479104:  add     x2, x2, #0x1
   0x00007fffc9479108:  sub     x0, x0, #0x1
   0x00007fffc947910c:  cbnz    x0, 0x7fffc94790f8
```

This performance is terrible because Cortex's LRCPC performance is bottom-tier.
Work around the performance issue by forcing things to do larger moves with vector moves instead.
This commit is contained in:
Ryan Houdek committed 2023-09-14 17:23:02 -07:00
1 parent 6fdf2f963b
commit 40a4eb90af
2 files changed
+20 -1

No files matched your search

+6 -1
View File
@@ -618,6 +618,11 @@ FEXCore::CPUID::FunctionResults CPUIDEmu::Function_06h(uint32_t Leaf) {
FEXCore::CPUID::FunctionResults CPUIDEmu::Function_07h(uint32_t Leaf) {
FEXCore::CPUID::FunctionResults Res{};
if (Leaf == 0) {
// 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;
// Number of subfunctions
Res.eax = 0x0;
Res.ebx =
@@ -630,7 +635,7 @@ FEXCore::CPUID::FunctionResults CPUIDEmu::Function_07h(uint32_t Leaf) {
(1 << 6) | // FPU data pointer updated only on exception
(1 << 7) | // SMEP support
(SupportsAVX() << 8) | // BMI2
(1 << 9) | // Enhanced REP MOVSB/STOSB
(SupportsEnhancedREPMOVS << 9) | // Enhanced REP MOVSB/STOSB
(1 << 10) | // INVPCID for system software control of process-context
(0 << 11) | // Restricted transactional memory
(0 << 12) | // Intel resource directory technology Monitoring