Added
Link Here
|
1 |
--- celt/arm/armcpu.c.orig 2024-03-06 18:21:25 UTC |
2 |
+++ celt/arm/armcpu.c |
3 |
@@ -191,6 +191,54 @@ opus_uint32 opus_cpu_capabilities(void) |
4 |
return flags; |
5 |
} |
6 |
|
7 |
+#elif defined(__FreeBSD__) |
8 |
+#include <sys/auxv.h> |
9 |
+ |
10 |
+opus_uint32 opus_cpu_capabilities(void) |
11 |
+{ |
12 |
+ long hwcap = 0; |
13 |
+ opus_uint32 flags = 0; |
14 |
+ |
15 |
+# if defined(OPUS_ARM_MAY_HAVE_MEDIA) \ |
16 |
+ || defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR) |
17 |
+ /* FreeBSD required armv6+, always supported media instructions */ |
18 |
+ flags |= OPUS_CPU_ARM_MEDIA_FLAG; |
19 |
+# endif |
20 |
+ |
21 |
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); |
22 |
+ |
23 |
+# if defined(OPUS_ARM_MAY_HAVE_EDSP) || defined(OPUS_ARM_MAY_HAVE_MEDIA) \ |
24 |
+ || defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR) |
25 |
+# ifdef HWCAP_EDSP |
26 |
+ if (hwcap & HWCAP_EDSP) |
27 |
+ flags |= OPUS_CPU_ARM_EDSP_FLAG; |
28 |
+# endif |
29 |
+ |
30 |
+# if defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR) |
31 |
+# ifdef HWCAP_NEON |
32 |
+ if (hwcap & HWCAP_NEON) |
33 |
+ flags |= OPUS_CPU_ARM_NEON_FLAG; |
34 |
+# elif defined(HWCAP_ASIMD) |
35 |
+ if (hwcap & HWCAP_ASIMD) |
36 |
+ flags |= OPUS_CPU_ARM_NEON_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_EDSP_FLAG; |
37 |
+# endif |
38 |
+# endif |
39 |
+# if defined(OPUS_ARM_MAY_HAVE_DOTPROD) && defined(HWCAP_ASIMDDP) |
40 |
+ if (hwcap & HWCAP_ASIMDDP) |
41 |
+ flags |= OPUS_CPU_ARM_DOTPROD_FLAG; |
42 |
+# endif |
43 |
+# endif |
44 |
+ |
45 |
+#if defined(OPUS_ARM_PRESUME_AARCH64_NEON_INTR) |
46 |
+ flags |= OPUS_CPU_ARM_EDSP_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_NEON_FLAG; |
47 |
+# if defined(OPUS_ARM_PRESUME_DOTPROD) |
48 |
+ flags |= OPUS_CPU_ARM_DOTPROD_FLAG; |
49 |
+# endif |
50 |
+#endif |
51 |
+ |
52 |
+ return (flags); |
53 |
+} |
54 |
+ |
55 |
#else |
56 |
/* The feature registers which can tell us what the processor supports are |
57 |
* accessible in priveleged modes only, so we can't have a general user-space |