Merge branch 'master' into gallium-0.2
[mesa.git] / src / gallium / auxiliary / util / u_cpu_detect.h
1 /**************************************************************************
2 *
3 * Copyright 2008 Dennis Smit
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * on the rights to use, copy, modify, merge, publish, distribute, sub
10 * license, and/or sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 ***************************************************************************/
26
27 /*
28 * Based on the work of Eric Anholt <anholt@FreeBSD.org>
29 */
30
31 #ifndef _CPU_DETECT_H
32 #define _CPU_DETECT_H
33
34 typedef enum {
35 CPU_DETECT_TYPE_MIPS,
36 CPU_DETECT_TYPE_ALPHA,
37 CPU_DETECT_TYPE_SPARC,
38 CPU_DETECT_TYPE_X86,
39 CPU_DETECT_TYPE_POWERPC,
40 CPU_DETECT_TYPE_OTHER
41 } cpu_detect_type;
42
43 struct cpu_detect_caps {
44 cpu_detect_type type;
45 int nrcpu;
46
47 /* Feature flags */
48 int x86cpuType;
49 int cacheline;
50
51 int hasTSC;
52 int hasMMX;
53 int hasMMX2;
54 int hasSSE;
55 int hasSSE2;
56 int hasSSE3;
57 int hasSSSE3;
58 int has3DNow;
59 int has3DNowExt;
60 int hasAltiVec;
61 };
62
63 /* prototypes */
64 void cpu_detect_initialize(void);
65 struct cpu_detect_caps *cpu_detect_get_caps(void);
66
67 int cpu_detect_get_tsc(void);
68 int cpu_detect_get_mmx(void);
69 int cpu_detect_get_mmx2(void);
70 int cpu_detect_get_sse(void);
71 int cpu_detect_get_sse2(void);
72 int cpu_detect_get_sse3(void);
73 int cpu_detect_get_ssse3(void);
74 int cpu_detect_get_3dnow(void);
75 int cpu_detect_get_3dnow2(void);
76 int cpu_detect_get_altivec(void);
77
78 #endif /* _CPU_DETECT_H */