From 601a098338a5c276a538d55bde516624aff99a49 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 16 Sep 2019 11:34:28 +0000 Subject: [PATCH] util: detect NEON at runtime on FreeBSD Reviewed-by: Matt Turner Signed-off-by: Jan Beich --- src/util/u_cpu_detect.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 387003d6cba..19b21b0aa44 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -56,6 +56,10 @@ #if defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_DRAGONFLY) #include #include +#if __has_include() +#include +#define HAVE_ELF_AUX_INFO +#endif #endif #if defined(PIPE_OS_LINUX) @@ -362,6 +366,11 @@ check_os_arm_support(void) */ #if defined(__ARM_NEON) || defined(__ARM_NEON__) util_cpu_caps.has_neon = 1; +#elif defined(PIPE_OS_FREEBSD) && defined(HAVE_ELF_AUX_INFO) + unsigned long hwcap = 0; + elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); + if (hwcap & HWCAP_NEON) + util_cpu_caps.has_neon = 1; #elif defined(HAS_ANDROID_CPUFEATURES) AndroidCpuFamily cpu_family = android_getCpuFamily(); uint64_t cpu_features = android_getCpuFeatures(); -- 2.30.2