Mercurial > mplayer.hg
annotate cpudetect.h @ 28921:62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
directly instead of CAN_COMPILE_X86_ASM.
author | diego |
---|---|
date | Sun, 15 Mar 2009 10:01:02 +0000 |
parents | e1b7d9bf263b |
children | ce682f8d1f68 |
rev | line source |
---|---|
26029 | 1 #ifndef MPLAYER_CPUDETECT_H |
2 #define MPLAYER_CPUDETECT_H | |
2268
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
3 |
28629
b089d639e810
Add necessary header for ARCH_X86_64 preprocessor check.
diego
parents:
28288
diff
changeset
|
4 #include "config.h" |
b089d639e810
Add necessary header for ARCH_X86_64 preprocessor check.
diego
parents:
28288
diff
changeset
|
5 |
2281 | 6 #define CPUTYPE_I386 3 |
7 #define CPUTYPE_I486 4 | |
8 #define CPUTYPE_I586 5 | |
9 #define CPUTYPE_I686 6 | |
2268
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
10 |
28288
3ec634fbcd27
Fix first handful of #if vs. #ifdef for ARCH_, HAVE_SSE etc.
reimar
parents:
27926
diff
changeset
|
11 #if ARCH_X86_64 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
12 # define REGa rax |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
13 # define REGb rbx |
18391 | 14 # define REGBP rbp |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
15 # define REGSP rsp |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
16 # define REG_a "rax" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
17 # define REG_b "rbx" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
18 # define REG_c "rcx" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
19 # define REG_d "rdx" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
20 # define REG_S "rsi" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
21 # define REG_D "rdi" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
22 # define REG_SP "rsp" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
23 # define REG_BP "rbp" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
24 #else |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
25 # define REGa eax |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
26 # define REGb ebx |
18391 | 27 # define REGBP ebp |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
28 # define REGSP esp |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
29 # define REG_a "eax" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
30 # define REG_b "ebx" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
31 # define REG_c "ecx" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
32 # define REG_d "edx" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
33 # define REG_S "esi" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
34 # define REG_D "edi" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
35 # define REG_SP "esp" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
36 # define REG_BP "ebp" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
37 #endif |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10885
diff
changeset
|
38 |
2268
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
39 typedef struct cpucaps_s { |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
40 int cpuType; |
18538
739849dfb699
Retrieve CPU built-in namestring, and if it exists, print it during cpu detection; t it doesn't exist, fallback to the cpu table. Patch by Zuxy Meng
gpoirier
parents:
18391
diff
changeset
|
41 int cpuModel; |
3403 | 42 int cpuStepping; |
2268
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
43 int hasMMX; |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
44 int hasMMX2; |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
45 int has3DNow; |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
46 int has3DNowExt; |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
47 int hasSSE; |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
48 int hasSSE2; |
28901
e1b7d9bf263b
SSE3 support patch by Zhou Zongyi, zhouzongyi pset.suntec net
diego
parents:
28629
diff
changeset
|
49 int hasSSE3; |
27926
a02c39208d49
Add detection of x86 CPU features SSSE3 and SSE4a.
gpoirier
parents:
26029
diff
changeset
|
50 int hasSSSE3; |
a02c39208d49
Add detection of x86 CPU features SSSE3 and SSE4a.
gpoirier
parents:
26029
diff
changeset
|
51 int hasSSE4a; |
3146
3164eaa93396
non x86 fix (otherwise we would need #ifdef ARCH_X86 around every if(gCpuCaps.has...))
michael
parents:
2303
diff
changeset
|
52 int isX86; |
8860 | 53 unsigned cl_size; /* size of cache line */ |
9003 | 54 int hasAltiVec; |
10885
685c416f12b5
cpuspeed detection for X86 TSC capable CPUs (also added TSC detection, should best be verified by some people with TSC/nonTSC capable CPUs)
atmos4
parents:
9003
diff
changeset
|
55 int hasTSC; |
2268
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
56 } CpuCaps; |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
57 |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
58 extern CpuCaps gCpuCaps; |
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
59 |
2301 | 60 void GetCpuCaps(CpuCaps *caps); |
2303 | 61 |
62 /* returned value is malloc()'ed so free() it after use */ | |
2301 | 63 char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]); |
2268
72ff2179d396
cpu detect code by Eric Anholt <eanholt@gladstone.uoregon.edu>
arpi
parents:
diff
changeset
|
64 |
26029 | 65 #endif /* MPLAYER_CPUDETECT_H */ |