]>
Commit | Line | Data |
---|---|---|
0c1f3509 MG |
1 | #include "cpusupport.h" |
2 | ||
3 | #ifdef CPUSUPPORT_X86_CPUID | |
4 | #include <cpuid.h> | |
5 | ||
6 | #define CPUID_SSE2_BIT (1 << 26) | |
7 | #endif | |
8 | ||
9 | CPUSUPPORT_FEATURE_DECL(x86, sse2) | |
10 | { | |
11 | #ifdef CPUSUPPORT_X86_CPUID | |
12 | unsigned int eax, ebx, ecx, edx; | |
13 | ||
14 | /* Check if CPUID supports the level we need. */ | |
15 | if (!__get_cpuid(0, &eax, &ebx, &ecx, &edx)) | |
16 | goto unsupported; | |
17 | if (eax < 1) | |
18 | goto unsupported; | |
19 | ||
20 | /* Ask about CPU features. */ | |
21 | if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx)) | |
22 | goto unsupported; | |
23 | ||
24 | /* Return the relevant feature bit. */ | |
25 | return ((edx & CPUID_SSE2_BIT) ? 1 : 0); | |
26 | ||
27 | unsupported: | |
28 | #endif | |
29 | return (0); | |
30 | } |