diff options
Diffstat (limited to 'src/common/x64/cpu_detect.cpp')
| -rw-r--r-- | src/common/x64/cpu_detect.cpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp index 2dfcd39c8..c9349a6b4 100644 --- a/src/common/x64/cpu_detect.cpp +++ b/src/common/x64/cpu_detect.cpp | |||
| @@ -3,8 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | #include <string> | ||
| 7 | #include <thread> | ||
| 8 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 9 | #include "common/x64/cpu_detect.h" | 7 | #include "common/x64/cpu_detect.h" |
| 10 | 8 | ||
| @@ -51,8 +49,6 @@ namespace Common { | |||
| 51 | static CPUCaps Detect() { | 49 | static CPUCaps Detect() { |
| 52 | CPUCaps caps = {}; | 50 | CPUCaps caps = {}; |
| 53 | 51 | ||
| 54 | caps.num_cores = std::thread::hardware_concurrency(); | ||
| 55 | |||
| 56 | // Assumes the CPU supports the CPUID instruction. Those that don't would likely not support | 52 | // Assumes the CPU supports the CPUID instruction. Those that don't would likely not support |
| 57 | // yuzu at all anyway | 53 | // yuzu at all anyway |
| 58 | 54 | ||
| @@ -70,12 +66,6 @@ static CPUCaps Detect() { | |||
| 70 | __cpuid(cpu_id, 0x80000000); | 66 | __cpuid(cpu_id, 0x80000000); |
| 71 | 67 | ||
| 72 | u32 max_ex_fn = cpu_id[0]; | 68 | u32 max_ex_fn = cpu_id[0]; |
| 73 | if (!strcmp(caps.brand_string, "GenuineIntel")) | ||
| 74 | caps.vendor = CPUVendor::INTEL; | ||
| 75 | else if (!strcmp(caps.brand_string, "AuthenticAMD")) | ||
| 76 | caps.vendor = CPUVendor::AMD; | ||
| 77 | else | ||
| 78 | caps.vendor = CPUVendor::OTHER; | ||
| 79 | 69 | ||
| 80 | // Set reasonable default brand string even if brand string not available | 70 | // Set reasonable default brand string even if brand string not available |
| 81 | strcpy(caps.cpu_string, caps.brand_string); | 71 | strcpy(caps.cpu_string, caps.brand_string); |
| @@ -96,15 +86,9 @@ static CPUCaps Detect() { | |||
| 96 | caps.sse4_1 = true; | 86 | caps.sse4_1 = true; |
| 97 | if ((cpu_id[2] >> 20) & 1) | 87 | if ((cpu_id[2] >> 20) & 1) |
| 98 | caps.sse4_2 = true; | 88 | caps.sse4_2 = true; |
| 99 | if ((cpu_id[2] >> 22) & 1) | ||
| 100 | caps.movbe = true; | ||
| 101 | if ((cpu_id[2] >> 25) & 1) | 89 | if ((cpu_id[2] >> 25) & 1) |
| 102 | caps.aes = true; | 90 | caps.aes = true; |
| 103 | 91 | ||
| 104 | if ((cpu_id[3] >> 24) & 1) { | ||
| 105 | caps.fxsave_fxrstor = true; | ||
| 106 | } | ||
| 107 | |||
| 108 | // AVX support requires 3 separate checks: | 92 | // AVX support requires 3 separate checks: |
| 109 | // - Is the AVX bit set in CPUID? | 93 | // - Is the AVX bit set in CPUID? |
| 110 | // - Is the XSAVE bit set in CPUID? | 94 | // - Is the XSAVE bit set in CPUID? |
| @@ -129,8 +113,6 @@ static CPUCaps Detect() { | |||
| 129 | } | 113 | } |
| 130 | } | 114 | } |
| 131 | 115 | ||
| 132 | caps.flush_to_zero = caps.sse; | ||
| 133 | |||
| 134 | if (max_ex_fn >= 0x80000004) { | 116 | if (max_ex_fn >= 0x80000004) { |
| 135 | // Extract CPU model string | 117 | // Extract CPU model string |
| 136 | __cpuid(cpu_id, 0x80000002); | 118 | __cpuid(cpu_id, 0x80000002); |
| @@ -144,14 +126,8 @@ static CPUCaps Detect() { | |||
| 144 | if (max_ex_fn >= 0x80000001) { | 126 | if (max_ex_fn >= 0x80000001) { |
| 145 | // Check for more features | 127 | // Check for more features |
| 146 | __cpuid(cpu_id, 0x80000001); | 128 | __cpuid(cpu_id, 0x80000001); |
| 147 | if (cpu_id[2] & 1) | ||
| 148 | caps.lahf_sahf_64 = true; | ||
| 149 | if ((cpu_id[2] >> 5) & 1) | ||
| 150 | caps.lzcnt = true; | ||
| 151 | if ((cpu_id[2] >> 16) & 1) | 129 | if ((cpu_id[2] >> 16) & 1) |
| 152 | caps.fma4 = true; | 130 | caps.fma4 = true; |
| 153 | if ((cpu_id[3] >> 29) & 1) | ||
| 154 | caps.long_mode = true; | ||
| 155 | } | 131 | } |
| 156 | 132 | ||
| 157 | return caps; | 133 | return caps; |
| @@ -162,48 +138,4 @@ const CPUCaps& GetCPUCaps() { | |||
| 162 | return caps; | 138 | return caps; |
| 163 | } | 139 | } |
| 164 | 140 | ||
| 165 | std::string GetCPUCapsString() { | ||
| 166 | auto caps = GetCPUCaps(); | ||
| 167 | |||
| 168 | std::string sum(caps.cpu_string); | ||
| 169 | sum += " ("; | ||
| 170 | sum += caps.brand_string; | ||
| 171 | sum += ")"; | ||
| 172 | |||
| 173 | if (caps.sse) | ||
| 174 | sum += ", SSE"; | ||
| 175 | if (caps.sse2) { | ||
| 176 | sum += ", SSE2"; | ||
| 177 | if (!caps.flush_to_zero) | ||
| 178 | sum += " (without DAZ)"; | ||
| 179 | } | ||
| 180 | |||
| 181 | if (caps.sse3) | ||
| 182 | sum += ", SSE3"; | ||
| 183 | if (caps.ssse3) | ||
| 184 | sum += ", SSSE3"; | ||
| 185 | if (caps.sse4_1) | ||
| 186 | sum += ", SSE4.1"; | ||
| 187 | if (caps.sse4_2) | ||
| 188 | sum += ", SSE4.2"; | ||
| 189 | if (caps.avx) | ||
| 190 | sum += ", AVX"; | ||
| 191 | if (caps.avx2) | ||
| 192 | sum += ", AVX2"; | ||
| 193 | if (caps.bmi1) | ||
| 194 | sum += ", BMI1"; | ||
| 195 | if (caps.bmi2) | ||
| 196 | sum += ", BMI2"; | ||
| 197 | if (caps.fma) | ||
| 198 | sum += ", FMA"; | ||
| 199 | if (caps.aes) | ||
| 200 | sum += ", AES"; | ||
| 201 | if (caps.movbe) | ||
| 202 | sum += ", MOVBE"; | ||
| 203 | if (caps.long_mode) | ||
| 204 | sum += ", 64-bit support"; | ||
| 205 | |||
| 206 | return sum; | ||
| 207 | } | ||
| 208 | |||
| 209 | } // namespace Common | 141 | } // namespace Common |