Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
[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 * @file
29 * CPU feature detection.
30 *
31 * @author Dennis Smit
32 * @author Based on the work of Eric Anholt <anholt@FreeBSD.org>
33 */
34
35 #ifndef _UTIL_CPU_DETECT_H
36 #define _UTIL_CPU_DETECT_H
37
38 #include "pipe/p_compiler.h"
39
40 enum util_cpu_arch {
41 UTIL_CPU_ARCH_UNKNOWN = 0,
42 UTIL_CPU_ARCH_MIPS,
43 UTIL_CPU_ARCH_ALPHA,
44 UTIL_CPU_ARCH_SPARC,
45 UTIL_CPU_ARCH_X86,
46 UTIL_CPU_ARCH_POWERPC
47 };
48
49 struct util_cpu_caps {
50 enum util_cpu_arch arch;
51 unsigned nr_cpus;
52
53 /* Feature flags */
54 int x86_cpu_type;
55 unsigned cacheline;
56
57 unsigned little_endian:1;
58
59 unsigned has_tsc:1;
60 unsigned has_mmx:1;
61 unsigned has_mmx2:1;
62 unsigned has_sse:1;
63 unsigned has_sse2:1;
64 unsigned has_sse3:1;
65 unsigned has_ssse3:1;
66 unsigned has_sse4_1:1;
67 unsigned has_3dnow:1;
68 unsigned has_3dnow_ext:1;
69 unsigned has_altivec:1;
70 };
71
72 extern struct util_cpu_caps
73 util_cpu_caps;
74
75 void util_cpu_detect(void);
76
77
78 #endif /* _UTIL_CPU_DETECT_H */