src/cpuinfo/SDL_cpuinfo.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 Feb 2006 10:11:48 +0000
changeset 1361 19418e4422cb
parent 1312 c9b51268668f
child 1402 d910939febfa
permissions -rw-r--r--
New configure-based build system. Still work in progress, but much improved
slouken@739
     1
/*
slouken@739
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@739
     4
slouken@739
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@739
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@739
     9
slouken@739
    10
    This library is distributed in the hope that it will be useful,
slouken@739
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@739
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@739
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@739
    18
slouken@739
    19
    Sam Lantinga
slouken@739
    20
    slouken@libsdl.org
slouken@739
    21
*/
slouken@739
    22
slouken@739
    23
/* CPU feature detection for SDL */
slouken@739
    24
slouken@1361
    25
#include "SDL.h"
slouken@1361
    26
#include "SDL_cpuinfo.h"
slouken@1361
    27
slouken@1361
    28
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
slouken@793
    29
#include <signal.h>
slouken@793
    30
#include <setjmp.h>
slouken@793
    31
#endif
slouken@793
    32
slouken@1361
    33
#if MACOSX
slouken@778
    34
#include <sys/sysctl.h> /* For AltiVec check */
slouken@778
    35
#endif
slouken@778
    36
slouken@745
    37
#define CPU_HAS_RDTSC	0x00000001
slouken@745
    38
#define CPU_HAS_MMX	0x00000002
slouken@785
    39
#define CPU_HAS_MMXEXT	0x00000004
slouken@785
    40
#define CPU_HAS_3DNOW	0x00000010
slouken@785
    41
#define CPU_HAS_3DNOWEXT 0x00000020
slouken@785
    42
#define CPU_HAS_SSE	0x00000040
slouken@785
    43
#define CPU_HAS_SSE2	0x00000080
slouken@785
    44
#define CPU_HAS_ALTIVEC	0x00000100
slouken@739
    45
slouken@1361
    46
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
slouken@793
    47
/* This is the brute force way of detecting instruction sets...
slouken@793
    48
   the idea is borrowed from the libmpeg2 library - thanks!
slouken@793
    49
 */
slouken@793
    50
static jmp_buf jmpbuf;
slouken@793
    51
static void illegal_instruction(int sig)
slouken@793
    52
{
slouken@793
    53
	longjmp(jmpbuf, 1);
slouken@793
    54
}
slouken@1361
    55
#endif /* HAVE_SETJMP */
slouken@793
    56
slouken@745
    57
static __inline__ int CPU_haveCPUID()
slouken@745
    58
{
slouken@745
    59
	int has_CPUID = 0;
slouken@745
    60
#if defined(__GNUC__) && defined(i386)
slouken@745
    61
	__asm__ (
slouken@745
    62
"        pushfl                      # Get original EFLAGS             \n"
slouken@745
    63
"        popl    %%eax                                                 \n"
slouken@745
    64
"        movl    %%eax,%%ecx                                           \n"
slouken@745
    65
"        xorl    $0x200000,%%eax     # Flip ID bit in EFLAGS           \n"
slouken@745
    66
"        pushl   %%eax               # Save new EFLAGS value on stack  \n"
slouken@745
    67
"        popfl                       # Replace current EFLAGS value    \n"
slouken@745
    68
"        pushfl                      # Get new EFLAGS                  \n"
slouken@745
    69
"        popl    %%eax               # Store new EFLAGS in EAX         \n"
slouken@745
    70
"        xorl    %%ecx,%%eax         # Can not toggle ID bit,          \n"
slouken@745
    71
"        jz      1f                  # Processor=80486                 \n"
slouken@745
    72
"        movl    $1,%0               # We have CPUID support           \n"
slouken@745
    73
"1:                                                                    \n"
slouken@784
    74
	: "=m" (has_CPUID)
slouken@745
    75
	:
slouken@745
    76
	: "%eax", "%ecx"
slouken@745
    77
	);
slouken@881
    78
#elif defined(__GNUC__) && defined(__x86_64__)
slouken@881
    79
/* Technically, if this is being compiled under __x86_64__ then it has 
slouken@881
    80
CPUid by definition.  But it's nice to be able to prove it.  :)      */
slouken@881
    81
	__asm__ (
slouken@881
    82
"        pushfq                      # Get original EFLAGS             \n"
slouken@881
    83
"        popq    %%rax                                                 \n"
slouken@881
    84
"        movq    %%rax,%%rcx                                           \n"
slouken@881
    85
"        xorl    $0x200000,%%eax     # Flip ID bit in EFLAGS           \n"
slouken@881
    86
"        pushq   %%rax               # Save new EFLAGS value on stack  \n"
slouken@881
    87
"        popfq                       # Replace current EFLAGS value    \n"
slouken@881
    88
"        pushfq                      # Get new EFLAGS                  \n"
slouken@881
    89
"        popq    %%rax               # Store new EFLAGS in EAX         \n"
slouken@881
    90
"        xorl    %%ecx,%%eax         # Can not toggle ID bit,          \n"
slouken@881
    91
"        jz      1f                  # Processor=80486                 \n"
slouken@881
    92
"        movl    $1,%0               # We have CPUID support           \n"
slouken@881
    93
"1:                                                                    \n"
slouken@881
    94
	: "=m" (has_CPUID)
slouken@881
    95
	:
slouken@881
    96
	: "%rax", "%rcx"
slouken@881
    97
	);
icculus@1152
    98
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_X86_))
slouken@749
    99
	__asm {
slouken@745
   100
        pushfd                      ; Get original EFLAGS
slouken@745
   101
        pop     eax
slouken@745
   102
        mov     ecx, eax
slouken@745
   103
        xor     eax, 200000h        ; Flip ID bit in EFLAGS
slouken@745
   104
        push    eax                 ; Save new EFLAGS value on stack
slouken@745
   105
        popfd                       ; Replace current EFLAGS value
slouken@745
   106
        pushfd                      ; Get new EFLAGS
slouken@745
   107
        pop     eax                 ; Store new EFLAGS in EAX
slouken@745
   108
        xor     eax, ecx            ; Can not toggle ID bit,
slouken@745
   109
        jz      done                ; Processor=80486
slouken@745
   110
        mov     has_CPUID,1         ; We have CPUID support
slouken@745
   111
done:
slouken@745
   112
	}
icculus@1229
   113
#elif defined(__sun) && defined(__x86)
slouken@1361
   114
	__asm (
icculus@1229
   115
"       pushfl                 \n"
slouken@1361
   116
"	popl    %eax           \n"
slouken@1361
   117
"	movl    %eax,%ecx      \n"
slouken@1361
   118
"	xorl    $0x200000,%eax \n"
slouken@1361
   119
"	pushl   %eax           \n"
slouken@1361
   120
"	popfl                  \n"
slouken@1361
   121
"	pushfl                 \n"
slouken@1361
   122
"	popl    %eax           \n"
slouken@1361
   123
"	xorl    %ecx,%eax      \n"
slouken@1361
   124
"	jz      1f             \n"
slouken@1361
   125
"	movl    $1,-8(%ebp)    \n"
icculus@1229
   126
"1:                            \n"
icculus@1229
   127
	);
icculus@1229
   128
#elif defined(__sun) && defined(__amd64)
icculus@1229
   129
	__asm (
icculus@1229
   130
"       pushfq                 \n"
icculus@1229
   131
"       popq    %rax           \n"
icculus@1229
   132
"       movq    %rax,%rcx      \n"
icculus@1229
   133
"       xorl    $0x200000,%eax \n"
icculus@1229
   134
"       pushq   %rax           \n"
icculus@1229
   135
"       popfq                  \n"
icculus@1229
   136
"       pushfq                 \n"
icculus@1229
   137
"       popq    %rax           \n"
icculus@1229
   138
"       xorl    %ecx,%eax      \n"
icculus@1229
   139
"       jz      1f             \n"
icculus@1229
   140
"       movl    $1,-8(%rbp)    \n"
icculus@1229
   141
"1:                            \n"
icculus@1229
   142
	);
slouken@745
   143
#endif
slouken@745
   144
	return has_CPUID;
slouken@745
   145
}
slouken@745
   146
slouken@745
   147
static __inline__ int CPU_getCPUIDFeatures()
slouken@745
   148
{
slouken@745
   149
	int features = 0;
slouken@881
   150
#if defined(__GNUC__) && ( defined(i386) || defined(__x86_64__) )
slouken@745
   151
	__asm__ (
slouken@785
   152
"        movl    %%ebx,%%edi\n"
slouken@745
   153
"        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
slouken@745
   154
"        cpuid                       # Get and save vendor ID          \n"
slouken@745
   155
"        cmpl    $1,%%eax            # Make sure 1 is valid input for CPUID\n"
slouken@745
   156
"        jl      1f                  # We dont have the CPUID instruction\n"
slouken@745
   157
"        xorl    %%eax,%%eax                                           \n"
slouken@745
   158
"        incl    %%eax                                                 \n"
slouken@745
   159
"        cpuid                       # Get family/model/stepping/features\n"
slouken@745
   160
"        movl    %%edx,%0                                              \n"
slouken@745
   161
"1:                                                                    \n"
slouken@785
   162
"        movl    %%edi,%%ebx\n"
slouken@784
   163
	: "=m" (features)
slouken@745
   164
	:
slouken@887
   165
	: "%eax", "%ecx", "%edx", "%edi"
slouken@745
   166
	);
icculus@1152
   167
#elif defined(_MSC_VER)  && (defined(_M_IX86) || defined(_X86_))
slouken@749
   168
	__asm {
slouken@745
   169
        xor     eax, eax            ; Set up for CPUID instruction
slouken@745
   170
        cpuid                       ; Get and save vendor ID
slouken@745
   171
        cmp     eax, 1              ; Make sure 1 is valid input for CPUID
slouken@745
   172
        jl      done                ; We dont have the CPUID instruction
slouken@745
   173
        xor     eax, eax
slouken@745
   174
        inc     eax
slouken@745
   175
        cpuid                       ; Get family/model/stepping/features
slouken@745
   176
        mov     features, edx
slouken@745
   177
done:
slouken@745
   178
	}
icculus@1229
   179
#elif defined(__sun) && (defined(__x86) || defined(__amd64))
icculus@1229
   180
	    __asm(
icculus@1229
   181
"        movl    %ebx,%edi\n"
icculus@1229
   182
"        xorl    %eax,%eax         \n"
icculus@1229
   183
"        cpuid                     \n"
icculus@1229
   184
"        cmpl    $1,%eax           \n"
icculus@1229
   185
"        jl      1f                \n"
icculus@1229
   186
"        xorl    %eax,%eax         \n"
icculus@1229
   187
"        incl    %eax              \n"
icculus@1229
   188
"        cpuid                     \n"
icculus@1229
   189
#ifdef __i386
icculus@1229
   190
"        movl    %edx,-8(%ebp)     \n"
icculus@1229
   191
#else
icculus@1229
   192
"        movl    %edx,-8(%rbp)     \n"
icculus@1229
   193
#endif
icculus@1229
   194
"1:                                \n"
icculus@1229
   195
"        movl    %edi,%ebx\n" );
slouken@745
   196
#endif
slouken@745
   197
	return features;
slouken@745
   198
}
slouken@745
   199
slouken@785
   200
static __inline__ int CPU_getCPUIDFeaturesExt()
slouken@785
   201
{
slouken@785
   202
	int features = 0;
slouken@881
   203
#if defined(__GNUC__) && (defined(i386) || defined (__x86_64__) )
slouken@785
   204
	__asm__ (
slouken@785
   205
"        movl    %%ebx,%%edi\n"
slouken@785
   206
"        movl    $0x80000000,%%eax   # Query for extended functions    \n"
slouken@785
   207
"        cpuid                       # Get extended function limit     \n"
slouken@785
   208
"        cmpl    $0x80000001,%%eax                                     \n"
slouken@787
   209
"        jl      1f                  # Nope, we dont have function 800000001h\n"
slouken@785
   210
"        movl    $0x80000001,%%eax   # Setup extended function 800000001h\n"
slouken@785
   211
"        cpuid                       # and get the information         \n"
slouken@785
   212
"        movl    %%edx,%0                                              \n"
slouken@785
   213
"1:                                                                    \n"
slouken@785
   214
"        movl    %%edi,%%ebx\n"
slouken@785
   215
	: "=m" (features)
slouken@785
   216
	:
slouken@887
   217
	: "%eax", "%ecx", "%edx", "%edi"
slouken@785
   218
	);
icculus@1152
   219
#elif defined(_MSC_VER)  && (defined(_M_IX86) || defined(_X86_))
slouken@785
   220
	__asm {
slouken@785
   221
        mov     eax,80000000h       ; Query for extended functions
slouken@785
   222
        cpuid                       ; Get extended function limit
slouken@785
   223
        cmp     eax,80000001h
slouken@787
   224
        jl      done                ; Nope, we dont have function 800000001h
slouken@785
   225
        mov     eax,80000001h       ; Setup extended function 800000001h
slouken@785
   226
        cpuid                       ; and get the information
slouken@785
   227
        mov     features,edx
slouken@785
   228
done:
slouken@785
   229
	}
icculus@1229
   230
#elif defined(__sun) && ( defined(__i386) || defined(__amd64) )
icculus@1229
   231
	    __asm (
icculus@1229
   232
"        movl    %ebx,%edi\n"
icculus@1229
   233
"        movl    $0x80000000,%eax \n"
icculus@1229
   234
"        cpuid                    \n"
icculus@1229
   235
"        cmpl    $0x80000001,%eax \n"
icculus@1229
   236
"        jl      1f               \n"
icculus@1229
   237
"        movl    $0x80000001,%eax \n"
icculus@1229
   238
"        cpuid                    \n"
icculus@1229
   239
#ifdef __i386
icculus@1229
   240
"        movl    %edx,-8(%ebp)   \n"
icculus@1229
   241
#else
icculus@1229
   242
"        movl    %edx,-8(%rbp)   \n"
icculus@1229
   243
#endif
icculus@1229
   244
"1:                               \n"
icculus@1229
   245
"        movl    %edi,%ebx\n"
icculus@1229
   246
	    );
slouken@785
   247
#endif
slouken@785
   248
	return features;
slouken@785
   249
}
slouken@785
   250
slouken@745
   251
static __inline__ int CPU_haveRDTSC()
slouken@745
   252
{
slouken@745
   253
	if ( CPU_haveCPUID() ) {
slouken@745
   254
		return (CPU_getCPUIDFeatures() & 0x00000010);
slouken@745
   255
	}
slouken@745
   256
	return 0;
slouken@745
   257
}
slouken@745
   258
slouken@745
   259
static __inline__ int CPU_haveMMX()
slouken@745
   260
{
slouken@745
   261
	if ( CPU_haveCPUID() ) {
slouken@745
   262
		return (CPU_getCPUIDFeatures() & 0x00800000);
slouken@745
   263
	}
slouken@745
   264
	return 0;
slouken@745
   265
}
slouken@745
   266
slouken@785
   267
static __inline__ int CPU_haveMMXExt()
slouken@785
   268
{
slouken@785
   269
	if ( CPU_haveCPUID() ) {
slouken@785
   270
		return (CPU_getCPUIDFeaturesExt() & 0x00400000);
slouken@785
   271
	}
slouken@785
   272
	return 0;
slouken@785
   273
}
slouken@785
   274
slouken@745
   275
static __inline__ int CPU_have3DNow()
slouken@745
   276
{
slouken@785
   277
	if ( CPU_haveCPUID() ) {
slouken@785
   278
		return (CPU_getCPUIDFeaturesExt() & 0x80000000);
slouken@747
   279
	}
slouken@785
   280
	return 0;
slouken@785
   281
}
slouken@785
   282
slouken@785
   283
static __inline__ int CPU_have3DNowExt()
slouken@785
   284
{
slouken@785
   285
	if ( CPU_haveCPUID() ) {
slouken@785
   286
		return (CPU_getCPUIDFeaturesExt() & 0x40000000);
slouken@745
   287
	}
slouken@785
   288
	return 0;
slouken@745
   289
}
slouken@745
   290
slouken@745
   291
static __inline__ int CPU_haveSSE()
slouken@745
   292
{
slouken@745
   293
	if ( CPU_haveCPUID() ) {
slouken@745
   294
		return (CPU_getCPUIDFeatures() & 0x02000000);
slouken@745
   295
	}
slouken@745
   296
	return 0;
slouken@745
   297
}
slouken@739
   298
slouken@785
   299
static __inline__ int CPU_haveSSE2()
slouken@785
   300
{
slouken@785
   301
	if ( CPU_haveCPUID() ) {
slouken@785
   302
		return (CPU_getCPUIDFeatures() & 0x04000000);
slouken@785
   303
	}
slouken@785
   304
	return 0;
slouken@785
   305
}
slouken@785
   306
slouken@778
   307
static __inline__ int CPU_haveAltiVec()
slouken@778
   308
{
slouken@796
   309
	volatile int altivec = 0;
slouken@1361
   310
#if MACOSX
slouken@778
   311
	int selectors[2] = { CTL_HW, HW_VECTORUNIT }; 
slouken@778
   312
	int hasVectorUnit = 0; 
slouken@778
   313
	size_t length = sizeof(hasVectorUnit); 
slouken@778
   314
	int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); 
slouken@778
   315
	if( 0 == error )
slouken@793
   316
		altivec = (hasVectorUnit != 0); 
slouken@1361
   317
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
slouken@793
   318
	void (*handler)(int sig);
slouken@793
   319
	handler = signal(SIGILL, illegal_instruction);
slouken@793
   320
	if ( setjmp(jmpbuf) == 0 ) {
slouken@793
   321
		asm volatile ("mtspr 256, %0\n\t"
slouken@793
   322
			      "vand %%v0, %%v0, %%v0"
slouken@793
   323
			      :
slouken@793
   324
			      : "r" (-1));
slouken@793
   325
		altivec = 1;
slouken@793
   326
	}
slouken@793
   327
	signal(SIGILL, handler);
slouken@778
   328
#endif
slouken@793
   329
	return altivec; 
slouken@778
   330
}
slouken@778
   331
slouken@739
   332
static Uint32 SDL_CPUFeatures = 0xFFFFFFFF;
slouken@739
   333
slouken@739
   334
static Uint32 SDL_GetCPUFeatures()
slouken@739
   335
{
slouken@739
   336
	if ( SDL_CPUFeatures == 0xFFFFFFFF ) {
slouken@739
   337
		SDL_CPUFeatures = 0;
slouken@745
   338
		if ( CPU_haveRDTSC() ) {
slouken@745
   339
			SDL_CPUFeatures |= CPU_HAS_RDTSC;
slouken@745
   340
		}
slouken@739
   341
		if ( CPU_haveMMX() ) {
slouken@739
   342
			SDL_CPUFeatures |= CPU_HAS_MMX;
slouken@739
   343
		}
slouken@786
   344
		if ( CPU_haveMMXExt() ) {
slouken@786
   345
			SDL_CPUFeatures |= CPU_HAS_MMXEXT;
slouken@786
   346
		}
slouken@739
   347
		if ( CPU_have3DNow() ) {
slouken@739
   348
			SDL_CPUFeatures |= CPU_HAS_3DNOW;
slouken@739
   349
		}
slouken@786
   350
		if ( CPU_have3DNowExt() ) {
slouken@786
   351
			SDL_CPUFeatures |= CPU_HAS_3DNOWEXT;
slouken@786
   352
		}
slouken@739
   353
		if ( CPU_haveSSE() ) {
slouken@739
   354
			SDL_CPUFeatures |= CPU_HAS_SSE;
slouken@739
   355
		}
slouken@786
   356
		if ( CPU_haveSSE2() ) {
slouken@786
   357
			SDL_CPUFeatures |= CPU_HAS_SSE2;
slouken@786
   358
		}
slouken@778
   359
		if ( CPU_haveAltiVec() ) {
slouken@778
   360
			SDL_CPUFeatures |= CPU_HAS_ALTIVEC;
slouken@778
   361
		}
slouken@739
   362
	}
slouken@739
   363
	return SDL_CPUFeatures;
slouken@739
   364
}
slouken@739
   365
slouken@745
   366
SDL_bool SDL_HasRDTSC()
slouken@745
   367
{
slouken@745
   368
	if ( SDL_GetCPUFeatures() & CPU_HAS_RDTSC ) {
slouken@745
   369
		return SDL_TRUE;
slouken@745
   370
	}
slouken@745
   371
	return SDL_FALSE;
slouken@745
   372
}
slouken@745
   373
slouken@739
   374
SDL_bool SDL_HasMMX()
slouken@739
   375
{
slouken@739
   376
	if ( SDL_GetCPUFeatures() & CPU_HAS_MMX ) {
slouken@739
   377
		return SDL_TRUE;
slouken@739
   378
	}
slouken@739
   379
	return SDL_FALSE;
slouken@739
   380
}
slouken@739
   381
slouken@804
   382
SDL_bool SDL_HasMMXExt()
slouken@804
   383
{
slouken@804
   384
	if ( SDL_GetCPUFeatures() & CPU_HAS_MMXEXT ) {
slouken@804
   385
		return SDL_TRUE;
slouken@804
   386
	}
slouken@804
   387
	return SDL_FALSE;
slouken@804
   388
}
slouken@804
   389
slouken@739
   390
SDL_bool SDL_Has3DNow()
slouken@739
   391
{
slouken@739
   392
	if ( SDL_GetCPUFeatures() & CPU_HAS_3DNOW ) {
slouken@739
   393
		return SDL_TRUE;
slouken@739
   394
	}
slouken@739
   395
	return SDL_FALSE;
slouken@739
   396
}
slouken@739
   397
slouken@804
   398
SDL_bool SDL_Has3DNowExt()
slouken@804
   399
{
slouken@804
   400
	if ( SDL_GetCPUFeatures() & CPU_HAS_3DNOWEXT ) {
slouken@804
   401
		return SDL_TRUE;
slouken@804
   402
	}
slouken@804
   403
	return SDL_FALSE;
slouken@804
   404
}
slouken@804
   405
slouken@739
   406
SDL_bool SDL_HasSSE()
slouken@739
   407
{
slouken@739
   408
	if ( SDL_GetCPUFeatures() & CPU_HAS_SSE ) {
slouken@739
   409
		return SDL_TRUE;
slouken@739
   410
	}
slouken@739
   411
	return SDL_FALSE;
slouken@739
   412
}
slouken@739
   413
slouken@804
   414
SDL_bool SDL_HasSSE2()
slouken@804
   415
{
slouken@804
   416
	if ( SDL_GetCPUFeatures() & CPU_HAS_SSE2 ) {
slouken@804
   417
		return SDL_TRUE;
slouken@804
   418
	}
slouken@804
   419
	return SDL_FALSE;
slouken@804
   420
}
slouken@804
   421
slouken@778
   422
SDL_bool SDL_HasAltiVec()
slouken@778
   423
{
slouken@778
   424
	if ( SDL_GetCPUFeatures() & CPU_HAS_ALTIVEC ) {
slouken@778
   425
		return SDL_TRUE;
slouken@778
   426
	}
slouken@778
   427
	return SDL_FALSE;
slouken@778
   428
}
slouken@778
   429
slouken@739
   430
#ifdef TEST_MAIN
slouken@739
   431
slouken@739
   432
#include <stdio.h>
slouken@739
   433
slouken@739
   434
int main()
slouken@739
   435
{
slouken@778
   436
	printf("RDTSC: %d\n", SDL_HasRDTSC());
slouken@739
   437
	printf("MMX: %d\n", SDL_HasMMX());
slouken@785
   438
	printf("MMXExt: %d\n", SDL_HasMMXExt());
slouken@739
   439
	printf("3DNow: %d\n", SDL_Has3DNow());
slouken@785
   440
	printf("3DNowExt: %d\n", SDL_Has3DNowExt());
slouken@739
   441
	printf("SSE: %d\n", SDL_HasSSE());
slouken@785
   442
	printf("SSE2: %d\n", SDL_HasSSE2());
slouken@778
   443
	printf("AltiVec: %d\n", SDL_HasAltiVec());
slouken@745
   444
	return 0;
slouken@739
   445
}
slouken@739
   446
slouken@739
   447
#endif /* TEST_MAIN */