1 | /*************************************************************************** |
---|
2 | * Copyright (C) 2005 by Prakash Punnoor * |
---|
3 | * prakash@punnoor.de * |
---|
4 | * * |
---|
5 | * This program is free software; you can redistribute it and/or modify * |
---|
6 | * it under the terms of the GNU Library General Public License as * |
---|
7 | * published by the Free Software Foundation; either version 2 of the * |
---|
8 | * License, or (at your option) any later version. * |
---|
9 | * * |
---|
10 | * This program is distributed in the hope that it will be useful, * |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
13 | * GNU General Public License for more details. * |
---|
14 | * * |
---|
15 | * You should have received a copy of the GNU Library General Public * |
---|
16 | * License along with this program; if not, write to the * |
---|
17 | * Free Software Foundation, Inc., * |
---|
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
---|
19 | ***************************************************************************/ |
---|
20 | #ifndef X86_CPU_CAPS_H |
---|
21 | #define X86_CPU_CAPS_H |
---|
22 | |
---|
23 | struct x86cpu_caps_s { |
---|
24 | int mmx; |
---|
25 | int sse; |
---|
26 | int sse2; |
---|
27 | int sse3; |
---|
28 | int amd_3dnow; |
---|
29 | int amd_3dnowext; |
---|
30 | int amd_sse_mmx; |
---|
31 | int cyrix_mmxext; |
---|
32 | }; |
---|
33 | |
---|
34 | extern struct x86cpu_caps_s x86cpu_caps; |
---|
35 | extern struct x86cpu_caps_s x86cpu_caps_use; |
---|
36 | |
---|
37 | static __inline int _alHaveMMX(void); |
---|
38 | static __inline int _alHaveSSE(void); |
---|
39 | static __inline int _alHaveSSE2(void); |
---|
40 | static __inline int _alHaveSSE3(void); |
---|
41 | static __inline int _alHave3DNOW(void); |
---|
42 | static __inline int _alHave3DNOWEXT(void); |
---|
43 | static __inline int _alHaveSSEMMX(void); |
---|
44 | |
---|
45 | |
---|
46 | static __inline int _alHaveMMX(void) |
---|
47 | { |
---|
48 | return x86cpu_caps.mmx & x86cpu_caps_use.mmx; |
---|
49 | } |
---|
50 | |
---|
51 | static __inline int _alHaveSSE(void) |
---|
52 | { |
---|
53 | return x86cpu_caps.sse & x86cpu_caps_use.sse; |
---|
54 | } |
---|
55 | |
---|
56 | static __inline int _alHaveSSE2(void) |
---|
57 | { |
---|
58 | return x86cpu_caps.sse2 & x86cpu_caps_use.sse2; |
---|
59 | } |
---|
60 | |
---|
61 | static __inline int _alHaveSSE3(void) |
---|
62 | { |
---|
63 | return x86cpu_caps.sse3 & x86cpu_caps_use.sse3; |
---|
64 | } |
---|
65 | |
---|
66 | static __inline int _alHave3DNOW(void) |
---|
67 | { |
---|
68 | return x86cpu_caps.amd_3dnow & x86cpu_caps_use.amd_3dnow; |
---|
69 | } |
---|
70 | |
---|
71 | static __inline int _alHave3DNOWEXT(void) |
---|
72 | { |
---|
73 | return x86cpu_caps.amd_3dnowext & x86cpu_caps_use.amd_3dnowext; |
---|
74 | } |
---|
75 | |
---|
76 | static __inline int _alHaveSSEMMX(void) |
---|
77 | { |
---|
78 | return x86cpu_caps.amd_sse_mmx & x86cpu_caps_use.amd_sse_mmx; |
---|
79 | } |
---|
80 | |
---|
81 | #endif /* X86_CPU_CAPS_H */ |
---|