SDL  2.0
SDL_cpuinfo.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #ifdef TEST_MAIN
22 #include "SDL_config.h"
23 #else
24 #include "../SDL_internal.h"
25 #endif
26 
27 #if defined(__WIN32__) || defined(__WINRT__)
28 #include "../core/windows/SDL_windows.h"
29 #endif
30 #if defined(__OS2__)
31 #define INCL_DOS
32 #include <os2.h>
33 #ifndef QSV_NUMPROCESSORS
34 #define QSV_NUMPROCESSORS 26
35 #endif
36 #endif
37 
38 /* CPU feature detection for SDL */
39 
40 #include "SDL_cpuinfo.h"
41 #include "SDL_assert.h"
42 
43 #ifdef HAVE_SYSCONF
44 #include <unistd.h>
45 #endif
46 #ifdef HAVE_SYSCTLBYNAME
47 #include <sys/types.h>
48 #include <sys/sysctl.h>
49 #endif
50 #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
51 #include <sys/sysctl.h> /* For AltiVec check */
52 #elif defined(__OpenBSD__) && defined(__powerpc__)
53 #include <sys/param.h>
54 #include <sys/sysctl.h> /* For AltiVec check */
55 #include <machine/cpu.h>
56 #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
57 #include <signal.h>
58 #include <setjmp.h>
59 #endif
60 
61 #if defined(__QNXNTO__)
62 #include <sys/syspage.h>
63 #endif
64 
65 #if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH)
66 /*#include <asm/hwcap.h>*/
67 #ifndef AT_HWCAP
68 #define AT_HWCAP 16
69 #endif
70 #ifndef AT_PLATFORM
71 #define AT_PLATFORM 15
72 #endif
73 /* Prevent compilation error when including elf.h would also try to define AT_* as an enum */
74 #ifndef AT_NULL
75 #define AT_NULL 0
76 #endif
77 #ifndef HWCAP_NEON
78 #define HWCAP_NEON (1 << 12)
79 #endif
80 #if defined HAVE_GETAUXVAL
81 #include <sys/auxv.h>
82 #else
83 #include <fcntl.h>
84 #endif
85 #endif
86 
87 #if defined(__ANDROID__) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL)
88 #if __ARM_ARCH < 8
89 #include <cpu-features.h>
90 #endif
91 #endif
92 
93 #ifdef __RISCOS__
94 #include <kernel.h>
95 #include <swis.h>
96 #endif
97 
98 #define CPU_HAS_RDTSC (1 << 0)
99 #define CPU_HAS_ALTIVEC (1 << 1)
100 #define CPU_HAS_MMX (1 << 2)
101 #define CPU_HAS_3DNOW (1 << 3)
102 #define CPU_HAS_SSE (1 << 4)
103 #define CPU_HAS_SSE2 (1 << 5)
104 #define CPU_HAS_SSE3 (1 << 6)
105 #define CPU_HAS_SSE41 (1 << 7)
106 #define CPU_HAS_SSE42 (1 << 8)
107 #define CPU_HAS_AVX (1 << 9)
108 #define CPU_HAS_AVX2 (1 << 10)
109 #define CPU_HAS_NEON (1 << 11)
110 #define CPU_HAS_AVX512F (1 << 12)
111 #define CPU_HAS_ARM_SIMD (1 << 13)
112 
113 #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__
114 /* This is the brute force way of detecting instruction sets...
115  the idea is borrowed from the libmpeg2 library - thanks!
116  */
117 static jmp_buf jmpbuf;
118 static void
119 illegal_instruction(int sig)
120 {
121  longjmp(jmpbuf, 1);
122 }
123 #endif /* HAVE_SETJMP */
124 
125 static int
127 {
128  int has_CPUID = 0;
129 
130 /* *INDENT-OFF* */
131 #ifndef SDL_CPUINFO_DISABLED
132 #if defined(__GNUC__) && defined(i386)
133  __asm__ (
134 " pushfl # Get original EFLAGS \n"
135 " popl %%eax \n"
136 " movl %%eax,%%ecx \n"
137 " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
138 " pushl %%eax # Save new EFLAGS value on stack \n"
139 " popfl # Replace current EFLAGS value \n"
140 " pushfl # Get new EFLAGS \n"
141 " popl %%eax # Store new EFLAGS in EAX \n"
142 " xorl %%ecx,%%eax # Can not toggle ID bit, \n"
143 " jz 1f # Processor=80486 \n"
144 " movl $1,%0 # We have CPUID support \n"
145 "1: \n"
146  : "=m" (has_CPUID)
147  :
148  : "%eax", "%ecx"
149  );
150 #elif defined(__GNUC__) && defined(__x86_64__)
151 /* Technically, if this is being compiled under __x86_64__ then it has
152  CPUid by definition. But it's nice to be able to prove it. :) */
153  __asm__ (
154 " pushfq # Get original EFLAGS \n"
155 " popq %%rax \n"
156 " movq %%rax,%%rcx \n"
157 " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
158 " pushq %%rax # Save new EFLAGS value on stack \n"
159 " popfq # Replace current EFLAGS value \n"
160 " pushfq # Get new EFLAGS \n"
161 " popq %%rax # Store new EFLAGS in EAX \n"
162 " xorl %%ecx,%%eax # Can not toggle ID bit, \n"
163 " jz 1f # Processor=80486 \n"
164 " movl $1,%0 # We have CPUID support \n"
165 "1: \n"
166  : "=m" (has_CPUID)
167  :
168  : "%rax", "%rcx"
169  );
170 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
171  __asm {
172  pushfd ; Get original EFLAGS
173  pop eax
174  mov ecx, eax
175  xor eax, 200000h ; Flip ID bit in EFLAGS
176  push eax ; Save new EFLAGS value on stack
177  popfd ; Replace current EFLAGS value
178  pushfd ; Get new EFLAGS
179  pop eax ; Store new EFLAGS in EAX
180  xor eax, ecx ; Can not toggle ID bit,
181  jz done ; Processor=80486
182  mov has_CPUID,1 ; We have CPUID support
183 done:
184  }
185 #elif defined(_MSC_VER) && defined(_M_X64)
186  has_CPUID = 1;
187 #elif defined(__sun) && defined(__i386)
188  __asm (
189 " pushfl \n"
190 " popl %eax \n"
191 " movl %eax,%ecx \n"
192 " xorl $0x200000,%eax \n"
193 " pushl %eax \n"
194 " popfl \n"
195 " pushfl \n"
196 " popl %eax \n"
197 " xorl %ecx,%eax \n"
198 " jz 1f \n"
199 " movl $1,-8(%ebp) \n"
200 "1: \n"
201  );
202 #elif defined(__sun) && defined(__amd64)
203  __asm (
204 " pushfq \n"
205 " popq %rax \n"
206 " movq %rax,%rcx \n"
207 " xorl $0x200000,%eax \n"
208 " pushq %rax \n"
209 " popfq \n"
210 " pushfq \n"
211 " popq %rax \n"
212 " xorl %ecx,%eax \n"
213 " jz 1f \n"
214 " movl $1,-8(%rbp) \n"
215 "1: \n"
216  );
217 #endif
218 #endif
219 /* *INDENT-ON* */
220  return has_CPUID;
221 }
222 
223 #if defined(__GNUC__) && defined(i386)
224 #define cpuid(func, a, b, c, d) \
225  __asm__ __volatile__ ( \
226 " pushl %%ebx \n" \
227 " xorl %%ecx,%%ecx \n" \
228 " cpuid \n" \
229 " movl %%ebx, %%esi \n" \
230 " popl %%ebx \n" : \
231  "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
232 #elif defined(__GNUC__) && defined(__x86_64__)
233 #define cpuid(func, a, b, c, d) \
234  __asm__ __volatile__ ( \
235 " pushq %%rbx \n" \
236 " xorq %%rcx,%%rcx \n" \
237 " cpuid \n" \
238 " movq %%rbx, %%rsi \n" \
239 " popq %%rbx \n" : \
240  "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
241 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
242 #define cpuid(func, a, b, c, d) \
243  __asm { \
244  __asm mov eax, func \
245  __asm xor ecx, ecx \
246  __asm cpuid \
247  __asm mov a, eax \
248  __asm mov b, ebx \
249  __asm mov c, ecx \
250  __asm mov d, edx \
251 }
252 #elif defined(_MSC_VER) && defined(_M_X64)
253 #define cpuid(func, a, b, c, d) \
254 { \
255  int CPUInfo[4]; \
256  __cpuid(CPUInfo, func); \
257  a = CPUInfo[0]; \
258  b = CPUInfo[1]; \
259  c = CPUInfo[2]; \
260  d = CPUInfo[3]; \
261 }
262 #else
263 #define cpuid(func, a, b, c, d) \
264  do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0)
265 #endif
266 
267 static int CPU_CPUIDFeatures[4];
268 static int CPU_CPUIDMaxFunction = 0;
271 
272 static void
274 {
275  static SDL_bool checked = SDL_FALSE;
276  if (!checked) {
277  checked = SDL_TRUE;
278  if (CPU_haveCPUID()) {
279  int a, b, c, d;
280  cpuid(0, a, b, c, d);
282  if (CPU_CPUIDMaxFunction >= 1) {
283  cpuid(1, a, b, c, d);
284  CPU_CPUIDFeatures[0] = a;
285  CPU_CPUIDFeatures[1] = b;
286  CPU_CPUIDFeatures[2] = c;
287  CPU_CPUIDFeatures[3] = d;
288 
289  /* Check to make sure we can call xgetbv */
290  if (c & 0x08000000) {
291  /* Call xgetbv to see if YMM (etc) register state is saved */
292 #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
293  __asm__(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx");
294 #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */
295  a = (int)_xgetbv(0);
296 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
297  __asm
298  {
299  xor ecx, ecx
300  _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0
301  mov a, eax
302  }
303 #endif
304  CPU_OSSavesYMM = ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE;
305  CPU_OSSavesZMM = (CPU_OSSavesYMM && ((a & 0xe0) == 0xe0)) ? SDL_TRUE : SDL_FALSE;
306  }
307  }
308  }
309  }
310 }
311 
312 static int
314 {
315  volatile int altivec = 0;
316 #ifndef SDL_CPUINFO_DISABLED
317 #if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
318 #ifdef __OpenBSD__
319  int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
320 #else
321  int selectors[2] = { CTL_HW, HW_VECTORUNIT };
322 #endif
323  int hasVectorUnit = 0;
324  size_t length = sizeof(hasVectorUnit);
325  int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
326  if (0 == error)
327  altivec = (hasVectorUnit != 0);
328 #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
329  void (*handler) (int sig);
330  handler = signal(SIGILL, illegal_instruction);
331  if (setjmp(jmpbuf) == 0) {
332  asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0"::"r" (-1));
333  altivec = 1;
334  }
335  signal(SIGILL, handler);
336 #endif
337 #endif
338  return altivec;
339 }
340 
341 #if defined(__ARM_ARCH) && (__ARM_ARCH >= 6)
342 static int
343 CPU_haveARMSIMD(void)
344 {
345  return 1;
346 }
347 
348 #elif !defined(__arm__)
349 static int
351 {
352  return 0;
353 }
354 
355 #elif defined(__LINUX__)
356 #include <unistd.h>
357 #include <sys/types.h>
358 #include <sys/stat.h>
359 #include <fcntl.h>
360 #include <elf.h>
361 
362 static int
363 CPU_haveARMSIMD(void)
364 {
365  int arm_simd = 0;
366  int fd;
367 
368  fd = open("/proc/self/auxv", O_RDONLY);
369  if (fd >= 0)
370  {
371  Elf32_auxv_t aux;
372  while (read(fd, &aux, sizeof aux) == sizeof aux)
373  {
374  if (aux.a_type == AT_PLATFORM)
375  {
376  const char *plat = (const char *) aux.a_un.a_val;
377  if (plat) {
378  arm_simd = strncmp(plat, "v6l", 3) == 0 ||
379  strncmp(plat, "v7l", 3) == 0;
380  }
381  }
382  }
383  close(fd);
384  }
385  return arm_simd;
386 }
387 
388 #elif defined(__RISCOS__)
389 
390 static int
391 CPU_haveARMSIMD(void)
392 {
393  _kernel_swi_regs regs;
394  regs.r[0] = 0;
395  if (_kernel_swi(OS_PlatformFeatures, &regs, &regs) != NULL)
396  return 0;
397 
398  if (!(regs.r[0] & (1<<31)))
399  return 0;
400 
401  regs.r[0] = 34;
402  regs.r[1] = 29;
403  if (_kernel_swi(OS_PlatformFeatures, &regs, &regs) != NULL)
404  return 0;
405 
406  return regs.r[0];
407 }
408 
409 #else
410 static int
411 CPU_haveARMSIMD(void)
412 {
413 #warning SDL_HasARMSIMD is not implemented for this ARM platform. Write me.
414  return 0;
415 }
416 #endif
417 
418 #if defined(__LINUX__) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL)
419 static int
420 readProcAuxvForNeon(void)
421 {
422  int neon = 0;
423  int kv[2];
424  const int fd = open("/proc/self/auxv", O_RDONLY);
425  if (fd != -1) {
426  while (read(fd, kv, sizeof (kv)) == sizeof (kv)) {
427  if (kv[0] == AT_HWCAP) {
428  neon = ((kv[1] & HWCAP_NEON) == HWCAP_NEON);
429  break;
430  }
431  }
432  close(fd);
433  }
434  return neon;
435 }
436 #endif
437 
438 static int
440 {
441 /* The way you detect NEON is a privileged instruction on ARM, so you have
442  query the OS kernel in a platform-specific way. :/ */
443 #if defined(SDL_CPUINFO_DISABLED)
444  return 0; /* disabled */
445 #elif (defined(__WINDOWS__) || defined(__WINRT__)) && (defined(_M_ARM) || defined(_M_ARM64))
446 /* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */
447 /* Seems to have been removed */
448 # if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE)
449 # define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
450 # endif
451 /* All WinRT ARM devices are required to support NEON, but just in case. */
452  return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
453 #elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8)
454  return 1; /* ARMv8 always has non-optional NEON support. */
455 #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
456  /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
457  return 1; /* all Apple ARMv7 chips and later have NEON. */
458 #elif defined(__APPLE__)
459  return 0; /* assume anything else from Apple doesn't have NEON. */
460 #elif !defined(__arm__)
461  return 0; /* not an ARM CPU at all. */
462 #elif defined(__QNXNTO__)
463  return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
464 #elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
465  return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON);
466 #elif defined(__LINUX__)
467  return readProcAuxvForNeon();
468 #elif defined(__ANDROID__)
469  /* Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo */
470  {
471  AndroidCpuFamily cpu_family = android_getCpuFamily();
472  if (cpu_family == ANDROID_CPU_FAMILY_ARM) {
473  uint64_t cpu_features = android_getCpuFeatures();
474  if ((cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
475  return 1;
476  }
477  }
478  return 0;
479  }
480 #elif defined(__RISCOS__)
481  /* Use the VFPSupport_Features SWI to access the MVFR registers */
482  {
483  _kernel_swi_regs regs;
484  regs.r[0] = 0;
485  if (_kernel_swi(VFPSupport_Features, &regs, &regs) == NULL) {
486  if ((regs.r[2] & 0xFFF000) == 0x111000) {
487  return 1;
488  }
489  }
490  return 0;
491  }
492 #else
493 #warning SDL_HasNEON is not implemented for this ARM platform. Write me.
494  return 0;
495 #endif
496 }
497 
498 static int
500 {
501  if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */
502  int a, b, c, d;
503  cpuid(0x80000000, a, b, c, d);
504  if (a >= 0x80000001) {
505  cpuid(0x80000001, a, b, c, d);
506  return (d & 0x80000000);
507  }
508  }
509  return 0;
510 }
511 
512 #define CPU_haveRDTSC() (CPU_CPUIDFeatures[3] & 0x00000010)
513 #define CPU_haveMMX() (CPU_CPUIDFeatures[3] & 0x00800000)
514 #define CPU_haveSSE() (CPU_CPUIDFeatures[3] & 0x02000000)
515 #define CPU_haveSSE2() (CPU_CPUIDFeatures[3] & 0x04000000)
516 #define CPU_haveSSE3() (CPU_CPUIDFeatures[2] & 0x00000001)
517 #define CPU_haveSSE41() (CPU_CPUIDFeatures[2] & 0x00080000)
518 #define CPU_haveSSE42() (CPU_CPUIDFeatures[2] & 0x00100000)
519 #define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000))
520 
521 static int
523 {
524  if (CPU_OSSavesYMM && (CPU_CPUIDMaxFunction >= 7)) {
525  int a, b, c, d;
526  (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */
527  cpuid(7, a, b, c, d);
528  return (b & 0x00000020);
529  }
530  return 0;
531 }
532 
533 static int
535 {
536  if (CPU_OSSavesZMM && (CPU_CPUIDMaxFunction >= 7)) {
537  int a, b, c, d;
538  (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */
539  cpuid(7, a, b, c, d);
540  return (b & 0x00010000);
541  }
542  return 0;
543 }
544 
545 static int SDL_CPUCount = 0;
546 
547 int
549 {
550  if (!SDL_CPUCount) {
551 #ifndef SDL_CPUINFO_DISABLED
552 #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
553  if (SDL_CPUCount <= 0) {
554  SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
555  }
556 #endif
557 #ifdef HAVE_SYSCTLBYNAME
558  if (SDL_CPUCount <= 0) {
559  size_t size = sizeof(SDL_CPUCount);
560  sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0);
561  }
562 #endif
563 #ifdef __WIN32__
564  if (SDL_CPUCount <= 0) {
565  SYSTEM_INFO info;
566  GetSystemInfo(&info);
567  SDL_CPUCount = info.dwNumberOfProcessors;
568  }
569 #endif
570 #ifdef __OS2__
571  if (SDL_CPUCount <= 0) {
572  DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS,
573  &SDL_CPUCount, sizeof(SDL_CPUCount) );
574  }
575 #endif
576 #endif
577  /* There has to be at least 1, right? :) */
578  if (SDL_CPUCount <= 0) {
579  SDL_CPUCount = 1;
580  }
581  }
582  return SDL_CPUCount;
583 }
584 
585 /* Oh, such a sweet sweet trick, just not very useful. :) */
586 static const char *
588 {
589  static char SDL_CPUType[13];
590 
591  if (!SDL_CPUType[0]) {
592  int i = 0;
593 
595  if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */
596  int a, b, c, d;
597  cpuid(0x00000000, a, b, c, d);
598  (void) a;
599  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
600  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
601  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
602  SDL_CPUType[i++] = (char)(b & 0xff);
603 
604  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
605  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
606  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
607  SDL_CPUType[i++] = (char)(d & 0xff);
608 
609  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
610  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
611  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
612  SDL_CPUType[i++] = (char)(c & 0xff);
613  }
614  if (!SDL_CPUType[0]) {
615  SDL_strlcpy(SDL_CPUType, "Unknown", sizeof(SDL_CPUType));
616  }
617  }
618  return SDL_CPUType;
619 }
620 
621 
622 #ifdef TEST_MAIN /* !!! FIXME: only used for test at the moment. */
623 static const char *
624 SDL_GetCPUName(void)
625 {
626  static char SDL_CPUName[48];
627 
628  if (!SDL_CPUName[0]) {
629  int i = 0;
630  int a, b, c, d;
631 
633  if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */
634  cpuid(0x80000000, a, b, c, d);
635  if (a >= 0x80000004) {
636  cpuid(0x80000002, a, b, c, d);
637  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
638  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
639  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
640  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
641  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
642  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
643  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
644  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
645  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
646  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
647  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
648  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
649  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
650  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
651  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
652  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
653  cpuid(0x80000003, a, b, c, d);
654  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
655  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
656  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
657  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
658  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
659  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
660  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
661  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
662  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
663  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
664  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
665  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
666  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
667  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
668  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
669  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
670  cpuid(0x80000004, a, b, c, d);
671  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
672  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
673  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
674  SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
675  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
676  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
677  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
678  SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
679  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
680  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
681  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
682  SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
683  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
684  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
685  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
686  SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
687  }
688  }
689  if (!SDL_CPUName[0]) {
690  SDL_strlcpy(SDL_CPUName, "Unknown", sizeof(SDL_CPUName));
691  }
692  }
693  return SDL_CPUName;
694 }
695 #endif
696 
697 int
699 {
700  const char *cpuType = SDL_GetCPUType();
701  int a, b, c, d;
702  (void) a; (void) b; (void) c; (void) d;
703  if (SDL_strcmp(cpuType, "GenuineIntel") == 0) {
704  cpuid(0x00000001, a, b, c, d);
705  return (((b >> 8) & 0xff) * 8);
706  } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0 || SDL_strcmp(cpuType, "HygonGenuine") == 0) {
707  cpuid(0x80000005, a, b, c, d);
708  return (c & 0xff);
709  } else {
710  /* Just make a guess here... */
711  return SDL_CACHELINE_SIZE;
712  }
713 }
714 
715 static Uint32 SDL_CPUFeatures = 0xFFFFFFFF;
716 static Uint32 SDL_SIMDAlignment = 0xFFFFFFFF;
717 
718 static Uint32
720 {
721  if (SDL_CPUFeatures == 0xFFFFFFFF) {
723  SDL_CPUFeatures = 0;
724  SDL_SIMDAlignment = sizeof(void *); /* a good safe base value */
725  if (CPU_haveRDTSC()) {
727  }
728  if (CPU_haveAltiVec()) {
731  }
732  if (CPU_haveMMX()) {
735  }
736  if (CPU_have3DNow()) {
739  }
740  if (CPU_haveSSE()) {
743  }
744  if (CPU_haveSSE2()) {
747  }
748  if (CPU_haveSSE3()) {
751  }
752  if (CPU_haveSSE41()) {
755  }
756  if (CPU_haveSSE42()) {
759  }
760  if (CPU_haveAVX()) {
763  }
764  if (CPU_haveAVX2()) {
767  }
768  if (CPU_haveAVX512F()) {
771  }
772  if (CPU_haveARMSIMD()) {
775  }
776  if (CPU_haveNEON()) {
779  }
780  }
781  return SDL_CPUFeatures;
782 }
783 
784 #define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE)
785 
787 {
789 }
790 
791 SDL_bool
793 {
795 }
796 
797 SDL_bool
799 {
801 }
802 
803 SDL_bool
805 {
807 }
808 
809 SDL_bool
811 {
813 }
814 
815 SDL_bool
817 {
819 }
820 
821 SDL_bool
823 {
825 }
826 
827 SDL_bool
829 {
831 }
832 
833 SDL_bool
835 {
837 }
838 
839 SDL_bool
841 {
843 }
844 
845 SDL_bool
847 {
849 }
850 
851 SDL_bool
853 {
855 }
856 
857 SDL_bool
859 {
861 }
862 
863 SDL_bool
865 {
867 }
868 
869 static int SDL_SystemRAM = 0;
870 
871 int
873 {
874  if (!SDL_SystemRAM) {
875 #ifndef SDL_CPUINFO_DISABLED
876 #if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
877  if (SDL_SystemRAM <= 0) {
878  SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
879  }
880 #endif
881 #ifdef HAVE_SYSCTLBYNAME
882  if (SDL_SystemRAM <= 0) {
883 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
884 #ifdef HW_REALMEM
885  int mib[2] = {CTL_HW, HW_REALMEM};
886 #else
887  /* might only report up to 2 GiB */
888  int mib[2] = {CTL_HW, HW_PHYSMEM};
889 #endif /* HW_REALMEM */
890 #else
891  int mib[2] = {CTL_HW, HW_MEMSIZE};
892 #endif /* __FreeBSD__ || __FreeBSD_kernel__ */
893  Uint64 memsize = 0;
894  size_t len = sizeof(memsize);
895 
896  if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
897  SDL_SystemRAM = (int)(memsize / (1024*1024));
898  }
899  }
900 #endif
901 #ifdef __WIN32__
902  if (SDL_SystemRAM <= 0) {
903  MEMORYSTATUSEX stat;
904  stat.dwLength = sizeof(stat);
905  if (GlobalMemoryStatusEx(&stat)) {
906  SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024));
907  }
908  }
909 #endif
910 #ifdef __OS2__
911  if (SDL_SystemRAM <= 0) {
912  Uint32 sysram = 0;
913  DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4);
914  SDL_SystemRAM = (int) (sysram / 0x100000U);
915  }
916 #endif
917 #ifdef __RISCOS__
918  if (SDL_SystemRAM <= 0) {
919  _kernel_swi_regs regs;
920  regs.r[0] = 0x108;
921  if (_kernel_swi(OS_Memory, &regs, &regs) == NULL) {
922  SDL_SystemRAM = (int)(regs.r[1] * regs.r[2] / (1024 * 1024));
923  }
924  }
925 #endif
926 #endif
927  }
928  return SDL_SystemRAM;
929 }
930 
931 
932 size_t
934 {
935  if (SDL_SIMDAlignment == 0xFFFFFFFF) {
936  SDL_GetCPUFeatures(); /* make sure this has been calculated */
937  }
939  return SDL_SIMDAlignment;
940 }
941 
942 void *
943 SDL_SIMDAlloc(const size_t len)
944 {
945  const size_t alignment = SDL_SIMDGetAlignment();
946  const size_t padding = alignment - (len % alignment);
947  const size_t padded = (padding != alignment) ? (len + padding) : len;
948  Uint8 *retval = NULL;
949  Uint8 *ptr = (Uint8 *) SDL_malloc(padded + alignment + sizeof (void *));
950  if (ptr) {
951  /* store the actual malloc pointer right before our aligned pointer. */
952  retval = ptr + sizeof (void *);
953  retval += alignment - (((size_t) retval) % alignment);
954  *(((void **) retval) - 1) = ptr;
955  }
956  return retval;
957 }
958 
959 void
961 {
962  if (ptr) {
963  void **realptr = (void **) ptr;
964  realptr--;
965  SDL_free(*(((void **) ptr) - 1));
966  }
967 }
968 
969 
970 #ifdef TEST_MAIN
971 
972 #include <stdio.h>
973 
974 int
975 main()
976 {
977  printf("CPU count: %d\n", SDL_GetCPUCount());
978  printf("CPU type: %s\n", SDL_GetCPUType());
979  printf("CPU name: %s\n", SDL_GetCPUName());
980  printf("CacheLine size: %d\n", SDL_GetCPUCacheLineSize());
981  printf("RDTSC: %d\n", SDL_HasRDTSC());
982  printf("Altivec: %d\n", SDL_HasAltiVec());
983  printf("MMX: %d\n", SDL_HasMMX());
984  printf("3DNow: %d\n", SDL_Has3DNow());
985  printf("SSE: %d\n", SDL_HasSSE());
986  printf("SSE2: %d\n", SDL_HasSSE2());
987  printf("SSE3: %d\n", SDL_HasSSE3());
988  printf("SSE4.1: %d\n", SDL_HasSSE41());
989  printf("SSE4.2: %d\n", SDL_HasSSE42());
990  printf("AVX: %d\n", SDL_HasAVX());
991  printf("AVX2: %d\n", SDL_HasAVX2());
992  printf("AVX-512F: %d\n", SDL_HasAVX512F());
993  printf("ARM SIMD: %d\n", SDL_HasARMSIMD());
994  printf("NEON: %d\n", SDL_HasNEON());
995  printf("RAM: %d MB\n", SDL_GetSystemRAM());
996  return 0;
997 }
998 
999 #endif /* TEST_MAIN */
1000 
1001 /* vi: set ts=4 sw=4 expandtab: */
CPU_haveMMX
#define CPU_haveMMX()
Definition: SDL_cpuinfo.c:513
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_HasSSE42
SDL_bool SDL_HasSSE42(void)
Definition: SDL_cpuinfo.c:834
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
SDL_CACHELINE_SIZE
#define SDL_CACHELINE_SIZE
Definition: SDL_cpuinfo.h:114
CPU_OSSavesZMM
static SDL_bool CPU_OSSavesZMM
Definition: SDL_cpuinfo.c:270
CPU_haveAltiVec
static int CPU_haveAltiVec(void)
Definition: SDL_cpuinfo.c:313
Sint64
int64_t Sint64
Definition: SDL_stdinc.h:210
SDL_GetCPUType
static const char * SDL_GetCPUType(void)
Definition: SDL_cpuinfo.c:587
SDL_strlcpy
#define SDL_strlcpy
Definition: SDL_dynapi_overrides.h:394
SDL_HasAVX
SDL_bool SDL_HasAVX(void)
Definition: SDL_cpuinfo.c:840
SDL_CPUFeatures
static Uint32 SDL_CPUFeatures
Definition: SDL_cpuinfo.c:715
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:719
CPU_HAS_SSE
#define CPU_HAS_SSE
Definition: SDL_cpuinfo.c:102
in
GLuint in
Definition: SDL_opengl_glext.h:7943
if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
Definition: pixman-arm-neon-asm.h:469
NULL
#define NULL
Definition: begin_code.h:167
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
CPU_haveAVX
#define CPU_haveAVX()
Definition: SDL_cpuinfo.c:519
CPU_HAS_SSE41
#define CPU_HAS_SSE41
Definition: SDL_cpuinfo.c:105
size_t
unsigned int size_t
Definition: SDL_config_windows.h:68
CPU_HAS_AVX2
#define CPU_HAS_AVX2
Definition: SDL_cpuinfo.c:108
CPU_HAS_ALTIVEC
#define CPU_HAS_ALTIVEC
Definition: SDL_cpuinfo.c:99
SDL_SystemRAM
static int SDL_SystemRAM
Definition: SDL_cpuinfo.c:869
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:126
SDL_HasARMSIMD
SDL_bool SDL_HasARMSIMD(void)
Definition: SDL_cpuinfo.c:858
SDL_HasSSE2
SDL_bool SDL_HasSSE2(void)
Definition: SDL_cpuinfo.c:816
CPU_HAS_3DNOW
#define CPU_HAS_3DNOW
Definition: SDL_cpuinfo.c:101
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
CPU_FEATURE_AVAILABLE
#define CPU_FEATURE_AVAILABLE(f)
Definition: SDL_cpuinfo.c:784
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:672
main
#define main
Definition: SDL_main.h:109
CPU_HAS_NEON
#define CPU_HAS_NEON
Definition: SDL_cpuinfo.c:109
CPU_HAS_SSE42
#define CPU_HAS_SSE42
Definition: SDL_cpuinfo.c:106
SDL_SIMDAlignment
static Uint32 SDL_SIMDAlignment
Definition: SDL_cpuinfo.c:716
CPU_haveSSE
#define CPU_haveSSE()
Definition: SDL_cpuinfo.c:514
CPU_HAS_ARM_SIMD
#define CPU_HAS_ARM_SIMD
Definition: SDL_cpuinfo.c:111
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2929
done
int done
Definition: checkkeys.c:28
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_GetCPUCount
int SDL_GetCPUCount(void)
Definition: SDL_cpuinfo.c:548
SDL_GetCPUCacheLineSize
int SDL_GetCPUCacheLineSize(void)
Definition: SDL_cpuinfo.c:698
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_max
#define SDL_max(x, y)
Definition: SDL_stdinc.h:407
SDL_cpuinfo.h
CPU_HAS_SSE2
#define CPU_HAS_SSE2
Definition: SDL_cpuinfo.c:103
mov
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
Definition: pixman-arm-simd-asm.h:214
CPU_haveSSE41
#define CPU_haveSSE41()
Definition: SDL_cpuinfo.c:517
SDL_GetSystemRAM
int SDL_GetSystemRAM(void)
Definition: SDL_cpuinfo.c:872
CPU_HAS_RDTSC
#define CPU_HAS_RDTSC
Definition: SDL_cpuinfo.c:98
CPU_HAS_AVX512F
#define CPU_HAS_AVX512F
Definition: SDL_cpuinfo.c:110
SDL_assert.h
CPU_haveNEON
static int CPU_haveNEON(void)
Definition: SDL_cpuinfo.c:439
SDL_SIMDGetAlignment
size_t SDL_SIMDGetAlignment(void)
Report the alignment this system needs for SIMD allocations.
Definition: SDL_cpuinfo.c:933
SDL_HasSSE3
SDL_bool SDL_HasSSE3(void)
Definition: SDL_cpuinfo.c:822
SDL_HasRDTSC
SDL_bool SDL_HasRDTSC(void)
Definition: SDL_cpuinfo.c:786
pop
#define pop
Definition: SDL_qsort.c:196
CPU_HAS_MMX
#define CPU_HAS_MMX
Definition: SDL_cpuinfo.c:100
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_SIMDAlloc
void * SDL_SIMDAlloc(const size_t len)
Allocate memory in a SIMD-friendly way.
Definition: SDL_cpuinfo.c:943
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_Has3DNow
SDL_bool SDL_Has3DNow(void)
Definition: SDL_cpuinfo.c:804
CPU_calcCPUIDFeatures
static void CPU_calcCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:273
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:540
CPU_haveSSE2
#define CPU_haveSSE2()
Definition: SDL_cpuinfo.c:515
SDL_HasAVX512F
SDL_bool SDL_HasAVX512F(void)
Definition: SDL_cpuinfo.c:852
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
CPU_CPUIDFeatures
static int CPU_CPUIDFeatures[4]
Definition: SDL_cpuinfo.c:267
Uint64
uint64_t Uint64
Definition: SDL_stdinc.h:216
CPU_haveSSE42
#define CPU_haveSSE42()
Definition: SDL_cpuinfo.c:518
CPU_OSSavesYMM
static SDL_bool CPU_OSSavesYMM
Definition: SDL_cpuinfo.c:269
CPU_HAS_SSE3
#define CPU_HAS_SSE3
Definition: SDL_cpuinfo.c:104
CPU_have3DNow
static int CPU_have3DNow(void)
Definition: SDL_cpuinfo.c:499
SDL_HasSSE41
SDL_bool SDL_HasSSE41(void)
Definition: SDL_cpuinfo.c:828
SDL_HasAltiVec
SDL_bool SDL_HasAltiVec(void)
Definition: SDL_cpuinfo.c:792
SDL_HasMMX
SDL_bool SDL_HasMMX(void)
Definition: SDL_cpuinfo.c:798
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_HasNEON
SDL_bool SDL_HasNEON(void)
Definition: SDL_cpuinfo.c:864
SDL_HasAVX2
SDL_bool SDL_HasAVX2(void)
Definition: SDL_cpuinfo.c:846
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:263
CPU_haveAVX512F
static int CPU_haveAVX512F(void)
Definition: SDL_cpuinfo.c:534
CPU_HAS_AVX
#define CPU_HAS_AVX
Definition: SDL_cpuinfo.c:107
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
fd
GLuint64 GLenum GLint fd
Definition: gl2ext.h:1508
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:89
SDL_HasSSE
SDL_bool SDL_HasSSE(void)
Definition: SDL_cpuinfo.c:810
CPU_haveARMSIMD
static int CPU_haveARMSIMD(void)
Definition: SDL_cpuinfo.c:350
SDL_SIMDFree
void SDL_SIMDFree(void *ptr)
Deallocate memory obtained from SDL_SIMDAlloc.
Definition: SDL_cpuinfo.c:960
ptr
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 ptr
Definition: pixman-arm-simd-asm.h:171
CPU_haveAVX2
static int CPU_haveAVX2(void)
Definition: SDL_cpuinfo.c:522
uint64_t
unsigned long long uint64_t
Definition: SDL_config_windows.h:65
CPU_CPUIDMaxFunction
static int CPU_CPUIDMaxFunction
Definition: SDL_cpuinfo.c:268
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:50
CPU_haveSSE3
#define CPU_haveSSE3()
Definition: SDL_cpuinfo.c:516
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:117
SDL_CPUCount
static int SDL_CPUCount
Definition: SDL_cpuinfo.c:545
CPU_haveRDTSC
#define CPU_haveRDTSC()
Definition: SDL_cpuinfo.c:512