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