summaryrefslogtreecommitdiff
path: root/compat/cpuid.h
blob: 7709e35286d262945feb2ccedc08a3af6e96d19a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef COMPAT_CPUID_H
#define COMPAT_CPUID_H

#if (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
#include <cpuid.h>
#define CPUID_SSE42_BIT (1 << 20)

static int processor_supports_sse42(void)
{
	unsigned eax, ebx, ecx, edx;
	__cpuid(1, eax, ebx, ecx, edx);
	return ecx & CPUID_SSE42_BIT;
}

#else

static int processor_supports_sse42(void)
{
	/* TODO: handle CPUID on non-GCC compilers */
	return 0;
}

#endif

#endif /* COMPAT_CPUID_H */