From 77dc289517a977df67d660bbcfa6b2ac5b5a9b36 Mon Sep 17 00:00:00 2001 From: altimumdelta <48530820+altimumdelta@users.noreply.github.com> Date: Sun, 8 Nov 2020 14:27:24 +0100 Subject: [PATCH] CPUDetect: Indicate slow PDEP/PEXT only for Zen1/+/2 (Family 23) --- Source/Core/Common/CPUDetect.h | 5 ++--- Source/Core/Common/x64CPUDetect.cpp | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/Core/Common/CPUDetect.h b/Source/Core/Common/CPUDetect.h index f789ba41a2..6157e7764e 100644 --- a/Source/Core/Common/CPUDetect.h +++ b/Source/Core/Common/CPUDetect.h @@ -42,8 +42,7 @@ struct CPUInfo bool bAVX2 = false; bool bBMI1 = false; bool bBMI2 = false; - // PDEP and PEXT are ridiculously slow on AMD Zen, so we have this flag to avoid using them there - // Zen 2 is also affected by this issue + // PDEP and PEXT are ridiculously slow on AMD Zen1, Zen1+ and Zen2 (Family 23) bool bFastBMI2 = false; bool bFMA = false; bool bFMA4 = false; @@ -57,7 +56,7 @@ struct CPUInfo bool bLAHFSAHF64 = false; bool bLongMode = false; bool bAtom = false; - bool bZen = false; + bool bZen1p2 = false; // ARMv8 specific bool bFP = false; diff --git a/Source/Core/Common/x64CPUDetect.cpp b/Source/Core/Common/x64CPUDetect.cpp index 338c74b808..8129d8ddfa 100644 --- a/Source/Core/Common/x64CPUDetect.cpp +++ b/Source/Core/Common/x64CPUDetect.cpp @@ -118,9 +118,9 @@ void CPUInfo::Detect() (model == 0x1C || model == 0x26 || model == 0x27 || model == 0x35 || model == 0x36 || model == 0x37 || model == 0x4A || model == 0x4D || model == 0x5A || model == 0x5D)) bAtom = true; - // Detect AMD Zen (all models) + // Detect AMD Zen1, Zen1+ and Zen2 if (family == 23) - bZen = true; + bZen1p2 = true; logical_cpu_count = (cpu_id[1] >> 16) & 0xFF; ht = (cpu_id[3] >> 28) & 1; @@ -175,7 +175,7 @@ void CPUInfo::Detect() } bFlushToZero = bSSE; - bFastBMI2 = bBMI2 && !bZen; + bFastBMI2 = bBMI2 && !bZen1p2; if (max_ex_fn >= 0x80000004) {