diff options
Diffstat (limited to 'src/common/x64/cpu_detect.cpp')
| -rw-r--r-- | src/common/x64/cpu_detect.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp index 370ae2c80..2cb3ab9cc 100644 --- a/src/common/x64/cpu_detect.cpp +++ b/src/common/x64/cpu_detect.cpp | |||
| @@ -8,9 +8,9 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "cpu_detect.h" | 9 | #include "cpu_detect.h" |
| 10 | 10 | ||
| 11 | namespace Common { | 11 | #ifdef _MSC_VER |
| 12 | 12 | #include <intrin.h> | |
| 13 | #ifndef _MSC_VER | 13 | #else |
| 14 | 14 | ||
| 15 | #if defined(__DragonFly__) || defined(__FreeBSD__) | 15 | #if defined(__DragonFly__) || defined(__FreeBSD__) |
| 16 | // clang-format off | 16 | // clang-format off |
| @@ -37,13 +37,15 @@ static inline void __cpuid(int info[4], int function_id) { | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | #define _XCR_XFEATURE_ENABLED_MASK 0 | 39 | #define _XCR_XFEATURE_ENABLED_MASK 0 |
| 40 | static u64 _xgetbv(u32 index) { | 40 | static inline u64 _xgetbv(u32 index) { |
| 41 | u32 eax, edx; | 41 | u32 eax, edx; |
| 42 | __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index)); | 42 | __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index)); |
| 43 | return ((u64)edx << 32) | eax; | 43 | return ((u64)edx << 32) | eax; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | #endif // ifndef _MSC_VER | 46 | #endif // _MSC_VER |
| 47 | |||
| 48 | namespace Common { | ||
| 47 | 49 | ||
| 48 | // Detects the various CPU features | 50 | // Detects the various CPU features |
| 49 | static CPUCaps Detect() { | 51 | static CPUCaps Detect() { |