Added
Link Here
|
0 |
- |
1 |
--- src/arch/simddetect.cpp.orig 2022-04-02 13:06:33 UTC |
|
|
2 |
+++ src/arch/simddetect.cpp |
3 |
@@ -55,10 +55,12 @@ |
4 |
#if defined(HAVE_NEON) && !defined(__aarch64__) |
5 |
# ifdef ANDROID |
6 |
# include <cpu-features.h> |
7 |
-# else |
8 |
-/* Assume linux */ |
9 |
+# elif defined(__linux__) |
10 |
# include <asm/hwcap.h> |
11 |
# include <sys/auxv.h> |
12 |
+# elif defined(__FreeBSD__) |
13 |
+# include <sys/auxv.h> |
14 |
+# include <sys/elf.h> |
15 |
# endif |
16 |
#endif |
17 |
|
18 |
@@ -85,7 +87,7 @@ SIMDDetect SIMDDetect::detector; |
19 |
bool SIMDDetect::neon_available_ = true; |
20 |
#elif defined(HAVE_NEON) |
21 |
// If true, then Neon has been detected. |
22 |
-bool SIMDDetect::neon_available_; |
23 |
+bool SIMDDetect::neon_available_ = false; |
24 |
#else |
25 |
// If true, then AVX has been detected. |
26 |
bool SIMDDetect::avx_available_; |
27 |
@@ -216,9 +218,12 @@ SIMDDetect::SIMDDetect() { |
28 |
if (family == ANDROID_CPU_FAMILY_ARM) |
29 |
neon_available_ = (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON); |
30 |
} |
31 |
-# else |
32 |
- /* Assume linux */ |
33 |
+# elif defined(__linux__) |
34 |
neon_available_ = getauxval(AT_HWCAP) & HWCAP_NEON; |
35 |
+# elif defined(__FreeBSD__) |
36 |
+ unsigned long hwcap = 0; |
37 |
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); |
38 |
+ neon_available_ = hwcap & HWCAP_NEON; |
39 |
# endif |
40 |
#endif |
41 |
|