diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a70f71eef4..681fb3cd60 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -37,7 +37,6 @@ target_sources(common PRIVATE WindowInfo.cpp emitter/avx.cpp emitter/bmi.cpp - emitter/cpudetect.cpp emitter/fpu.cpp emitter/groups.cpp emitter/jmp.cpp @@ -45,8 +44,6 @@ target_sources(common PRIVATE emitter/legacy_sse.cpp emitter/movs.cpp emitter/simd.cpp - emitter/LnxCpuDetect.cpp - emitter/WinCpuDetect.cpp emitter/x86emitter.cpp Darwin/DarwinThreads.cpp Darwin/DarwinMisc.cpp diff --git a/common/common.vcxproj b/common/common.vcxproj index 23b45ea237..2bc8fc8458 100644 --- a/common/common.vcxproj +++ b/common/common.vcxproj @@ -88,7 +88,6 @@ - @@ -97,8 +96,6 @@ - - diff --git a/common/common.vcxproj.filters b/common/common.vcxproj.filters index a89dd7c35a..db89b4f2aa 100644 --- a/common/common.vcxproj.filters +++ b/common/common.vcxproj.filters @@ -10,9 +10,6 @@ Source Files - - Source Files - Source Files @@ -28,9 +25,6 @@ Source Files - - Source Files - Source Files @@ -64,9 +58,6 @@ Source Files - - Source Files - Source Files diff --git a/common/emitter/LnxCpuDetect.cpp b/common/emitter/LnxCpuDetect.cpp deleted file mode 100644 index e839fd3378..0000000000 --- a/common/emitter/LnxCpuDetect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team -// SPDX-License-Identifier: LGPL-3.0+ - -#ifndef _WIN32 -#include "common/emitter/tools.h" - -#include - -// Note: Apparently this solution is Linux/Solaris only. -// FreeBSD/OsX need something far more complicated (apparently) -void x86capabilities::CountLogicalCores() -{ -#ifdef __linux__ - // Note : GetCPUCount uses sysconf( _SC_NPROCESSORS_ONLN ) internally, which can return 1 - // if sysconf info isn't available (a long standing linux bug). There are no fallbacks or - // alternatives, apparently. - LogicalCores = sysconf(_SC_NPROCESSORS_ONLN); -#else - LogicalCores = 1; -#endif -} - -#endif diff --git a/common/emitter/WinCpuDetect.cpp b/common/emitter/WinCpuDetect.cpp deleted file mode 100644 index 50056629f4..0000000000 --- a/common/emitter/WinCpuDetect.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team -// SPDX-License-Identifier: LGPL-3.0+ - -#if defined(_WIN32) - -#include "common/Console.h" -#include "common/emitter/tools.h" -#include "common/RedtapeWindows.h" - -void x86capabilities::CountLogicalCores() -{ - DWORD_PTR vProcessCPUs; - DWORD_PTR vSystemCPUs; - - LogicalCores = 1; - - if (!GetProcessAffinityMask(GetCurrentProcess(), &vProcessCPUs, &vSystemCPUs)) - return; - - uint CPUs = 0; - for (DWORD_PTR bit = 1; bit != 0; bit <<= 1) - if (vSystemCPUs & bit) - CPUs++; - - LogicalCores = CPUs; -} - -#endif diff --git a/common/emitter/cpudetect.cpp b/common/emitter/cpudetect.cpp deleted file mode 100644 index 30c6002b31..0000000000 --- a/common/emitter/cpudetect.cpp +++ /dev/null @@ -1,217 +0,0 @@ -// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team -// SPDX-License-Identifier: LGPL-3.0+ - -#include "common/General.h" -#include "common/emitter/tools.h" -#include "common/emitter/internal.h" -#include "common/VectorIntrin.h" -#include - -// CPU information support -#if defined(_WIN32) - -#define cpuid __cpuid -#define cpuidex __cpuidex - -#else - -#include - -static __inline__ __attribute__((always_inline)) void cpuidex(int CPUInfo[], const int InfoType, const int count) -{ - __cpuid_count(InfoType, count, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); -} - -static __inline__ __attribute__((always_inline)) void cpuid(int CPUInfo[], const int InfoType) -{ - __cpuid(InfoType, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); -} - -#endif - -using namespace x86Emitter; - -alignas(16) x86capabilities x86caps; - -#if defined(_MSC_VER) -// We disable optimizations for this function, because we need x86capabilities for AVX -// detection, but if we keep opts on, it'll use AVX instructions for inlining memzero. -#pragma optimize("", off) -#endif -x86capabilities::x86capabilities() - : isIdentified(false) - , VendorID(x86Vendor_Unknown) - , FamilyID(0) - , Model(0) - , TypeID(0) - , StepID(0) - , Flags(0) - , Flags2(0) - , EFlags(0) - , EFlags2(0) - , SEFlag(0) - , AllCapabilities(0) - , PhysicalCores(0) - , LogicalCores(0) -{ -} -#if defined(_MSC_VER) -#pragma optimize("", on) -#endif - -const char* x86capabilities::GetTypeName() const -{ - switch (TypeID) - { - case 0: - return "Standard OEM"; - case 1: - return "Overdrive"; - case 2: - return "Dual"; - case 3: - return "Reserved"; - default: - return "Unknown"; - } -} - -void x86capabilities::CountCores() -{ - Identify(); - - // This will assign values into LogicalCores and PhysicalCores - CountLogicalCores(); -} - -static const char* tbl_x86vendors[] = - { - "GenuineIntel", - "AuthenticAMD", - "Unknown ", -}; - -// Performs all _cpuid-related activity. This fills *most* of the x86caps structure, except for -// the cpuSpeed and the mxcsr masks. Those must be completed manually. -void x86capabilities::Identify() -{ - if (isIdentified) - return; - isIdentified = true; - - s32 regs[4]; - u32 cmds; - - cpuid(regs, 0); - - cmds = regs[0]; - memcpy(&VendorName[0], ®s[1], 4); - memcpy(&VendorName[4], ®s[3], 4); - memcpy(&VendorName[8], ®s[2], 4); - - // Determine Vendor Specifics! - // It's really not recommended that we base much (if anything) on CPU vendor names, - // however it's currently necessary in order to gain a (pseudo)reliable count of cores - // and threads used by the CPU (AMD and Intel can't agree on how to make this info available). - - int vid; - for (vid = 0; vid < x86Vendor_Unknown; ++vid) - { - if (memcmp(VendorName, tbl_x86vendors[vid], 12) == 0) - break; - } - VendorID = static_cast(vid); - - if (cmds >= 0x00000001) - { - cpuid(regs, 0x00000001); - - StepID = regs[0] & 0xf; - Model = (regs[0] >> 4) & 0xf; - FamilyID = (regs[0] >> 8) & 0xf; - TypeID = (regs[0] >> 12) & 0x3; - //u32 x86_64_8BITBRANDID = regs[1] & 0xff; - Flags = regs[3]; - Flags2 = regs[2]; - } - - if (cmds >= 0x00000007) - { - // Note: ECX must be 0 for AVX2 detection. - cpuidex(regs, 0x00000007, 0); - - SEFlag = regs[1]; - } - - cpuid(regs, 0x80000000); - cmds = regs[0]; - if (cmds >= 0x80000001) - { - cpuid(regs, 0x80000001); - - //u32 x86_64_12BITBRANDID = regs[1] & 0xfff; - EFlags2 = regs[2]; - EFlags = regs[3]; - } - - cpuid((int*)FamilyName, 0x80000002); - cpuid((int*)(FamilyName + 16), 0x80000003); - cpuid((int*)(FamilyName + 32), 0x80000004); - - hasFloatingPointUnit = (Flags >> 0) & 1; - hasVirtual8086ModeEnhancements = (Flags >> 1) & 1; - hasDebuggingExtensions = (Flags >> 2) & 1; - hasPageSizeExtensions = (Flags >> 3) & 1; - hasTimeStampCounter = (Flags >> 4) & 1; - hasModelSpecificRegisters = (Flags >> 5) & 1; - hasPhysicalAddressExtension = (Flags >> 6) & 1; - hasMachineCheckArchitecture = (Flags >> 7) & 1; - hasCOMPXCHG8BInstruction = (Flags >> 8) & 1; - hasAdvancedProgrammableInterruptController = (Flags >> 9) & 1; - hasSEPFastSystemCall = (Flags >> 11) & 1; - hasMemoryTypeRangeRegisters = (Flags >> 12) & 1; - hasPTEGlobalFlag = (Flags >> 13) & 1; - hasMachineCheckArchitecture = (Flags >> 14) & 1; - hasConditionalMoveAndCompareInstructions = (Flags >> 15) & 1; - hasFGPageAttributeTable = (Flags >> 16) & 1; - has36bitPageSizeExtension = (Flags >> 17) & 1; - hasProcessorSerialNumber = (Flags >> 18) & 1; - hasCFLUSHInstruction = (Flags >> 19) & 1; - hasDebugStore = (Flags >> 21) & 1; - hasACPIThermalMonitorAndClockControl = (Flags >> 22) & 1; - hasFastStreamingSIMDExtensionsSaveRestore = (Flags >> 24) & 1; - hasStreamingSIMDExtensions = (Flags >> 25) & 1; //sse - hasStreamingSIMD2Extensions = (Flags >> 26) & 1; //sse2 - hasSelfSnoop = (Flags >> 27) & 1; - hasMultiThreading = (Flags >> 28) & 1; - hasThermalMonitor = (Flags >> 29) & 1; - hasIntel64BitArchitecture = (Flags >> 30) & 1; - - // ------------------------------------------------- - // --> SSE3 / SSSE3 / SSE4.1 / SSE 4.2 detection <-- - // ------------------------------------------------- - - hasStreamingSIMD3Extensions = (Flags2 >> 0) & 1; //sse3 - hasSupplementalStreamingSIMD3Extensions = (Flags2 >> 9) & 1; //ssse3 - hasStreamingSIMD4Extensions = (Flags2 >> 19) & 1; //sse4.1 - hasStreamingSIMD4Extensions2 = (Flags2 >> 20) & 1; //sse4.2 - - if ((Flags2 >> 27) & 1) // OSXSAVE - { - // Note: In theory, we should use xgetbv to check OS support - // but all OSes we officially run under support it - // and its intrinsic requires extra compiler flags - hasAVX = (Flags2 >> 28) & 1; //avx - hasFMA = (Flags2 >> 12) & 1; //fma - hasAVX2 = (SEFlag >> 5) & 1; //avx2 - } - - hasBMI1 = (SEFlag >> 3) & 1; - hasBMI2 = (SEFlag >> 8) & 1; - - // Ones only for AMDs: - hasAMD64BitArchitecture = (EFlags >> 29) & 1; //64bit cpu - hasStreamingSIMD4ExtensionsA = (EFlags2 >> 6) & 1; //INSERTQ / EXTRQ / MOVNT - - isIdentified = true; -} diff --git a/common/emitter/tools.h b/common/emitter/tools.h index f348eb9b3a..269b5fb4a3 100644 --- a/common/emitter/tools.h +++ b/common/emitter/tools.h @@ -5,109 +5,6 @@ #include "common/Pcsx2Defs.h" -enum x86VendorType -{ - x86Vendor_Intel = 0, - x86Vendor_AMD = 1, - x86Vendor_Unknown = 2 -}; - -// -------------------------------------------------------------------------------------- -// x86capabilities -// -------------------------------------------------------------------------------------- -class x86capabilities -{ -public: - bool isIdentified; - -public: - x86VendorType VendorID; - - uint FamilyID; // Processor Family - uint Model; // Processor Model - uint TypeID; // Processor Type - uint StepID; // Stepping ID - - u32 Flags; // Feature Flags - u32 Flags2; // More Feature Flags - u32 EFlags; // Extended Feature Flags - u32 EFlags2; // Extended Feature Flags pg2 - u32 SEFlag; // Structured Extended Feature Flags Enumeration - - char VendorName[16] = {}; // Vendor/Creator ID - char FamilyName[50] = {}; // the original cpu name - - // ---------------------------------------------------------------------------- - // x86 CPU Capabilities Section (all boolean flags!) - // ---------------------------------------------------------------------------- - - union - { - u64 AllCapabilities = 0; - - struct - { - u32 hasFloatingPointUnit : 1; - u32 hasVirtual8086ModeEnhancements : 1; - u32 hasDebuggingExtensions : 1; - u32 hasPageSizeExtensions : 1; - u32 hasTimeStampCounter : 1; - u32 hasModelSpecificRegisters : 1; - u32 hasPhysicalAddressExtension : 1; - u32 hasCOMPXCHG8BInstruction : 1; - u32 hasAdvancedProgrammableInterruptController : 1; - u32 hasSEPFastSystemCall : 1; - u32 hasMemoryTypeRangeRegisters : 1; - u32 hasPTEGlobalFlag : 1; - u32 hasMachineCheckArchitecture : 1; - u32 hasConditionalMoveAndCompareInstructions : 1; - u32 hasFGPageAttributeTable : 1; - u32 has36bitPageSizeExtension : 1; - u32 hasProcessorSerialNumber : 1; - u32 hasCFLUSHInstruction : 1; - u32 hasDebugStore : 1; - u32 hasACPIThermalMonitorAndClockControl : 1; - u32 hasFastStreamingSIMDExtensionsSaveRestore : 1; - u32 hasStreamingSIMDExtensions : 1; - u32 hasStreamingSIMD2Extensions : 1; - u32 hasSelfSnoop : 1; - - // is TRUE for both multi-core and Hyperthreaded CPUs. - u32 hasMultiThreading : 1; - - u32 hasThermalMonitor : 1; - u32 hasIntel64BitArchitecture : 1; - u32 hasStreamingSIMD3Extensions : 1; - u32 hasSupplementalStreamingSIMD3Extensions : 1; - u32 hasStreamingSIMD4Extensions : 1; - u32 hasStreamingSIMD4Extensions2 : 1; - u32 hasAVX : 1; - u32 hasAVX2 : 1; - u32 hasBMI1 : 1; - u32 hasBMI2 : 1; - u32 hasFMA : 1; - - // AMD-specific CPU Features - u32 hasAMD64BitArchitecture : 1; - u32 hasStreamingSIMD4ExtensionsA : 1; - }; - }; - - // Core Counts! - u32 PhysicalCores = 0; - u32 LogicalCores = 0; - -public: - x86capabilities(); - - void Identify(); - void CountCores(); - const char* GetTypeName() const; - -protected: - void CountLogicalCores(); -}; - enum SSE_RoundMode { SSE_RoundMode_FIRST = 0, @@ -185,5 +82,3 @@ union SSE_MXCSR operator x86Emitter::xIndirect32() const; }; - -alignas(16) extern x86capabilities x86caps; diff --git a/common/emitter/x86emitter.cpp b/common/emitter/x86emitter.cpp index 397017e638..2d00cf1c73 100644 --- a/common/emitter/x86emitter.cpp +++ b/common/emitter/x86emitter.cpp @@ -563,7 +563,7 @@ const xRegister32 // Core2/i7 CPUs prefer unaligned addresses. Checking for SSSE3 is a decent filter. // (also align in debug modes for disasm convenience) - if (IsDebugBuild || !x86caps.hasSupplementalStreamingSIMD3Extensions) + if constexpr (IsDebugBuild) { // - P4's and earlier prefer 16 byte alignment. // - AMD Athlons and Phenoms prefer 8 byte alignment, but I don't have an easy diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index 90eb6aa74d..cce0e8cb36 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -106,7 +106,6 @@ void SysLogMachineCaps() GetOSVersionString().c_str(), (u32)(GetPhysicalMemory() / _1mb)); - cpuinfo_initialize(); Console.Indent().WriteLn("Processor = %s", cpuinfo_get_package(0)->name); Console.Indent().WriteLn("Core Count = %u cores", cpuinfo_get_cores_count()); Console.Indent().WriteLn("Thread Count = %u threads", cpuinfo_get_processors_count()); @@ -115,9 +114,9 @@ void SysLogMachineCaps() std::string features; - if (x86caps.hasAVX) + if (cpuinfo_has_x86_avx()) features += "AVX "; - if (x86caps.hasAVX2) + if (cpuinfo_has_x86_avx2()) features += "AVX2 "; StringUtil::StripWhitespace(&features); diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index c905ae1df8..a1e95360a6 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -51,6 +51,7 @@ #include "common/Timer.h" #include "IconsFontAwesome5.h" +#include "cpuinfo.h" #include "discord_rpc.h" #include "fmt/core.h" @@ -186,10 +187,9 @@ bool VMManager::PerformEarlyHardwareChecks(const char** error) #if defined(_M_X86) // On Windows, this gets called as a global object constructor, before any of our objects are constructed. // So, we have to put it on the stack instead. - x86capabilities temp_x86_caps; - temp_x86_caps.Identify(); + cpuinfo_initialize(); - if (!temp_x86_caps.hasStreamingSIMD4Extensions) + if (!cpuinfo_has_x86_sse4_1()) { *error = "PCSX2 requires the Streaming SIMD 4.1 Extensions instruction set, which your CPU does not support.\n\n" @@ -199,7 +199,7 @@ bool VMManager::PerformEarlyHardwareChecks(const char** error) } #if _M_SSE >= 0x0501 - if (!temp_x86_caps.hasAVX || !temp_x86_caps.hasAVX2) + if (!cpuinfo_has_x86_avx2()) { *error = "This build of PCSX2 requires the Advanced Vector Extensions 2 instruction set, which your CPU does " "not support.\n\n" @@ -342,8 +342,9 @@ bool VMManager::Internal::CPUThreadInitialize() } #endif - x86caps.Identify(); - x86caps.CountCores(); + if (!cpuinfo_initialize()) + Console.Error("cpuinfo_initialize() failed."); + SysLogMachineCaps(); if (!SysMemory::Allocate()) @@ -2803,8 +2804,6 @@ static std::once_flag s_processor_list_initialized; #if defined(__linux__) || defined(_WIN32) -#include "cpuinfo.h" - static u32 GetProcessorIdForProcessor(const cpuinfo_processor* proc) { #if defined(__linux__) @@ -2816,14 +2815,8 @@ static u32 GetProcessorIdForProcessor(const cpuinfo_processor* proc) #endif } -static void InitializeCPUInfo() +static void InitializeProcessorList() { - if (!cpuinfo_initialize()) - { - Console.Error("Failed to initialize cpuinfo"); - return; - } - const u32 cluster_count = cpuinfo_get_clusters_count(); if (cluster_count == 0) { @@ -2922,7 +2915,7 @@ static void SetMTVUAndAffinityControlDefault(SettingsInterface& si) static u32 s_big_cores; static u32 s_small_cores; -static void InitializeCPUInfo() +static void InitializeProcessorList() { s_big_cores = 0; s_small_cores = 0; @@ -2957,7 +2950,7 @@ static void SetMTVUAndAffinityControlDefault(SettingsInterface& si) #else -static void InitializeCPUInfo() +static void InitializeProcessorList() { DevCon.WriteLn("(VMManager) InitializeCPUInfo() not implemented."); } @@ -2970,7 +2963,7 @@ static void SetMTVUAndAffinityControlDefault(SettingsInterface& si) void VMManager::EnsureCPUInfoInitialized() { - std::call_once(s_processor_list_initialized, InitializeCPUInfo); + std::call_once(s_processor_list_initialized, InitializeProcessorList); } void VMManager::SetEmuThreadAffinities() diff --git a/pcsx2/x86/iMMI.cpp b/pcsx2/x86/iMMI.cpp index 915711a31e..ea18419943 100644 --- a/pcsx2/x86/iMMI.cpp +++ b/pcsx2/x86/iMMI.cpp @@ -2618,18 +2618,8 @@ void recPSRAVW() xPSRA.D(xRegisterSSE(t1reg), xRegisterSSE(t0reg)); // merge & sign extend - if (x86caps.hasStreamingSIMD4Extensions) - { - xPUNPCK.LDQ(xRegisterSSE(EEREC_D), xRegisterSSE(t1reg)); - xPMOVSX.DQ(xRegisterSSE(EEREC_D), xRegisterSSE(EEREC_D)); - } - else - { - xPUNPCK.LDQ(xRegisterSSE(EEREC_D), xRegisterSSE(t1reg)); - xMOVDQA(xRegisterSSE(t0reg), xRegisterSSE(EEREC_D)); - xPSRA.D(xRegisterSSE(t0reg), 31); // get the signs - xPUNPCK.LDQ(xRegisterSSE(EEREC_D), xRegisterSSE(t0reg)); - } + xPUNPCK.LDQ(xRegisterSSE(EEREC_D), xRegisterSSE(t1reg)); + xPMOVSX.DQ(xRegisterSSE(EEREC_D), xRegisterSSE(EEREC_D)); _freeXMMreg(t0reg); _freeXMMreg(t1reg); @@ -2739,25 +2729,10 @@ void recPMULTUW() } // interleave & sign extend - if (x86caps.hasStreamingSIMD4Extensions) - { - xPSHUF.D(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_HI), 0x88); - xPSHUF.D(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI), 0xdd); - xPMOVSX.DQ(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_LO)); - xPMOVSX.DQ(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI)); - } - else - { - int t0reg = _allocTempXMMreg(XMMT_INT); - xPSHUF.D(xRegisterSSE(t0reg), xRegisterSSE(EEREC_HI), 0xd8); - xMOVDQA(xRegisterSSE(EEREC_LO), xRegisterSSE(t0reg)); - xMOVDQA(xRegisterSSE(EEREC_HI), xRegisterSSE(t0reg)); - xPSRA.D(xRegisterSSE(t0reg), 31); // get the signs - - xPUNPCK.LDQ(xRegisterSSE(EEREC_LO), xRegisterSSE(t0reg)); - xPUNPCK.HDQ(xRegisterSSE(EEREC_HI), xRegisterSSE(t0reg)); - _freeXMMreg(t0reg); - } + xPSHUF.D(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_HI), 0x88); + xPSHUF.D(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI), 0xdd); + xPMOVSX.DQ(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_LO)); + xPMOVSX.DQ(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI)); } _clearNeededXMMregs(); } @@ -2805,25 +2780,11 @@ void recPMADDUW() xPADD.Q(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_LO)); // interleave & sign extend - if (x86caps.hasStreamingSIMD4Extensions) - { - xPSHUF.D(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_HI), 0x88); - xPSHUF.D(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI), 0xdd); - xPMOVSX.DQ(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_LO)); - xPMOVSX.DQ(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI)); - } - else - { - int t0reg = _allocTempXMMreg(XMMT_INT); - xPSHUF.D(xRegisterSSE(t0reg), xRegisterSSE(EEREC_HI), 0xd8); - xMOVDQA(xRegisterSSE(EEREC_LO), xRegisterSSE(t0reg)); - xMOVDQA(xRegisterSSE(EEREC_HI), xRegisterSSE(t0reg)); - xPSRA.D(xRegisterSSE(t0reg), 31); // get the signs + xPSHUF.D(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_HI), 0x88); + xPSHUF.D(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI), 0xdd); + xPMOVSX.DQ(xRegisterSSE(EEREC_LO), xRegisterSSE(EEREC_LO)); + xPMOVSX.DQ(xRegisterSSE(EEREC_HI), xRegisterSSE(EEREC_HI)); - xPUNPCK.LDQ(xRegisterSSE(EEREC_LO), xRegisterSSE(t0reg)); - xPUNPCK.HDQ(xRegisterSSE(EEREC_HI), xRegisterSSE(t0reg)); - _freeXMMreg(t0reg); - } _clearNeededXMMregs(); } diff --git a/pcsx2/x86/microVU_Execute.inl b/pcsx2/x86/microVU_Execute.inl index 6eaefec6c4..833ae18af3 100644 --- a/pcsx2/x86/microVU_Execute.inl +++ b/pcsx2/x86/microVU_Execute.inl @@ -3,6 +3,8 @@ #pragma once +#include "cpuinfo.h" + //------------------------------------------------------------------ // Dispatcher Functions //------------------------------------------------------------------ @@ -204,7 +206,7 @@ static void mVUGenerateCopyPipelineState(mV) { mVU.copyPLState = xGetAlignedCallTarget(); - if (x86caps.hasAVX2) + if (cpuinfo_has_x86_avx()) { xVMOVAPS(ymm0, ptr[rax]); xVMOVAPS(ymm1, ptr[rax + 32u]); @@ -249,7 +251,7 @@ static void mVUGenerateCompareState(mV) { mVU.compareStateF = xGetAlignedCallTarget(); - if (!x86caps.hasAVX2) + if (!cpuinfo_has_x86_avx2()) { xMOVAPS (xmm0, ptr32[arg1reg]); xPCMP.EQD(xmm0, ptr32[arg2reg]); diff --git a/tests/ctest/core/GS/swizzle_test_main.cpp b/tests/ctest/core/GS/swizzle_test_main.cpp index 9e5b0c50d4..dae58cf8e9 100644 --- a/tests/ctest/core/GS/swizzle_test_main.cpp +++ b/tests/ctest/core/GS/swizzle_test_main.cpp @@ -8,6 +8,8 @@ #include #include +#include "cpuinfo.h" + #ifdef MULTI_ISA_UNSHARED_COMPILATION #include "common/emitter/tools.h" @@ -22,10 +24,10 @@ enum class TestISA static bool CheckCapabilities(TestISA required_caps) { - x86caps.Identify(); - if (required_caps == TestISA::isa_avx && !x86caps.hasAVX) + cpuinfo_initialize(); + if (required_caps == TestISA::isa_avx && !cpuinfo_has_x86_avx()) return false; - if (required_caps == TestISA::isa_avx2 && !x86caps.hasAVX2) + if (required_caps == TestISA::isa_avx2 && !cpuinfo_has_x86_avx2()) return false; return true;