Commit b10771e9 authored by Jan Beich's avatar Jan Beich Committed by Janne Grunau

arm: detect NEON on FreeBSD armv6

FreeBSD 11.2 added AT_HWCAP via sysctl() while 12.0 added elf_aux_info()
which requires less code to use and is cached by libc. Only support the
latter to avoid cruft to be removed after 11.* EOL on 2021-09-30.
parent 65305637
...@@ -147,6 +147,9 @@ if (host_machine.cpu_family() == 'aarch64' or ...@@ -147,6 +147,9 @@ if (host_machine.cpu_family() == 'aarch64' or
if cc.has_function('getauxval', prefix : '#include <sys/auxv.h>', args : test_args) if cc.has_function('getauxval', prefix : '#include <sys/auxv.h>', args : test_args)
cdata.set('HAVE_GETAUXVAL', 1) cdata.set('HAVE_GETAUXVAL', 1)
endif endif
if cc.has_function('elf_aux_info', prefix : '#include <sys/auxv.h>', args : test_args)
cdata.set('HAVE_ELF_AUX_INFO', 1)
endif
endif endif
# Compiler flag tests # Compiler flag tests
......
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
#endif #endif
#define NEON_HWCAP HWCAP_ARM_NEON #define NEON_HWCAP HWCAP_ARM_NEON
#elif defined(HAVE_ELF_AUX_INFO) && ARCH_ARM
#include <sys/auxv.h>
#define NEON_HWCAP HWCAP_NEON
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -77,6 +82,10 @@ unsigned dav1d_get_cpu_flags_arm(void) { ...@@ -77,6 +82,10 @@ unsigned dav1d_get_cpu_flags_arm(void) {
#elif defined(HAVE_GETAUXVAL) && ARCH_ARM #elif defined(HAVE_GETAUXVAL) && ARCH_ARM
unsigned long hw_cap = getauxval(AT_HWCAP); unsigned long hw_cap = getauxval(AT_HWCAP);
flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0; flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(HAVE_ELF_AUX_INFO) && ARCH_ARM
unsigned long hw_cap = 0;
elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap));
flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
flags |= parse_proc_cpuinfo("neon") ? DAV1D_ARM_CPU_FLAG_NEON : 0; flags |= parse_proc_cpuinfo("neon") ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(__APPLE__) #elif defined(__APPLE__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment