Simplify weird code. ;)
[mplayer/glamo.git] / cpudetect.h
blob997ec11195e86aa05a0cba04ab5bb584d678951f
1 #ifndef CPUDETECT_H
2 #define CPUDETECT_H
4 #define CPUTYPE_I386 3
5 #define CPUTYPE_I486 4
6 #define CPUTYPE_I586 5
7 #define CPUTYPE_I686 6
9 #ifdef ARCH_X86_64
10 # define REGa rax
11 # define REGb rbx
12 # define REGSP rsp
13 # define REG_a "rax"
14 # define REG_b "rbx"
15 # define REG_c "rcx"
16 # define REG_d "rdx"
17 # define REG_S "rsi"
18 # define REG_D "rdi"
19 # define REG_SP "rsp"
20 # define REG_BP "rbp"
21 #else
22 # define REGa eax
23 # define REGb ebx
24 # define REGSP esp
25 # define REG_a "eax"
26 # define REG_b "ebx"
27 # define REG_c "ecx"
28 # define REG_d "edx"
29 # define REG_S "esi"
30 # define REG_D "edi"
31 # define REG_SP "esp"
32 # define REG_BP "ebp"
33 #endif
35 typedef struct cpucaps_s {
36 int cpuType;
37 int cpuStepping;
38 int hasMMX;
39 int hasMMX2;
40 int has3DNow;
41 int has3DNowExt;
42 int hasSSE;
43 int hasSSE2;
44 int isX86;
45 unsigned cl_size; /* size of cache line */
46 int hasAltiVec;
47 int hasTSC;
48 } CpuCaps;
50 extern CpuCaps gCpuCaps;
52 void GetCpuCaps(CpuCaps *caps);
54 /* returned value is malloc()'ed so free() it after use */
55 char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]);
57 #endif /* !CPUDETECT_H */