SDL  2.0
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 CPU_HAS_NEON   0x00001000
 
#define CPU_HAS_ARM_SIMD   0x00002000
 
#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 SDL_bool CPU_haveARMSIMD (void)
 
static int CPU_haveNEON (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)
 
SDL_bool SDL_HasARMSIMD (void)
 
SDL_bool SDL_HasNEON (void)
 
int SDL_GetSystemRAM (void)
 

Variables

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

Macro Definition Documentation

◆ CPU_HAS_3DNOW

#define CPU_HAS_3DNOW   0x00000008

Definition at line 71 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_Has3DNow().

◆ CPU_HAS_ALTIVEC

#define CPU_HAS_ALTIVEC   0x00000002

Definition at line 69 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasAltiVec().

◆ CPU_HAS_ARM_SIMD

#define CPU_HAS_ARM_SIMD   0x00002000

Definition at line 80 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasARMSIMD().

◆ CPU_HAS_AVX

#define CPU_HAS_AVX   0x00000400

Definition at line 77 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasAVX().

◆ CPU_HAS_AVX2

#define CPU_HAS_AVX2   0x00000800

Definition at line 78 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasAVX2().

◆ CPU_HAS_MMX

#define CPU_HAS_MMX   0x00000004

Definition at line 70 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasMMX().

◆ CPU_HAS_NEON

#define CPU_HAS_NEON   0x00001000

Definition at line 79 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasNEON().

◆ CPU_HAS_RDTSC

#define CPU_HAS_RDTSC   0x00000001

Definition at line 68 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasRDTSC().

◆ CPU_HAS_SSE

#define CPU_HAS_SSE   0x00000010

Definition at line 72 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE().

◆ CPU_HAS_SSE2

#define CPU_HAS_SSE2   0x00000020

Definition at line 73 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE2().

◆ CPU_HAS_SSE3

#define CPU_HAS_SSE3   0x00000040

Definition at line 74 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE3().

◆ CPU_HAS_SSE41

#define CPU_HAS_SSE41   0x00000100

Definition at line 75 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE41().

◆ CPU_HAS_SSE42

#define CPU_HAS_SSE42   0x00000200

Definition at line 76 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE42().

◆ cpuid

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

Function Documentation

◆ CPU_getCPUIDFeatures()

static int CPU_getCPUIDFeatures ( void  )
static

Definition at line 236 of file SDL_cpuinfo.c.

References cpuid, and d.

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

237 {
238  int features = 0;
239  int a, b, c, d;
240 
241  cpuid(0, a, b, c, d);
242  if (a >= 1) {
243  cpuid(1, a, b, c, d);
244  features = d;
245  }
246  return features;
247 }
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ CPU_have3DNow()

static int CPU_have3DNow ( void  )
static

Definition at line 441 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

442 {
443  if (CPU_haveCPUID()) {
444  int a, b, c, d;
445 
446  cpuid(0x80000000, a, b, c, d);
447  if (a >= 0x80000001) {
448  cpuid(0x80000001, a, b, c, d);
449  return (d & 0x80000000);
450  }
451  }
452  return 0;
453 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ CPU_haveAltiVec()

static int CPU_haveAltiVec ( void  )
static

Definition at line 291 of file SDL_cpuinfo.c.

References CPU_haveARMSIMD(), NULL, and void.

Referenced by SDL_GetCPUFeatures().

292 {
293  volatile int altivec = 0;
294 #ifndef SDL_CPUINFO_DISABLED
295 #if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
296 #ifdef __OpenBSD__
297  int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
298 #else
299  int selectors[2] = { CTL_HW, HW_VECTORUNIT };
300 #endif
301  int hasVectorUnit = 0;
302  size_t length = sizeof(hasVectorUnit);
303  int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
304  if (0 == error)
305  altivec = (hasVectorUnit != 0);
306 #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
307  void (*handler) (int sig);
308  handler = signal(SIGILL, illegal_instruction);
309  if (setjmp(jmpbuf) == 0) {
310  asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0"::"r" (-1));
311  altivec = 1;
312  }
313  signal(SIGILL, handler);
314 #endif
315 #endif
316  return altivec;
317 }
#define NULL
Definition: begin_code.h:143
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
GLuint GLsizei GLsizei * length

◆ CPU_haveARMSIMD()

static SDL_bool CPU_haveARMSIMD ( void  )
static

Definition at line 354 of file SDL_cpuinfo.c.

Referenced by CPU_haveAltiVec(), and SDL_GetCPUFeatures().

355 {
356 #warning SDL_HasARMSIMD is not implemented for this ARM platform. Write me.
357  return 0;
358 }

◆ CPU_haveAVX()

static int CPU_haveAVX ( void  )
static

Definition at line 519 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetCPUFeatures().

520 {
521  if (CPU_haveCPUID() && CPU_OSSavesYMM()) {
522  int a, b, c, d;
523 
524  cpuid(0, a, b, c, d);
525  if (a >= 1) {
526  cpuid(1, a, b, c, d);
527  return (c & 0x10000000);
528  }
529  }
530  return 0;
531 }
static SDL_bool CPU_OSSavesYMM(void)
Definition: SDL_cpuinfo.c:250
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ CPU_haveAVX2()

static int CPU_haveAVX2 ( void  )
static

Definition at line 534 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetCPUFeatures().

535 {
536  if (CPU_haveCPUID() && CPU_OSSavesYMM()) {
537  int a, b, c, d;
538 
539  cpuid(0, a, b, c, d);
540  if (a >= 7) {
541  cpuid(7, a, b, c, d);
542  return (b & 0x00000020);
543  }
544  }
545  return 0;
546 }
static SDL_bool CPU_OSSavesYMM(void)
Definition: SDL_cpuinfo.c:250
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ CPU_haveCPUID()

static int CPU_haveCPUID ( void  )
static

Definition at line 95 of file SDL_cpuinfo.c.

References done, mov, 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().

96 {
97  int has_CPUID = 0;
98 /* *INDENT-OFF* */
99 #ifndef SDL_CPUINFO_DISABLED
100 #if defined(__GNUC__) && defined(i386)
101  __asm__ (
102 " pushfl # Get original EFLAGS \n"
103 " popl %%eax \n"
104 " movl %%eax,%%ecx \n"
105 " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
106 " pushl %%eax # Save new EFLAGS value on stack \n"
107 " popfl # Replace current EFLAGS value \n"
108 " pushfl # Get new EFLAGS \n"
109 " popl %%eax # Store new EFLAGS in EAX \n"
110 " xorl %%ecx,%%eax # Can not toggle ID bit, \n"
111 " jz 1f # Processor=80486 \n"
112 " movl $1,%0 # We have CPUID support \n"
113 "1: \n"
114  : "=m" (has_CPUID)
115  :
116  : "%eax", "%ecx"
117  );
118 #elif defined(__GNUC__) && defined(__x86_64__)
119 /* Technically, if this is being compiled under __x86_64__ then it has
120  CPUid by definition. But it's nice to be able to prove it. :) */
121  __asm__ (
122 " pushfq # Get original EFLAGS \n"
123 " popq %%rax \n"
124 " movq %%rax,%%rcx \n"
125 " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
126 " pushq %%rax # Save new EFLAGS value on stack \n"
127 " popfq # Replace current EFLAGS value \n"
128 " pushfq # Get new EFLAGS \n"
129 " popq %%rax # Store new EFLAGS in EAX \n"
130 " xorl %%ecx,%%eax # Can not toggle ID bit, \n"
131 " jz 1f # Processor=80486 \n"
132 " movl $1,%0 # We have CPUID support \n"
133 "1: \n"
134  : "=m" (has_CPUID)
135  :
136  : "%rax", "%rcx"
137  );
138 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
139  __asm {
140  pushfd ; Get original EFLAGS
141  pop eax
142  mov ecx, eax
143  xor eax, 200000h ; Flip ID bit in EFLAGS
144  push eax ; Save new EFLAGS value on stack
145  popfd ; Replace current EFLAGS value
146  pushfd ; Get new EFLAGS
147  pop eax ; Store new EFLAGS in EAX
148  xor eax, ecx ; Can not toggle ID bit,
149  jz done ; Processor=80486
150  mov has_CPUID,1 ; We have CPUID support
151 done:
152  }
153 #elif defined(_MSC_VER) && defined(_M_X64)
154  has_CPUID = 1;
155 #elif defined(__sun) && defined(__i386)
156  __asm (
157 " pushfl \n"
158 " popl %eax \n"
159 " movl %eax,%ecx \n"
160 " xorl $0x200000,%eax \n"
161 " pushl %eax \n"
162 " popfl \n"
163 " pushfl \n"
164 " popl %eax \n"
165 " xorl %ecx,%eax \n"
166 " jz 1f \n"
167 " movl $1,-8(%ebp) \n"
168 "1: \n"
169  );
170 #elif defined(__sun) && defined(__amd64)
171  __asm (
172 " pushfq \n"
173 " popq %rax \n"
174 " movq %rax,%rcx \n"
175 " xorl $0x200000,%eax \n"
176 " pushq %rax \n"
177 " popfq \n"
178 " pushfq \n"
179 " popq %rax \n"
180 " xorl %ecx,%eax \n"
181 " jz 1f \n"
182 " movl $1,-8(%rbp) \n"
183 "1: \n"
184  );
185 #endif
186 #endif
187 /* *INDENT-ON* */
188  return has_CPUID;
189 }
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF mov
GLsizei const GLfloat * value
#define pop
Definition: SDL_qsort.c:192
int done
Definition: checkkeys.c:28
GLuint in
GLfloat GLfloat GLfloat GLfloat h

◆ CPU_haveMMX()

static int CPU_haveMMX ( void  )
static

Definition at line 432 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

433 {
434  if (CPU_haveCPUID()) {
435  return (CPU_getCPUIDFeatures() & 0x00800000);
436  }
437  return 0;
438 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:236

◆ CPU_haveNEON()

static int CPU_haveNEON ( void  )
static

Definition at line 384 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures().

385 {
386 /* The way you detect NEON is a privileged instruction on ARM, so you have
387  query the OS kernel in a platform-specific way. :/ */
388 #if defined(SDL_CPUINFO_DISABLED)
389  return 0; /* disabled */
390 #elif (defined(__WINDOWS__) || defined(__WINRT__)) && (defined(_M_ARM) || defined(_M_ARM64))
391 /* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */
392 /* Seems to have been removed */
393 # if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE)
394 # define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
395 # endif
396 /* All WinRT ARM devices are required to support NEON, but just in case. */
397  return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
398 #elif !defined(__ARM_ARCH)
399  return 0; /* not an ARM CPU at all. */
400 #elif __ARM_ARCH >= 8
401  return 1; /* ARMv8 always has non-optional NEON support. */
402 #elif defined(__APPLE__) && (__ARM_ARCH >= 7)
403  /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
404  return 1; /* all Apple ARMv7 chips and later have NEON. */
405 #elif defined(__APPLE__)
406  return 0; /* assume anything else from Apple doesn't have NEON. */
407 #elif defined(__QNXNTO__)
408  return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
409 #elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
410  return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON);
411 #elif defined(__LINUX__)
412  return readProcAuxvForNeon();
413 #elif defined(__ANDROID__)
414  /* Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo */
415  {
416  AndroidCpuFamily cpu_family = android_getCpuFamily();
417  if (cpu_family == ANDROID_CPU_FAMILY_ARM) {
418  uint64_t cpu_features = android_getCpuFeatures();
419  if ((cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
420  return 1;
421  }
422  }
423  return 0;
424  }
425 #else
426 #warning SDL_HasNEON is not implemented for this ARM platform. Write me.
427  return 0;
428 #endif
429 }
unsigned long long uint64_t

◆ CPU_haveRDTSC()

static int CPU_haveRDTSC ( void  )
static

Definition at line 282 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

283 {
284  if (CPU_haveCPUID()) {
285  return (CPU_getCPUIDFeatures() & 0x00000010);
286  }
287  return 0;
288 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:236

◆ CPU_haveSSE()

static int CPU_haveSSE ( void  )
static

Definition at line 456 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

457 {
458  if (CPU_haveCPUID()) {
459  return (CPU_getCPUIDFeatures() & 0x02000000);
460  }
461  return 0;
462 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:236

◆ CPU_haveSSE2()

static int CPU_haveSSE2 ( void  )
static

Definition at line 465 of file SDL_cpuinfo.c.

References CPU_getCPUIDFeatures(), and CPU_haveCPUID().

Referenced by SDL_GetCPUFeatures().

466 {
467  if (CPU_haveCPUID()) {
468  return (CPU_getCPUIDFeatures() & 0x04000000);
469  }
470  return 0;
471 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
static int CPU_getCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:236

◆ CPU_haveSSE3()

static int CPU_haveSSE3 ( void  )
static

Definition at line 474 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

475 {
476  if (CPU_haveCPUID()) {
477  int a, b, c, d;
478 
479  cpuid(0, a, b, c, d);
480  if (a >= 1) {
481  cpuid(1, a, b, c, d);
482  return (c & 0x00000001);
483  }
484  }
485  return 0;
486 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ CPU_haveSSE41()

static int CPU_haveSSE41 ( void  )
static

Definition at line 489 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

490 {
491  if (CPU_haveCPUID()) {
492  int a, b, c, d;
493 
494  cpuid(0, a, b, c, d);
495  if (a >= 1) {
496  cpuid(1, a, b, c, d);
497  return (c & 0x00080000);
498  }
499  }
500  return 0;
501 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ CPU_haveSSE42()

static int CPU_haveSSE42 ( void  )
static

Definition at line 504 of file SDL_cpuinfo.c.

References CPU_haveCPUID(), cpuid, and d.

Referenced by SDL_GetCPUFeatures().

505 {
506  if (CPU_haveCPUID()) {
507  int a, b, c, d;
508 
509  cpuid(0, a, b, c, d);
510  if (a >= 1) {
511  cpuid(1, a, b, c, d);
512  return (c & 0x00100000);
513  }
514  }
515  return 0;
516 }
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ CPU_OSSavesYMM()

static SDL_bool CPU_OSSavesYMM ( void  )
static

Definition at line 250 of file SDL_cpuinfo.c.

References cpuid, d, mov, SDL_FALSE, and SDL_TRUE.

Referenced by CPU_haveAVX(), and CPU_haveAVX2().

251 {
252  int a, b, c, d;
253 
254  /* Check to make sure we can call xgetbv */
255  cpuid(0, a, b, c, d);
256  if (a < 1) {
257  return SDL_FALSE;
258  }
259  cpuid(1, a, b, c, d);
260  if (!(c & 0x08000000)) {
261  return SDL_FALSE;
262  }
263 
264  /* Call xgetbv to see if YMM register state is saved */
265  a = 0;
266 #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
267  asm(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx");
268 #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */
269  a = (int)_xgetbv(0);
270 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
271  __asm
272  {
273  xor ecx, ecx
274  _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0
275  mov a, eax
276  }
277 #endif
278  return ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE;
279 }
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF mov
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ SDL_GetCPUCacheLineSize()

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 693 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

694 {
695  const char *cpuType = SDL_GetCPUType();
696  int a, b, c, d;
697  (void) a; (void) b; (void) c; (void) d;
698  if (SDL_strcmp(cpuType, "GenuineIntel") == 0) {
699  cpuid(0x00000001, a, b, c, d);
700  return (((b >> 8) & 0xff) * 8);
701  } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0) {
702  cpuid(0x80000005, a, b, c, d);
703  return (c & 0xff);
704  } else {
705  /* Just make a guess here... */
706  return SDL_CACHELINE_SIZE;
707  }
708 }
static const char * SDL_GetCPUType(void)
Definition: SDL_cpuinfo.c:584
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
#define SDL_CACHELINE_SIZE
Definition: SDL_cpuinfo.h:77
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
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
#define SDL_strcmp
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ SDL_GetCPUCount()

int SDL_GetCPUCount ( void  )

This function returns the number of CPU cores available.

Definition at line 551 of file SDL_cpuinfo.c.

References NULL, and SDL_CPUCount.

Referenced by SDL_GetSystemRAM().

552 {
553  if (!SDL_CPUCount) {
554 #ifndef SDL_CPUINFO_DISABLED
555 #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
556  if (SDL_CPUCount <= 0) {
557  SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
558  }
559 #endif
560 #ifdef HAVE_SYSCTLBYNAME
561  if (SDL_CPUCount <= 0) {
562  size_t size = sizeof(SDL_CPUCount);
563  sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0);
564  }
565 #endif
566 #ifdef __WIN32__
567  if (SDL_CPUCount <= 0) {
568  SYSTEM_INFO info;
569  GetSystemInfo(&info);
570  SDL_CPUCount = info.dwNumberOfProcessors;
571  }
572 #endif
573 #endif
574  /* There has to be at least 1, right? :) */
575  if (SDL_CPUCount <= 0) {
576  SDL_CPUCount = 1;
577  }
578  }
579  return SDL_CPUCount;
580 }
GLsizeiptr size
#define NULL
Definition: begin_code.h:143
static int SDL_CPUCount
Definition: SDL_cpuinfo.c:548

◆ SDL_GetCPUFeatures()

static Uint32 SDL_GetCPUFeatures ( void  )
static

Definition at line 713 of file SDL_cpuinfo.c.

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

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

714 {
715  if (SDL_CPUFeatures == 0xFFFFFFFF) {
716  SDL_CPUFeatures = 0;
717  if (CPU_haveRDTSC()) {
719  }
720  if (CPU_haveAltiVec()) {
722  }
723  if (CPU_haveMMX()) {
725  }
726  if (CPU_have3DNow()) {
728  }
729  if (CPU_haveSSE()) {
731  }
732  if (CPU_haveSSE2()) {
734  }
735  if (CPU_haveSSE3()) {
737  }
738  if (CPU_haveSSE41()) {
740  }
741  if (CPU_haveSSE42()) {
743  }
744  if (CPU_haveAVX()) {
746  }
747  if (CPU_haveAVX2()) {
749  }
750  if (CPU_haveARMSIMD()) {
752  }
753  if (CPU_haveNEON()) {
755  }
756  }
757  return SDL_CPUFeatures;
758 }
#define CPU_HAS_SSE41
Definition: SDL_cpuinfo.c:75
#define CPU_HAS_RDTSC
Definition: SDL_cpuinfo.c:68
#define CPU_HAS_SSE3
Definition: SDL_cpuinfo.c:74
static int CPU_haveSSE42(void)
Definition: SDL_cpuinfo.c:504
static int CPU_haveAVX(void)
Definition: SDL_cpuinfo.c:519
static int CPU_haveRDTSC(void)
Definition: SDL_cpuinfo.c:282
#define CPU_HAS_SSE2
Definition: SDL_cpuinfo.c:73
static SDL_bool CPU_haveARMSIMD(void)
Definition: SDL_cpuinfo.c:354
static int CPU_have3DNow(void)
Definition: SDL_cpuinfo.c:441
#define CPU_HAS_ALTIVEC
Definition: SDL_cpuinfo.c:69
static int CPU_haveAltiVec(void)
Definition: SDL_cpuinfo.c:291
#define CPU_HAS_AVX
Definition: SDL_cpuinfo.c:77
static int CPU_haveSSE3(void)
Definition: SDL_cpuinfo.c:474
#define CPU_HAS_NEON
Definition: SDL_cpuinfo.c:79
#define CPU_HAS_ARM_SIMD
Definition: SDL_cpuinfo.c:80
static Uint32 SDL_CPUFeatures
Definition: SDL_cpuinfo.c:710
static int CPU_haveSSE(void)
Definition: SDL_cpuinfo.c:456
#define CPU_HAS_SSE
Definition: SDL_cpuinfo.c:72
static int CPU_haveAVX2(void)
Definition: SDL_cpuinfo.c:534
#define CPU_HAS_AVX2
Definition: SDL_cpuinfo.c:78
static int CPU_haveNEON(void)
Definition: SDL_cpuinfo.c:384
#define CPU_HAS_MMX
Definition: SDL_cpuinfo.c:70
#define CPU_HAS_SSE42
Definition: SDL_cpuinfo.c:76
#define CPU_HAS_3DNOW
Definition: SDL_cpuinfo.c:71
static int CPU_haveSSE41(void)
Definition: SDL_cpuinfo.c:489
static int CPU_haveMMX(void)
Definition: SDL_cpuinfo.c:432
static int CPU_haveSSE2(void)
Definition: SDL_cpuinfo.c:465

◆ SDL_GetCPUType()

static const char* SDL_GetCPUType ( void  )
static

Definition at line 584 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetCPUCacheLineSize(), and SDL_GetSystemRAM().

585 {
586  static char SDL_CPUType[13];
587 
588  if (!SDL_CPUType[0]) {
589  int i = 0;
590 
591  if (CPU_haveCPUID()) {
592  int a, b, c, d;
593  cpuid(0x00000000, a, b, c, d);
594  (void) a;
595  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
596  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
597  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
598  SDL_CPUType[i++] = (char)(b & 0xff);
599 
600  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
601  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
602  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
603  SDL_CPUType[i++] = (char)(d & 0xff);
604 
605  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
606  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
607  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
608  SDL_CPUType[i++] = (char)(c & 0xff);
609  }
610  if (!SDL_CPUType[0]) {
611  SDL_strlcpy(SDL_CPUType, "Unknown", sizeof(SDL_CPUType));
612  }
613  }
614  return SDL_CPUType;
615 }
#define SDL_strlcpy
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:95
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
const GLubyte * c
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:231
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:50
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
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ SDL_GetSystemRAM()

int SDL_GetSystemRAM ( void  )

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

Definition at line 880 of file SDL_cpuinfo.c.

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

881 {
882  if (!SDL_SystemRAM) {
883 #ifndef SDL_CPUINFO_DISABLED
884 #if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
885  if (SDL_SystemRAM <= 0) {
886  SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
887  }
888 #endif
889 #ifdef HAVE_SYSCTLBYNAME
890  if (SDL_SystemRAM <= 0) {
891 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
892 #ifdef HW_REALMEM
893  int mib[2] = {CTL_HW, HW_REALMEM};
894 #else
895  /* might only report up to 2 GiB */
896  int mib[2] = {CTL_HW, HW_PHYSMEM};
897 #endif /* HW_REALMEM */
898 #else
899  int mib[2] = {CTL_HW, HW_MEMSIZE};
900 #endif /* __FreeBSD__ || __FreeBSD_kernel__ */
901  Uint64 memsize = 0;
902  size_t len = sizeof(memsize);
903 
904  if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
905  SDL_SystemRAM = (int)(memsize / (1024*1024));
906  }
907  }
908 #endif
909 #ifdef __WIN32__
910  if (SDL_SystemRAM <= 0) {
911  MEMORYSTATUSEX stat;
912  stat.dwLength = sizeof(stat);
913  if (GlobalMemoryStatusEx(&stat)) {
914  SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024));
915  }
916  }
917 #endif
918 #endif
919  }
920  return SDL_SystemRAM;
921 }
static int SDL_SystemRAM
Definition: SDL_cpuinfo.c:877
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:168
GLenum GLsizei len
#define NULL
Definition: begin_code.h:143
int64_t Sint64
A signed 64-bit integer type.
Definition: SDL_stdinc.h:164

◆ SDL_Has3DNow()

SDL_bool SDL_Has3DNow ( void  )

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

Definition at line 788 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

789 {
791  return SDL_TRUE;
792  }
793  return SDL_FALSE;
794 }
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713
#define CPU_HAS_3DNOW
Definition: SDL_cpuinfo.c:71

◆ SDL_HasAltiVec()

SDL_bool SDL_HasAltiVec ( void  )

This function returns true if the CPU has AltiVec features.

Definition at line 770 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

771 {
773  return SDL_TRUE;
774  }
775  return SDL_FALSE;
776 }
#define CPU_HAS_ALTIVEC
Definition: SDL_cpuinfo.c:69
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasARMSIMD()

SDL_bool SDL_HasARMSIMD ( void  )

This function returns true if the CPU has ARM SIMD (ARMv6) features.

Definition at line 860 of file SDL_cpuinfo.c.

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

Referenced by SDL_CalculateBlitA(), SDL_FillRect(), and SDL_GetSystemRAM().

861 {
863  return SDL_TRUE;
864  }
865  return SDL_FALSE;
866 }
#define CPU_HAS_ARM_SIMD
Definition: SDL_cpuinfo.c:80
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasAVX()

SDL_bool SDL_HasAVX ( void  )

This function returns true if the CPU has AVX features.

Definition at line 842 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

843 {
845  return SDL_TRUE;
846  }
847  return SDL_FALSE;
848 }
#define CPU_HAS_AVX
Definition: SDL_cpuinfo.c:77
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasAVX2()

SDL_bool SDL_HasAVX2 ( void  )

This function returns true if the CPU has AVX2 features.

Definition at line 851 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

852 {
854  return SDL_TRUE;
855  }
856  return SDL_FALSE;
857 }
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713
#define CPU_HAS_AVX2
Definition: SDL_cpuinfo.c:78

◆ SDL_HasMMX()

SDL_bool SDL_HasMMX ( void  )

This function returns true if the CPU has MMX features.

Definition at line 779 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

780 {
782  return SDL_TRUE;
783  }
784  return SDL_FALSE;
785 }
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713
#define CPU_HAS_MMX
Definition: SDL_cpuinfo.c:70

◆ SDL_HasNEON()

SDL_bool SDL_HasNEON ( void  )

This function returns true if the CPU has NEON (ARM SIMD) features.

Definition at line 869 of file SDL_cpuinfo.c.

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

Referenced by SDL_CalculateBlitA(), SDL_FillRect(), and SDL_GetSystemRAM().

870 {
872  return SDL_TRUE;
873  }
874  return SDL_FALSE;
875 }
#define CPU_HAS_NEON
Definition: SDL_cpuinfo.c:79
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasRDTSC()

SDL_bool SDL_HasRDTSC ( void  )

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

Definition at line 761 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

762 {
764  return SDL_TRUE;
765  }
766  return SDL_FALSE;
767 }
#define CPU_HAS_RDTSC
Definition: SDL_cpuinfo.c:68
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasSSE()

SDL_bool SDL_HasSSE ( void  )

This function returns true if the CPU has SSE features.

Definition at line 797 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

798 {
800  return SDL_TRUE;
801  }
802  return SDL_FALSE;
803 }
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713
#define CPU_HAS_SSE
Definition: SDL_cpuinfo.c:72

◆ SDL_HasSSE2()

SDL_bool SDL_HasSSE2 ( void  )

This function returns true if the CPU has SSE2 features.

Definition at line 806 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

807 {
809  return SDL_TRUE;
810  }
811  return SDL_FALSE;
812 }
#define CPU_HAS_SSE2
Definition: SDL_cpuinfo.c:73
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasSSE3()

SDL_bool SDL_HasSSE3 ( void  )

This function returns true if the CPU has SSE3 features.

Definition at line 815 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

816 {
818  return SDL_TRUE;
819  }
820  return SDL_FALSE;
821 }
#define CPU_HAS_SSE3
Definition: SDL_cpuinfo.c:74
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasSSE41()

SDL_bool SDL_HasSSE41 ( void  )

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

Definition at line 824 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

825 {
827  return SDL_TRUE;
828  }
829  return SDL_FALSE;
830 }
#define CPU_HAS_SSE41
Definition: SDL_cpuinfo.c:75
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713

◆ SDL_HasSSE42()

SDL_bool SDL_HasSSE42 ( void  )

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

Definition at line 833 of file SDL_cpuinfo.c.

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

Referenced by SDL_GetSystemRAM().

834 {
836  return SDL_TRUE;
837  }
838  return SDL_FALSE;
839 }
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:713
#define CPU_HAS_SSE42
Definition: SDL_cpuinfo.c:76

Variable Documentation

◆ SDL_CPUCount

int SDL_CPUCount = 0
static

Definition at line 548 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUCount().

◆ SDL_CPUFeatures

Uint32 SDL_CPUFeatures = 0xFFFFFFFF
static

Definition at line 710 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures().

◆ SDL_SystemRAM

int SDL_SystemRAM = 0
static

Definition at line 877 of file SDL_cpuinfo.c.

Referenced by SDL_GetSystemRAM().