Skip to content
Snippets Groups Projects
Commit b10771e9 authored by Jan Beich's avatar Jan Beich Committed by Janne Grunau
Browse files

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
No related branches found
No related tags found
1 merge request!514Enable NEON on FreeBSD armv6 and armv7
Pipeline #3707 passed with stages
in 6 minutes and 8 seconds
......@@ -147,6 +147,9 @@ if (host_machine.cpu_family() == 'aarch64' or
if cc.has_function('getauxval', prefix : '#include <sys/auxv.h>', args : test_args)
cdata.set('HAVE_GETAUXVAL', 1)
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
# Compiler flag tests
......
......@@ -37,6 +37,11 @@
#endif
#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__)
#include <stdio.h>
#include <string.h>
......@@ -77,6 +82,10 @@ unsigned dav1d_get_cpu_flags_arm(void) {
#elif defined(HAVE_GETAUXVAL) && ARCH_ARM
unsigned long hw_cap = getauxval(AT_HWCAP);
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__)
flags |= parse_proc_cpuinfo("neon") ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(__APPLE__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment