annotate src/cpuinfo/SDL_cpuinfo.c @ 747:da36f59485da

Check for CPUID before checking for 3DNow!
author Sam Lantinga <slouken@libsdl.org>
date Mon, 24 Nov 2003 09:30:14 +0000
parents 71ee03909f42
children 06cdd106d61c
rev   line source
739
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Library General Public License for more details.
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #ifdef SAVE_RCSID
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 static char rcsid =
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 "@(#) $Id$";
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #endif
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 /* CPU feature detection for SDL */
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include "SDL.h"
745
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
31 #include "SDL_cpuinfo.h"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
32
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
33 #define CPU_HAS_RDTSC 0x00000001
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
34 #define CPU_HAS_MMX 0x00000002
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
35 #define CPU_HAS_3DNOW 0x00000004
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
36 #define CPU_HAS_SSE 0x00000008
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
37
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
38 static __inline__ int CPU_haveCPUID()
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
39 {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
40 int has_CPUID = 0;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
41 #if defined(__GNUC__) && defined(i386)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
42 __asm__ (
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
43 "push %%ecx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
44 " pushfl # Get original EFLAGS \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
45 " popl %%eax \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
46 " movl %%eax,%%ecx \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
47 " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
48 " pushl %%eax # Save new EFLAGS value on stack \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
49 " popfl # Replace current EFLAGS value \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
50 " pushfl # Get new EFLAGS \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
51 " popl %%eax # Store new EFLAGS in EAX \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
52 " xorl %%ecx,%%eax # Can not toggle ID bit, \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
53 " jz 1f # Processor=80486 \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
54 " movl $1,%0 # We have CPUID support \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
55 "1: \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
56 "pop %%ecx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
57 : "=r" (has_CPUID)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
58 :
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
59 : "%eax", "%ecx"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
60 );
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
61 #elif defined(_MSC_VER)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
62 __asm__ {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
63 pushfd ; Get original EFLAGS
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
64 pop eax
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
65 mov ecx, eax
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
66 xor eax, 200000h ; Flip ID bit in EFLAGS
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
67 push eax ; Save new EFLAGS value on stack
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
68 popfd ; Replace current EFLAGS value
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
69 pushfd ; Get new EFLAGS
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
70 pop eax ; Store new EFLAGS in EAX
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
71 xor eax, ecx ; Can not toggle ID bit,
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
72 jz done ; Processor=80486
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
73 mov has_CPUID,1 ; We have CPUID support
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
74 done:
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
75 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
76 #endif
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
77 return has_CPUID;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
78 }
739
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79
745
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
80 static __inline__ int CPU_getCPUIDFeatures()
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
81 {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
82 int features = 0;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
83 #if defined(__GNUC__) && defined(i386)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
84 __asm__ (
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
85 "push %%ebx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
86 "push %%ecx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
87 "push %%edx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
88 " xorl %%eax,%%eax # Set up for CPUID instruction \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
89 " cpuid # Get and save vendor ID \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
90 " cmpl $1,%%eax # Make sure 1 is valid input for CPUID\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
91 " jl 1f # We dont have the CPUID instruction\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
92 " xorl %%eax,%%eax \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
93 " incl %%eax \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
94 " cpuid # Get family/model/stepping/features\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
95 " movl %%edx,%0 \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
96 "1: \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
97 "pop %%edx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
98 "pop %%ecx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
99 "pop %%ebx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
100 : "=r" (features)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
101 :
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
102 : "%eax", "%ebx", "%ecx", "%edx"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
103 );
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
104 #elif defined(_MSC_VER)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
105 __asm__ {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
106 xor eax, eax ; Set up for CPUID instruction
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
107 cpuid ; Get and save vendor ID
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
108 cmp eax, 1 ; Make sure 1 is valid input for CPUID
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
109 jl done ; We dont have the CPUID instruction
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
110 xor eax, eax
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
111 inc eax
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
112 cpuid ; Get family/model/stepping/features
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
113 mov features, edx
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
114 done:
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
115 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
116 #endif
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
117 return features;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
118 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
119
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
120 static __inline__ int CPU_haveRDTSC()
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
121 {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
122 if ( CPU_haveCPUID() ) {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
123 return (CPU_getCPUIDFeatures() & 0x00000010);
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
124 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
125 return 0;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
126 }
739
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
745
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
128 static __inline__ int CPU_haveMMX()
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
129 {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
130 if ( CPU_haveCPUID() ) {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
131 return (CPU_getCPUIDFeatures() & 0x00800000);
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
132 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
133 return 0;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
134 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
135
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
136 static __inline__ int CPU_have3DNow()
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
137 {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
138 int has_3DNow = 0;
747
da36f59485da Check for CPUID before checking for 3DNow!
Sam Lantinga <slouken@libsdl.org>
parents: 745
diff changeset
139 if ( !CPU_haveCPUID() ) {
da36f59485da Check for CPUID before checking for 3DNow!
Sam Lantinga <slouken@libsdl.org>
parents: 745
diff changeset
140 return 0;
da36f59485da Check for CPUID before checking for 3DNow!
Sam Lantinga <slouken@libsdl.org>
parents: 745
diff changeset
141 }
745
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
142 #if defined(__GNUC__) && defined(i386)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
143 __asm__ (
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
144 "push %%ebx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
145 "push %%ecx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
146 "push %%edx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
147 " movl $0x80000000,%%eax # Query for extended functions \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
148 " cpuid # Get extended function limit \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
149 " cmpl $0x80000001,%%eax \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
150 " jbe 1f # Nope, we dont have function 800000001h\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
151 " movl $0x80000001,%%eax # Setup extended function 800000001h\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
152 " cpuid # and get the information \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
153 " testl $0x80000000,%%edx # Bit 31 is set if 3DNow! present \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
154 " jz 1f # Nope, we dont have 3DNow support\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
155 " movl $1,%0 # Yep, we have 3DNow! support! \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
156 "1: \n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
157 "pop %%edx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
158 "pop %%ecx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
159 "pop %%ebx\n"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
160 : "=r" (has_3DNow)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
161 :
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
162 : "%eax", "%ebx", "%ecx", "%edx"
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
163 );
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
164 #elif defined(_MSC_VER)
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
165 __asm__ {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
166 mov eax,80000000h ; Query for extended functions
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
167 cpuid ; Get extended function limit
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
168 cmp eax,80000001h
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
169 jbe done ; Nope, we dont have function 800000001h
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
170 mov eax,80000001h ; Setup extended function 800000001h
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
171 cpuid ; and get the information
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
172 test edx,80000000h ; Bit 31 is set if 3DNow! present
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
173 jz done ; Nope, we dont have 3DNow support
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
174 mov has_3DNow,1 ; Yep, we have 3DNow! support!
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
175 done:
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
176 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
177 #endif
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
178 return has_3DNow;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
179 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
180
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
181 static __inline__ int CPU_haveSSE()
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
182 {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
183 if ( CPU_haveCPUID() ) {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
184 return (CPU_getCPUIDFeatures() & 0x02000000);
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
185 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
186 return 0;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
187 }
739
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 static Uint32 SDL_CPUFeatures = 0xFFFFFFFF;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 static Uint32 SDL_GetCPUFeatures()
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 if ( SDL_CPUFeatures == 0xFFFFFFFF ) {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 SDL_CPUFeatures = 0;
745
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
195 if ( CPU_haveRDTSC() ) {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
196 SDL_CPUFeatures |= CPU_HAS_RDTSC;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
197 }
739
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 if ( CPU_haveMMX() ) {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 SDL_CPUFeatures |= CPU_HAS_MMX;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 if ( CPU_have3DNow() ) {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 SDL_CPUFeatures |= CPU_HAS_3DNOW;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 if ( CPU_haveSSE() ) {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 SDL_CPUFeatures |= CPU_HAS_SSE;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 return SDL_CPUFeatures;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210
745
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
211 SDL_bool SDL_HasRDTSC()
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
212 {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
213 if ( SDL_GetCPUFeatures() & CPU_HAS_RDTSC ) {
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
214 return SDL_TRUE;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
215 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
216 return SDL_FALSE;
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
217 }
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
218
739
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 SDL_bool SDL_HasMMX()
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 if ( SDL_GetCPUFeatures() & CPU_HAS_MMX ) {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 return SDL_TRUE;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 return SDL_FALSE;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 SDL_bool SDL_Has3DNow()
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 if ( SDL_GetCPUFeatures() & CPU_HAS_3DNOW ) {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 return SDL_TRUE;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 return SDL_FALSE;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 SDL_bool SDL_HasSSE()
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 if ( SDL_GetCPUFeatures() & CPU_HAS_SSE ) {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 return SDL_TRUE;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 return SDL_FALSE;
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 #ifdef TEST_MAIN
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 #include <stdio.h>
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 int main()
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 {
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 printf("MMX: %d\n", SDL_HasMMX());
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 printf("3DNow: %d\n", SDL_Has3DNow());
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 printf("SSE: %d\n", SDL_HasSSE());
745
71ee03909f42 Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 739
diff changeset
252 return 0;
739
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 }
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254
22dbf364c017 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 #endif /* TEST_MAIN */