1 From 09f846fbdeb19193e778ce51baa77bd03c38372e Mon Sep 17 00:00:00 2001
2 From: garrison <garrison@qemu15.qemu-network>
3 Date: Fri, 4 Jun 2021 22:13:02 +0000
4 Subject: [PATCH] build-sys: meson: check if NEON code can be compiled on arm
6 When Meson SIMD module returns HAVE_NEON=1 on arm host, do extra compile check
7 to verify compiler can actually handle NEON code.
9 Related Meson issue #6361 https://github.com/mesonbuild/meson/issues/6361
11 Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/574>
13 Upstream-Status: Backport[https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/6d2a49a6a1eacc2096d0d9473a074421c181ab56]
15 Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
17 src/pulsecore/meson.build | 41 +++++++++++++++++++++++++++++----------
18 1 file changed, 31 insertions(+), 10 deletions(-)
20 diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build
21 index 99a702e..d0b7990 100644
22 --- a/src/pulsecore/meson.build
23 +++ b/src/pulsecore/meson.build
24 @@ -172,16 +172,37 @@ endif
26 # FIXME: SIMD support (ORC)
27 simd = import('unstable-simd')
28 -libpulsecore_simd = simd.check('libpulsecore_simd',
29 - mmx : ['remap_mmx.c', 'svolume_mmx.c'],
30 - sse : ['remap_sse.c', 'sconv_sse.c', 'svolume_sse.c'],
31 - neon : ['remap_neon.c', 'sconv_neon.c', 'mix_neon.c'],
32 - c_args : [pa_c_args],
33 - include_directories : [configinc, topinc],
34 - implicit_include_directories : false,
36 -libpulsecore_simd_lib = libpulsecore_simd[0]
37 -cdata.merge_from(libpulsecore_simd[1])
39 + { 'mmx' : ['remap_mmx.c', 'svolume_mmx.c'] },
40 + { 'sse' : ['remap_sse.c', 'sconv_sse.c', 'svolume_sse.c'] },
41 + { 'neon' : ['remap_neon.c', 'sconv_neon.c', 'mix_neon.c'] },
44 +libpulsecore_simd_lib = []
46 +foreach simd_kwargs : simd_variants
48 + if host_machine.cpu_family() == 'arm' and 'neon' in simd_kwargs
49 + if not cc.compiles('''
50 + #include <arm_neon.h>
52 + return sizeof(uint8x8_t) + sizeof(int32x4_t) + sizeof(float32x4_t);
54 + ''', name : 'neon code')
59 + libpulsecore_simd = simd.check('libpulsecore_simd',
60 + kwargs : simd_kwargs,
61 + c_args : [pa_c_args],
62 + include_directories : [configinc, topinc],
63 + implicit_include_directories : false,
66 + libpulsecore_simd_lib += libpulsecore_simd[0]
67 + cdata.merge_from(libpulsecore_simd[1])
70 # FIXME: Implement Windows support