SDL_cpuinfo.c File Reference
`#include "../SDL_internal.h"`
`#include "SDL_cpuinfo.h"`
Include dependency graph for SDL_cpuinfo.c:

Go to the source code of this file.

## Macros

#define | CPU_HAS_RDTSC 0x00000001
#define | CPU_HAS_ALTIVEC 0x00000002
#define | CPU_HAS_MMX 0x00000004
#define | CPU_HAS_3DNOW 0x00000008
#define | CPU_HAS_SSE 0x00000010
#define | CPU_HAS_SSE2 0x00000020
#define | CPU_HAS_SSE3 0x00000040
#define | CPU_HAS_SSE41 0x00000100
#define | CPU_HAS_SSE42 0x00000200
#define | CPU_HAS_AVX 0x00000400
#define | CPU_HAS_AVX2 0x00000800
#define | cpuid(func, a, b, c, d) a = b = c = d = 0

## Functions

static int | CPU_haveCPUID (void)
static int | CPU_getCPUIDFeatures (void)
static SDL_bool | CPU_OSSavesYMM (void)
static int | CPU_haveRDTSC (void)
static int | CPU_haveAltiVec (void)
static int | CPU_haveMMX (void)
static int | CPU_have3DNow (void)
static int | CPU_haveSSE (void)
static int | CPU_haveSSE2 (void)
static int | CPU_haveSSE3 (void)
static int | CPU_haveSSE41 (void)
static int | CPU_haveSSE42 (void)
static int | CPU_haveAVX (void)
static int | CPU_haveAVX2 (void)
int | SDL_GetCPUCount (void)
static const char * | SDL_GetCPUType (void)
int | SDL_GetCPUCacheLineSize (void)
static Uint32 | SDL_GetCPUFeatures (void)
SDL_bool | SDL_HasRDTSC (void)
SDL_bool | SDL_HasAltiVec (void)
SDL_bool | SDL_HasMMX (void)
SDL_bool | SDL_Has3DNow (void)
SDL_bool | SDL_HasSSE (void)
SDL_bool | SDL_HasSSE2 (void)
SDL_bool | SDL_HasSSE3 (void)
SDL_bool | SDL_HasSSE41 (void)
SDL_bool | SDL_HasSSE42 (void)
SDL_bool | SDL_HasAVX (void)
SDL_bool | SDL_HasAVX2 (void)
int | SDL_GetSystemRAM (void)

## Variables

static int | SDL_CPUCount = 0
static Uint32 | SDL_CPUFeatures = 0xFFFFFFFF
static int | SDL_SystemRAM = 0

## Macro Definition Documentation

#define CPU_HAS_3DNOW 0x00000008

Definition at line 56 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_Has3DNow().

#define CPU_HAS_ALTIVEC 0x00000002

Definition at line 54 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasAltiVec().

#define CPU_HAS_AVX 0x00000400

Definition at line 62 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasAVX().

#define CPU_HAS_AVX2 0x00000800

Definition at line 63 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasAVX2().

#define CPU_HAS_MMX 0x00000004

Definition at line 55 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasMMX().

#define CPU_HAS_RDTSC 0x00000001

Definition at line 53 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasRDTSC().

#define CPU_HAS_SSE 0x00000010

Definition at line 57 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE().

#define CPU_HAS_SSE2 0x00000020

Definition at line 58 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE2().

#define CPU_HAS_SSE3 0x00000040

Definition at line 59 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE3().

#define CPU_HAS_SSE41 0x00000100

Definition at line 60 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE41().

#define CPU_HAS_SSE42 0x00000200

Definition at line 61 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE42().

#define cpuid | ( |  | func,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | a = b = c = d = 0

Definition at line 214 of file SDL_cpuinfo.c.

Referenced by CPU_getCPUIDFeatures(), CPU_have3DNow(), CPU_haveAVX(), CPU_haveAVX2(), CPU_haveSSE3(), CPU_haveSSE41(), CPU_haveSSE42(), CPU_OSSavesYMM(), SDL_GetCPUCacheLineSize(), and SDL_GetCPUType().

## Function Documentation

static int CPU_getCPUIDFeatures | ( | void |  | ) |

static

Definition at line 219 of file SDL_cpuinfo.c.

References cpuid, and d.

Referenced by CPU_haveMMX(), CPU_haveRDTSC(), CPU_haveSSE(), and CPU_haveSSE2().

{
int features = 0;
int a, b, c, d;
cpuid(0, a, b, c, d);
if (a >= 1) {
cpuid(1, a, b, c, d);
features = d;
}
return features;
}
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

static int CPU_have3DNow | ( | void |  | ) |

static

Definition at line 312 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
int a, b, c, d;
cpuid(0x80000000, a, b, c, d);
if (a >= 0x80000001) {
cpuid(0x80000001, a, b, c, d);
return (d & 0x80000000);
}
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

static int CPU_haveAltiVec | ( | void |  | ) |

static

Definition at line 274 of file SDL_cpuinfo.c.

References NULL, and void.

Referenced by SDL_GetCPUFeatures().

{
volatile int altivec = 0;
#ifndef SDL_CPUINFO_DISABLED
#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
#ifdef __OpenBSD__
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
#else
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
#endif
int hasVectorUnit = 0;
size_t length = sizeof(hasVectorUnit);
int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
if (0 == error)
altivec = (hasVectorUnit != 0);
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
void (*handler) (int sig);
handler = signal(SIGILL, illegal_instruction);
if (setjmp(jmpbuf) == 0) {
asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0"::"r" (-1));
altivec = 1;
}
signal(SIGILL, handler);
#endif
#endif
return altivec;
}
NULL
#define NULL
Definition: begin_code.h:143
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:93
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:669

static int CPU_haveAVX | ( | void |  | ) |

static

Definition at line 390 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), CPU_OSSavesYMM(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID() && CPU_OSSavesYMM()) {
int a, b, c, d;
cpuid(0, a, b, c, d);
if (a >= 1) {
cpuid(1, a, b, c, d);
return (c & 0x10000000);
}
}
return 0;
}
CPU_OSSavesYMM
static SDL_bool CPU_OSSavesYMM(void)
Definition: SDL_cpuinfo.c:233
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

static int CPU_haveAVX2 | ( | void |  | ) |

static

Definition at line 405 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), CPU_OSSavesYMM(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID() && CPU_OSSavesYMM()) {
int a, b, c, d;
cpuid(0, a, b, c, d);
if (a >= 7) {
cpuid(7, a, b, c, d);
return (b & 0x00000020);
}
}
return 0;
}
CPU_OSSavesYMM
static SDL_bool CPU_OSSavesYMM(void)
Definition: SDL_cpuinfo.c:233
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

static int CPU_haveCPUID | ( | void |  | ) |

static

Definition at line 78 of file SDL_cpuinfo.c.

References done, and pop.

Referenced by CPU_have3DNow(), CPU_haveAVX(), CPU_haveAVX2(), CPU_haveMMX(), CPU_haveRDTSC(), CPU_haveSSE(), CPU_haveSSE2(), CPU_haveSSE3(), CPU_haveSSE41(), CPU_haveSSE42(), and SDL_GetCPUType().

{
int has_CPUID = 0;
/* *INDENT-OFF* */
#ifndef SDL_CPUINFO_DISABLED
#if defined(__GNUC__) && defined(i386)
__asm__ (
" pushfl # Get original EFLAGS \n"
" popl %%eax \n"
" movl %%eax,%%ecx \n"
" xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
" pushl %%eax # Save new EFLAGS value on stack \n"
" popfl # Replace current EFLAGS value \n"
" pushfl # Get new EFLAGS \n"
" popl %%eax # Store new EFLAGS in EAX \n"
" xorl %%ecx,%%eax # Can not toggle ID bit, \n"
" jz 1f # Processor=80486 \n"
" movl $1,%0 # We have CPUID support \n"
"1: \n"
: "=m" (has_CPUID)
:
: "%eax", "%ecx"
);
#elif defined(__GNUC__) && defined(__x86_64__)
/* Technically, if this is being compiled under __x86_64__ then it has
CPUid by definition. But it's nice to be able to prove it. :) */
__asm__ (
" pushfq # Get original EFLAGS \n"
" popq %%rax \n"
" movq %%rax,%%rcx \n"
" xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
" pushq %%rax # Save new EFLAGS value on stack \n"
" popfq # Replace current EFLAGS value \n"
" pushfq # Get new EFLAGS \n"
" popq %%rax # Store new EFLAGS in EAX \n"
" xorl %%ecx,%%eax # Can not toggle ID bit, \n"
" jz 1f # Processor=80486 \n"
" movl $1,%0 # We have CPUID support \n"
"1: \n"
: "=m" (has_CPUID)
:
: "%rax", "%rcx"
);
#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
__asm {
pushfd ; Get original EFLAGS
pop eax
mov ecx, eax
xor eax, 200000h ; Flip ID bit in EFLAGS
push eax ; Save new EFLAGS value on stack
popfd ; Replace current EFLAGS value
pushfd ; Get new EFLAGS
pop eax ; Store new EFLAGS in EAX
xor eax, ecx ; Can not toggle ID bit,
jz done ; Processor=80486
mov has_CPUID,1 ; We have CPUID support
done:
}
#elif defined(_MSC_VER) && defined(_M_X64)
has_CPUID = 1;
#elif defined(__sun) && defined(__i386)
__asm (
" pushfl \n"
" popl %eax \n"
" movl %eax,%ecx \n"
" xorl $0x200000,%eax \n"
" pushl %eax \n"
" popfl \n"
" pushfl \n"
" popl %eax \n"
" xorl %ecx,%eax \n"
" jz 1f \n"
" movl $1,-8(%ebp) \n"
"1: \n"
);
#elif defined(__sun) && defined(__amd64)
__asm (
" pushfq \n"
" popq %rax \n"
" movq %rax,%rcx \n"
" xorl $0x200000,%eax \n"
" pushq %rax \n"
" popfq \n"
" pushfq \n"
" popq %rax \n"
" xorl %ecx,%eax \n"
" jz 1f \n"
" movl $1,-8(%rbp) \n"
"1: \n"
);
#endif
#endif
/* *INDENT-ON* */
return has_CPUID;
}
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
pop
#define pop
Definition: SDL_qsort.c:130
done
int done
Definition: checkkeys.c:28
in
GLuint in
Definition: SDL_opengl_glext.h:7940
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946

static int CPU_haveMMX | ( | void |  | ) |

static

Definition at line 303 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
return (CPU_getCPUIDFeatures() & 0x00800000);
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
CPU_getCPUIDFeatures
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:219

static int CPU_haveRDTSC | ( | void |  | ) |

static

Definition at line 265 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
return (CPU_getCPUIDFeatures() & 0x00000010);
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
CPU_getCPUIDFeatures
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:219

static int CPU_haveSSE | ( | void |  | ) |

static

Definition at line 327 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
return (CPU_getCPUIDFeatures() & 0x02000000);
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
CPU_getCPUIDFeatures
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:219

static int CPU_haveSSE2 | ( | void |  | ) |

static

Definition at line 336 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
return (CPU_getCPUIDFeatures() & 0x04000000);
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
CPU_getCPUIDFeatures
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:219

static int CPU_haveSSE3 | ( | void |  | ) |

static

Definition at line 345 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
int a, b, c, d;
cpuid(0, a, b, c, d);
if (a >= 1) {
cpuid(1, a, b, c, d);
return (c & 0x00000001);
}
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

static int CPU_haveSSE41 | ( | void |  | ) |

static

Definition at line 360 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
int a, b, c, d;
cpuid(0, a, b, c, d);
if (a >= 1) {
cpuid(1, a, b, c, d);
return (c & 0x00080000);
}
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

static int CPU_haveSSE42 | ( | void |  | ) |

static

Definition at line 375 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

{
if (CPU_haveCPUID()) {
int a, b, c, d;
cpuid(0, a, b, c, d);
if (a >= 1) {
cpuid(1, a, b, c, d);
return (c & 0x00100000);
}
}
return 0;
}
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

static SDL_bool CPU_OSSavesYMM | ( | void |  | ) |

static

Definition at line 233 of file SDL_cpuinfo.c.

References cpuid, d, SDL_FALSE, and SDL_TRUE.

Referenced by CPU_haveAVX(), and CPU_haveAVX2().

{
int a, b, c, d;
/* Check to make sure we can call xgetbv */
cpuid(0, a, b, c, d);
if (a < 1) {
return SDL_FALSE;
}
cpuid(1, a, b, c, d);
if (!(c & 0x08000000)) {
return SDL_FALSE;
}
/* Call xgetbv to see if YMM register state is saved */
a = 0;
#if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
asm(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx");
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */
a = (int)_xgetbv(0);
#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
__asm
{
xor ecx, ecx
_asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0
mov a, eax
}
#endif
return ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE;
}
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

int SDL_GetCPUCacheLineSize | ( | void |  | ) |

This function returns the L1 cache line size of the CPU

This is useful for determining multi-threaded structure padding or SIMD prefetch sizes.

Definition at line 564 of file SDL_cpuinfo.c.

References cpuid, d, SDL_CACHELINE_SIZE, SDL_GetCPUType(), SDL_strcmp, and void.

Referenced by SDL_GetSystemRAM().

{
const char *cpuType = SDL_GetCPUType();
int a, b, c, d;
(void) a; (void) b; (void) c; (void) d;
if (SDL_strcmp(cpuType, "GenuineIntel") == 0) {
cpuid(0x00000001, a, b, c, d);
return (((b >> 8) & 0xff) * 8);
} else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0) {
cpuid(0x80000005, a, b, c, d);
return (c & 0xff);
} else {
/* Just make a guess here... */
return SDL_CACHELINE_SIZE;
}
}
SDL_GetCPUType
static const char * SDL_GetCPUType(void)
Definition: SDL_cpuinfo.c:455
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
SDL_CACHELINE_SIZE
#define SDL_CACHELINE_SIZE
Definition: SDL_cpuinfo.h:77
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:93
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:423
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

int SDL_GetCPUCount | ( | void |  | ) |

This function returns the number of CPU cores available.

Definition at line 422 of file SDL_cpuinfo.c.

References NULL, and SDL_CPUCount.

Referenced by SDL_GetSystemRAM().

{
if (!SDL_CPUCount) {
#ifndef SDL_CPUINFO_DISABLED
#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
if (SDL_CPUCount <= 0) {
SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
}
#endif
#ifdef HAVE_SYSCTLBYNAME
if (SDL_CPUCount <= 0) {
size_t size = sizeof(SDL_CPUCount);
sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0);
}
#endif
#ifdef __WIN32__
if (SDL_CPUCount <= 0) {
SYSTEM_INFO info;
GetSystemInfo(&info);
SDL_CPUCount = info.dwNumberOfProcessors;
}
#endif
#endif
/* There has to be at least 1, right? :) */
if (SDL_CPUCount <= 0) {
SDL_CPUCount = 1;
}
}
return SDL_CPUCount;
}
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:537
NULL
#define NULL
Definition: begin_code.h:143
SDL_CPUCount
static int SDL_CPUCount
Definition: SDL_cpuinfo.c:419

static Uint32 SDL_GetCPUFeatures | ( | void |  | ) |

static

Definition at line 584 of file SDL_cpuinfo.c.

References CPU_HAS_3DNOW, CPU_HAS_ALTIVEC, CPU_HAS_AVX, CPU_HAS_AVX2, CPU_HAS_MMX, CPU_HAS_RDTSC, CPU_HAS_SSE, CPU_HAS_SSE2, CPU_HAS_SSE3, CPU_HAS_SSE41, CPU_HAS_SSE42, CPU_have3DNow(), CPU_haveAltiVec(), CPU_haveAVX(), CPU_haveAVX2(), CPU_haveMMX(), CPU_haveRDTSC(), CPU_haveSSE(), CPU_haveSSE2(), CPU_haveSSE3(), CPU_haveSSE41(), CPU_haveSSE42(), and SDL_CPUFeatures.

Referenced by SDL_Has3DNow(), SDL_HasAltiVec(), SDL_HasAVX(), SDL_HasAVX2(), SDL_HasMMX(), SDL_HasRDTSC(), SDL_HasSSE(), SDL_HasSSE2(), SDL_HasSSE3(), SDL_HasSSE41(), and SDL_HasSSE42().

{
if (SDL_CPUFeatures == 0xFFFFFFFF) {
SDL_CPUFeatures = 0;
if (CPU_haveRDTSC()) {
SDL_CPUFeatures |= CPU_HAS_RDTSC;
}
if (CPU_haveAltiVec()) {
SDL_CPUFeatures |= CPU_HAS_ALTIVEC;
}
if (CPU_haveMMX()) {
SDL_CPUFeatures |= CPU_HAS_MMX;
}
if (CPU_have3DNow()) {
SDL_CPUFeatures |= CPU_HAS_3DNOW;
}
if (CPU_haveSSE()) {
SDL_CPUFeatures |= CPU_HAS_SSE;
}
if (CPU_haveSSE2()) {
SDL_CPUFeatures |= CPU_HAS_SSE2;
}
if (CPU_haveSSE3()) {
SDL_CPUFeatures |= CPU_HAS_SSE3;
}
if (CPU_haveSSE41()) {
SDL_CPUFeatures |= CPU_HAS_SSE41;
}
if (CPU_haveSSE42()) {
SDL_CPUFeatures |= CPU_HAS_SSE42;
}
if (CPU_haveAVX()) {
SDL_CPUFeatures |= CPU_HAS_AVX;
}
if (CPU_haveAVX2()) {
SDL_CPUFeatures |= CPU_HAS_AVX2;
}
}
return SDL_CPUFeatures;
}
CPU_HAS_SSE41
#define CPU_HAS_SSE41
Definition: SDL_cpuinfo.c:60
CPU_HAS_RDTSC
#define CPU_HAS_RDTSC
Definition: SDL_cpuinfo.c:53
CPU_HAS_SSE3
#define CPU_HAS_SSE3
Definition: SDL_cpuinfo.c:59
CPU_haveSSE42
static int CPU_haveSSE42(void)
Definition: SDL_cpuinfo.c:375
CPU_haveAVX
static int CPU_haveAVX(void)
Definition: SDL_cpuinfo.c:390
CPU_haveRDTSC
static int CPU_haveRDTSC(void)
Definition: SDL_cpuinfo.c:265
CPU_HAS_SSE2
#define CPU_HAS_SSE2
Definition: SDL_cpuinfo.c:58
CPU_have3DNow
static int CPU_have3DNow(void)
Definition: SDL_cpuinfo.c:312
CPU_HAS_ALTIVEC
#define CPU_HAS_ALTIVEC
Definition: SDL_cpuinfo.c:54
CPU_haveAltiVec
static int CPU_haveAltiVec(void)
Definition: SDL_cpuinfo.c:274
CPU_HAS_AVX
#define CPU_HAS_AVX
Definition: SDL_cpuinfo.c:62
CPU_haveSSE3
static int CPU_haveSSE3(void)
Definition: SDL_cpuinfo.c:345
SDL_CPUFeatures
static Uint32 SDL_CPUFeatures
Definition: SDL_cpuinfo.c:581
CPU_haveSSE
static int CPU_haveSSE(void)
Definition: SDL_cpuinfo.c:327
CPU_HAS_SSE
#define CPU_HAS_SSE
Definition: SDL_cpuinfo.c:57
CPU_haveAVX2
static int CPU_haveAVX2(void)
Definition: SDL_cpuinfo.c:405
CPU_HAS_AVX2
#define CPU_HAS_AVX2
Definition: SDL_cpuinfo.c:63
CPU_HAS_MMX
#define CPU_HAS_MMX
Definition: SDL_cpuinfo.c:55
CPU_HAS_SSE42
#define CPU_HAS_SSE42
Definition: SDL_cpuinfo.c:61
CPU_HAS_3DNOW
#define CPU_HAS_3DNOW
Definition: SDL_cpuinfo.c:56
CPU_haveSSE41
static int CPU_haveSSE41(void)
Definition: SDL_cpuinfo.c:360
CPU_haveMMX
static int CPU_haveMMX(void)
Definition: SDL_cpuinfo.c:303
CPU_haveSSE2
static int CPU_haveSSE2(void)
Definition: SDL_cpuinfo.c:336

static const char* SDL_GetCPUType | ( | void |  | ) |

static

Definition at line 455 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, d, i, SDL_strlcpy, and void.

Referenced by SDL_GetCPUCacheLineSize(), and SDL_GetSystemRAM().

{
static char SDL_CPUType[13];
if (!SDL_CPUType[0]) {
int i = 0;
if (CPU_haveCPUID()) {
int a, b, c, d;
cpuid(0x00000000, a, b, c, d);
(void) a;
SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
SDL_CPUType[i++] = (char)(b & 0xff);
SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
SDL_CPUType[i++] = (char)(d & 0xff);
SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
SDL_CPUType[i++] = (char)(c & 0xff);
}
if (!SDL_CPUType[0]) {
SDL_strlcpy(SDL_CPUType, "Unknown", sizeof(SDL_CPUType));
}
}
return SDL_CPUType;
}
SDL_strlcpy
#define SDL_strlcpy
Definition: SDL_dynapi_overrides.h:400
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:78
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:214
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:93
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

int SDL_GetSystemRAM | ( | void |  | ) |

This function returns the amount of RAM configured in the system, in MB.

Definition at line 727 of file SDL_cpuinfo.c.

References main, NULL, SDL_GetCPUCacheLineSize(), SDL_GetCPUCount(), SDL_GetCPUType(), SDL_Has3DNow(), SDL_HasAltiVec(), SDL_HasAVX(), SDL_HasAVX2(), SDL_HasMMX(), SDL_HasRDTSC(), SDL_HasSSE(), SDL_HasSSE2(), SDL_HasSSE3(), SDL_HasSSE41(), SDL_HasSSE42(), and SDL_SystemRAM.

{
if (!SDL_SystemRAM) {
#ifndef SDL_CPUINFO_DISABLED
#if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
if (SDL_SystemRAM <= 0) {
SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
}
#endif
#ifdef HAVE_SYSCTLBYNAME
if (SDL_SystemRAM <= 0) {
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
#ifdef HW_REALMEM
int mib[2] = {CTL_HW, HW_REALMEM};
#else
/* might only report up to 2 GiB */
int mib[2] = {CTL_HW, HW_PHYSMEM};
#endif /* HW_REALMEM */
#else
int mib[2] = {CTL_HW, HW_MEMSIZE};
#endif /* __FreeBSD__ || __FreeBSD_kernel__ */
Uint64 memsize = 0;
size_t len = sizeof(memsize);
if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
SDL_SystemRAM = (int)(memsize / (1024*1024));
}
}
#endif
#ifdef __WIN32__
if (SDL_SystemRAM <= 0) {
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(stat);
if (GlobalMemoryStatusEx(&stat)) {
SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024));
}
}
#endif
#endif
}
return SDL_SystemRAM;
}
SDL_SystemRAM
static int SDL_SystemRAM
Definition: SDL_cpuinfo.c:724
Uint64
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:166
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
NULL
#define NULL
Definition: begin_code.h:143
Sint64
int64_t Sint64
A signed 64-bit integer type.
Definition: SDL_stdinc.h:162

SDL_bool SDL_Has3DNow | ( | void |  | ) |

This function returns true if the CPU has 3DNow! features.

Definition at line 653 of file SDL_cpuinfo.c.

References CPU_HAS_3DNOW, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_3DNOW) {
return SDL_TRUE;
}
return SDL_FALSE;
}
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128
CPU_HAS_3DNOW
#define CPU_HAS_3DNOW
Definition: SDL_cpuinfo.c:56

SDL_bool SDL_HasAltiVec | ( | void |  | ) |

This function returns true if the CPU has AltiVec features.

Definition at line 635 of file SDL_cpuinfo.c.

References CPU_HAS_ALTIVEC, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_ALTIVEC) {
return SDL_TRUE;
}
return SDL_FALSE;
}
CPU_HAS_ALTIVEC
#define CPU_HAS_ALTIVEC
Definition: SDL_cpuinfo.c:54
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasAVX | ( | void |  | ) |

This function returns true if the CPU has AVX features.

Definition at line 707 of file SDL_cpuinfo.c.

References CPU_HAS_AVX, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_AVX) {
return SDL_TRUE;
}
return SDL_FALSE;
}
CPU_HAS_AVX
#define CPU_HAS_AVX
Definition: SDL_cpuinfo.c:62
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasAVX2 | ( | void |  | ) |

This function returns true if the CPU has AVX2 features.

Definition at line 716 of file SDL_cpuinfo.c.

References CPU_HAS_AVX2, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_AVX2) {
return SDL_TRUE;
}
return SDL_FALSE;
}
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
CPU_HAS_AVX2
#define CPU_HAS_AVX2
Definition: SDL_cpuinfo.c:63
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasMMX | ( | void |  | ) |

This function returns true if the CPU has MMX features.

Definition at line 644 of file SDL_cpuinfo.c.

References CPU_HAS_MMX, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_MMX) {
return SDL_TRUE;
}
return SDL_FALSE;
}
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
CPU_HAS_MMX
#define CPU_HAS_MMX
Definition: SDL_cpuinfo.c:55
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasRDTSC | ( | void |  | ) |

This function returns true if the CPU has the RDTSC instruction.

Definition at line 626 of file SDL_cpuinfo.c.

References CPU_HAS_RDTSC, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_RDTSC) {
return SDL_TRUE;
}
return SDL_FALSE;
}
CPU_HAS_RDTSC
#define CPU_HAS_RDTSC
Definition: SDL_cpuinfo.c:53
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasSSE | ( | void |  | ) |

This function returns true if the CPU has SSE features.

Definition at line 662 of file SDL_cpuinfo.c.

References CPU_HAS_SSE, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_SSE) {
return SDL_TRUE;
}
return SDL_FALSE;
}
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
CPU_HAS_SSE
#define CPU_HAS_SSE
Definition: SDL_cpuinfo.c:57
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasSSE2 | ( | void |  | ) |

This function returns true if the CPU has SSE2 features.

Definition at line 671 of file SDL_cpuinfo.c.

References CPU_HAS_SSE2, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_SSE2) {
return SDL_TRUE;
}
return SDL_FALSE;
}
CPU_HAS_SSE2
#define CPU_HAS_SSE2
Definition: SDL_cpuinfo.c:58
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasSSE3 | ( | void |  | ) |

This function returns true if the CPU has SSE3 features.

Definition at line 680 of file SDL_cpuinfo.c.

References CPU_HAS_SSE3, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_SSE3) {
return SDL_TRUE;
}
return SDL_FALSE;
}
CPU_HAS_SSE3
#define CPU_HAS_SSE3
Definition: SDL_cpuinfo.c:59
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasSSE41 | ( | void |  | ) |

This function returns true if the CPU has SSE4.1 features.

Definition at line 689 of file SDL_cpuinfo.c.

References CPU_HAS_SSE41, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_SSE41) {
return SDL_TRUE;
}
return SDL_FALSE;
}
CPU_HAS_SSE41
#define CPU_HAS_SSE41
Definition: SDL_cpuinfo.c:60
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

SDL_bool SDL_HasSSE42 | ( | void |  | ) |

This function returns true if the CPU has SSE4.2 features.

Definition at line 698 of file SDL_cpuinfo.c.

References CPU_HAS_SSE42, SDL_FALSE, SDL_GetCPUFeatures(), and SDL_TRUE.

Referenced by SDL_GetSystemRAM().

{
if (SDL_GetCPUFeatures() & CPU_HAS_SSE42) {
return SDL_TRUE;
}
return SDL_FALSE;
}
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:584
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128
CPU_HAS_SSE42
#define CPU_HAS_SSE42
Definition: SDL_cpuinfo.c:61

## Variable Documentation

int SDL_CPUCount = 0

static

Definition at line 419 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUCount().

Uint32 SDL_CPUFeatures = 0xFFFFFFFF

static

Definition at line 581 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures().

int SDL_SystemRAM = 0

static

Definition at line 724 of file SDL_cpuinfo.c.

Referenced by SDL_GetSystemRAM().