2#ifndef BT_CPU_UTILITY_H
3#define BT_CPU_UTILITY_H
15#if defined BT_USE_NEON
16#define ARM_NEON_GCC_COMPATIBILITY 1
19#include <sys/sysctl.h>
36 static int capabilities = 0;
37 static bool testedCapabilities =
false;
38 if (0 != testedCapabilities)
46 size_t featureSize =
sizeof(hasFeature);
47 int err = sysctlbyname(
"hw.optional.neon_hpfp", &hasFeature, &featureSize, NULL, 0);
48 if (0 == err && hasFeature)
56 memset(cpuInfo, 0,
sizeof(cpuInfo));
57 unsigned long long sseExt = 0;
60 bool osUsesXSAVE_XRSTORE = cpuInfo[2] & (1 << 27) ||
false;
61 bool cpuAVXSuport = cpuInfo[2] & (1 << 28) ||
false;
63 if (osUsesXSAVE_XRSTORE && cpuAVXSuport)
67 const int OSXSAVEFlag = (1UL << 27);
68 const int AVXFlag = ((1UL << 28) | OSXSAVEFlag);
69 const int FMAFlag = ((1UL << 12) | AVXFlag | OSXSAVEFlag);
70 if ((cpuInfo[2] & FMAFlag) == FMAFlag && (sseExt & 6) == 6)
75 const int SSE41Flag = (1 << 19);
76 if (cpuInfo[2] & SSE41Flag)
83 testedCapabilities =
true;
Rudimentary btCpuFeatureUtility for CPU features: only report the features that Bullet actually uses ...
static int getCpuFeatures()