blob: ccb60a375cf8b1601e1678852100638164131772 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
Use getauxval on Linux if available.
--- SDL2-2.0.22/src/cpuinfo/SDL_cpuinfo.c.old 2022-01-08 02:29:52.000000000 +0000
+++ SDL2-2.0.22/src/cpuinfo/SDL_cpuinfo.c 2025-04-27 18:58:12.097867624 +0000
@@ -113,7 +113,7 @@
#define CPU_HAS_AVX512F (1 << 12)
#define CPU_HAS_ARM_SIMD (1 << 13)
-#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__FreeBSD__
+#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__FreeBSD__ && !__linux__
/* This is the brute force way of detecting instruction sets...
the idea is borrowed from the libmpeg2 library - thanks!
*/
@@ -333,6 +333,8 @@
elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures));
altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC;
return altivec;
+#elif defined(__linux__) && defined(__powerpc__) && HAVE_GETAUXVAL
+ altivec = getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC;
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
void (*handler) (int sig);
handler = signal(SIGILL, illegal_instruction);
|