fix bug #5228 -- Add AltiVec detection for FreeBSD.

thanks Piotr Kubaj.
This commit is contained in:
Ozkan Sezer 2020-07-11 08:10:02 +03:00
parent b162629546
commit 49ec65587a

View File

@ -49,7 +49,7 @@
#endif #endif
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
#include <sys/sysctl.h> /* For AltiVec check */ #include <sys/sysctl.h> /* For AltiVec check */
#elif defined(__OpenBSD__) && defined(__powerpc__) #elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysctl.h> /* For AltiVec check */ #include <sys/sysctl.h> /* For AltiVec check */
#include <machine/cpu.h> #include <machine/cpu.h>
@ -314,9 +314,11 @@ CPU_haveAltiVec(void)
{ {
volatile int altivec = 0; volatile int altivec = 0;
#ifndef SDL_CPUINFO_DISABLED #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__ #ifdef __OpenBSD__
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC }; int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
#elif defined(__FreeBSD__)
int selectors[2] = { CTL_HW, PPC_FEATURE_HAS_ALTIVEC };
#else #else
int selectors[2] = { CTL_HW, HW_VECTORUNIT }; int selectors[2] = { CTL_HW, HW_VECTORUNIT };
#endif #endif