From 49ec65587a0c5f38f12ceccad96c82c5c349fdf7 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 11 Jul 2020 08:10:02 +0300 Subject: [PATCH] fix bug #5228 -- Add AltiVec detection for FreeBSD. thanks Piotr Kubaj. --- src/cpuinfo/SDL_cpuinfo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 0eb040cc2..fbeebd6db 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -49,7 +49,7 @@ #endif #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) #include /* For AltiVec check */ -#elif defined(__OpenBSD__) && defined(__powerpc__) +#elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__powerpc__) #include #include /* For AltiVec check */ #include @@ -314,9 +314,11 @@ CPU_haveAltiVec(void) { volatile int altivec = 0; #ifndef SDL_CPUINFO_DISABLED -#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__)) +#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__)) || (defined(__FreeBSD__) && defined(__powerpc__)) #ifdef __OpenBSD__ int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC }; +#elif defined(__FreeBSD__) + int selectors[2] = { CTL_HW, PPC_FEATURE_HAS_ALTIVEC }; #else int selectors[2] = { CTL_HW, HW_VECTORUNIT }; #endif