summaryrefslogtreecommitdiffstats
path: root/src/common/x64
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-03-12 02:26:41 +0100
committerGitHub <noreply@github.com>2022-03-12 02:26:41 +0100
commit27cc7b6a73121ff7d467772da460a9ca85cd85bc (patch)
treea0bc65a2fba8947a7235de75394a93a4283cd101 /src/common/x64
parentMerge pull request #8003 from yuzu-emu/revert-7982-fix_cmake_missing_qt5_dbus (diff)
parentcpu_detect: Add additional x86 flags and telemetry (diff)
downloadyuzu-27cc7b6a73121ff7d467772da460a9ca85cd85bc.tar
yuzu-27cc7b6a73121ff7d467772da460a9ca85cd85bc.tar.gz
yuzu-27cc7b6a73121ff7d467772da460a9ca85cd85bc.tar.bz2
yuzu-27cc7b6a73121ff7d467772da460a9ca85cd85bc.tar.lz
yuzu-27cc7b6a73121ff7d467772da460a9ca85cd85bc.tar.xz
yuzu-27cc7b6a73121ff7d467772da460a9ca85cd85bc.tar.zst
yuzu-27cc7b6a73121ff7d467772da460a9ca85cd85bc.zip
Diffstat (limited to '')
-rw-r--r--src/common/x64/cpu_detect.cpp30
-rw-r--r--src/common/x64/cpu_detect.h21
2 files changed, 40 insertions, 11 deletions
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp
index 99d87f586..d81edb140 100644
--- a/src/common/x64/cpu_detect.cpp
+++ b/src/common/x64/cpu_detect.cpp
@@ -93,10 +93,14 @@ static CPUCaps Detect() {
caps.sse = Common::Bit<25>(cpu_id[3]);
caps.sse2 = Common::Bit<26>(cpu_id[3]);
caps.sse3 = Common::Bit<0>(cpu_id[2]);
+ caps.pclmulqdq = Common::Bit<1>(cpu_id[2]);
caps.ssse3 = Common::Bit<9>(cpu_id[2]);
caps.sse4_1 = Common::Bit<19>(cpu_id[2]);
caps.sse4_2 = Common::Bit<20>(cpu_id[2]);
+ caps.movbe = Common::Bit<22>(cpu_id[2]);
+ caps.popcnt = Common::Bit<23>(cpu_id[2]);
caps.aes = Common::Bit<25>(cpu_id[2]);
+ caps.f16c = Common::Bit<29>(cpu_id[2]);
// AVX support requires 3 separate checks:
// - Is the AVX bit set in CPUID?
@@ -112,16 +116,26 @@ static CPUCaps Detect() {
if (max_std_fn >= 7) {
__cpuidex(cpu_id, 0x00000007, 0x00000000);
- // Can't enable AVX2 unless the XSAVE/XGETBV checks above passed
- caps.avx2 = caps.avx && Common::Bit<5>(cpu_id[1]);
+ // Can't enable AVX{2,512} unless the XSAVE/XGETBV checks above passed
+ if (caps.avx) {
+ caps.avx2 = Common::Bit<5>(cpu_id[1]);
+ caps.avx512f = Common::Bit<16>(cpu_id[1]);
+ caps.avx512dq = Common::Bit<17>(cpu_id[1]);
+ caps.avx512cd = Common::Bit<28>(cpu_id[1]);
+ caps.avx512bw = Common::Bit<30>(cpu_id[1]);
+ caps.avx512vl = Common::Bit<31>(cpu_id[1]);
+ caps.avx512vbmi = Common::Bit<1>(cpu_id[2]);
+ caps.avx512bitalg = Common::Bit<12>(cpu_id[2]);
+ }
+
caps.bmi1 = Common::Bit<3>(cpu_id[1]);
caps.bmi2 = Common::Bit<8>(cpu_id[1]);
- // Checks for AVX512F, AVX512CD, AVX512VL, AVX512DQ, AVX512BW (Intel Skylake-X/SP)
- if (Common::Bit<16>(cpu_id[1]) && Common::Bit<28>(cpu_id[1]) &&
- Common::Bit<31>(cpu_id[1]) && Common::Bit<17>(cpu_id[1]) &&
- Common::Bit<30>(cpu_id[1])) {
- caps.avx512 = caps.avx2;
- }
+ caps.sha = Common::Bit<29>(cpu_id[1]);
+
+ caps.gfni = Common::Bit<8>(cpu_id[2]);
+
+ __cpuidex(cpu_id, 0x00000007, 0x00000001);
+ caps.avx_vnni = caps.avx && Common::Bit<4>(cpu_id[0]);
}
}
diff --git a/src/common/x64/cpu_detect.h b/src/common/x64/cpu_detect.h
index 3e6d808f3..40c48b132 100644
--- a/src/common/x64/cpu_detect.h
+++ b/src/common/x64/cpu_detect.h
@@ -35,16 +35,31 @@ struct CPUCaps {
bool ssse3 : 1;
bool sse4_1 : 1;
bool sse4_2 : 1;
- bool lzcnt : 1;
+
bool avx : 1;
+ bool avx_vnni : 1;
bool avx2 : 1;
- bool avx512 : 1;
+ bool avx512f : 1;
+ bool avx512dq : 1;
+ bool avx512cd : 1;
+ bool avx512bw : 1;
+ bool avx512vl : 1;
+ bool avx512vbmi : 1;
+ bool avx512bitalg : 1;
+
+ bool aes : 1;
bool bmi1 : 1;
bool bmi2 : 1;
+ bool f16c : 1;
bool fma : 1;
bool fma4 : 1;
- bool aes : 1;
+ bool gfni : 1;
bool invariant_tsc : 1;
+ bool lzcnt : 1;
+ bool movbe : 1;
+ bool pclmulqdq : 1;
+ bool popcnt : 1;
+ bool sha : 1;
};
/**