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