Detect AltiVec support on OpenBSD
This commit is contained in:
@@ -31,6 +31,12 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include <machine/cpu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static unsigned int simd_support = ~0;
|
static unsigned int simd_support = ~0;
|
||||||
|
|
||||||
#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
|
#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
|
||||||
@@ -126,6 +132,12 @@ init_simd (void)
|
|||||||
IExec->GetCPUInfoTags(GCIT_VectorUnit, &altivec, TAG_DONE);
|
IExec->GetCPUInfoTags(GCIT_VectorUnit, &altivec, TAG_DONE);
|
||||||
if(altivec == VECTORTYPE_ALTIVEC)
|
if(altivec == VECTORTYPE_ALTIVEC)
|
||||||
simd_support |= JSIMD_ALTIVEC;
|
simd_support |= JSIMD_ALTIVEC;
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
int mib[2] = { CTL_MACHDEP, CPU_ALTIVEC };
|
||||||
|
int altivec;
|
||||||
|
size_t len = sizeof(altivec);
|
||||||
|
if (sysctl(mib, 2, &altivec, &len, NULL, 0) == 0 && altivec != 0)
|
||||||
|
simd_support |= JSIMD_ALTIVEC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Force different settings through environment variables */
|
/* Force different settings through environment variables */
|
||||||
|
|||||||
Reference in New Issue
Block a user