Skip to content
Snippets Groups Projects
Commit 28376929 authored by Maxime Chapelet's avatar Maxime Chapelet Committed by Jean-Baptiste Kempf
Browse files

contrib: soxr: fix neon detection for aarch64 hosts

What we have :
Given the cmake simd detection module check `CMAKE_SYSTEM_PROCESSOR` to match "arm" prefixed hosts
When `DETECT_SIMD32_C_FLAGS` test is performed by cmake for aarch64 Darwin hosts
The test fails and `WITH_CR32S` is defined to 0 in `soxr-config.h`

What is expected :
Given the cmake simd detection module check `CMAKE_SYSTEM_PROCESSOR` to match "aarch64" hosts
When `DETECT_SIMD32_C_FLAGS` test is performed by cmake for aarch64 Darwin hosts
The test succeeds and `WITH_CR32S` is defined to 1 in `soxr-config.h`

When soxr is used on Darwin arm64 platforms (iOS, macOS on Apple Silicon), the expected resampler engine to be used is cr32s.
Without this patch, cr32 is used instead, because in `soxr-config.h`, `WITH_CR32S` is defined to 0.
Considering we use "aarch64" for Darwin arm64 hosts in contribs, these changes are an attempt to fix this.
parent 31c3f00d
No related branches found
No related tags found
1 merge request!3510contrib: soxr: fix neon detection for aarch64 hosts
Pipeline #332234 passed with stages
in 36 minutes and 30 seconds
diff --git a/cmake/Modules/FindSIMD32.cmake b/cmake/Modules/FindSIMD32.cmake
index 9e4237358f..580e9ca87b 100644
--- a/cmake/Modules/FindSIMD32.cmake
+++ b/cmake/Modules/FindSIMD32.cmake
@@ -24,6 +24,16 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
return !vgetq_lane_u32(vceqq_f32(a,b),0);
}
")
+elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+ set (TRIAL_C_FLAGS
+ " ")
+ set (TEST_C_SOURCE "
+ #include <arm_neon.h>
+ int main(int c, char * * v) {
+ float32x4_t a = vdupq_n_f32((float)c), b = vdupq_n_f32((float)!!v);
+ return !vgetq_lane_u32(vceqq_f32(a,b),0);
+ }
+ ")
else ()
if (WIN32) # Safety for when mixed lib/app compilers (but performance hit)
set (GCC_WIN32_SIMD32_OPTS "-mincoming-stack-boundary=2")
......@@ -22,6 +22,7 @@ soxr: soxr-$(SOXR_VERSION)-Source.tar.xz .sum-soxr
$(APPLY) $(SRC)/soxr/0004-arm-fix-SIGILL-when-doing-divisions-on-some-old-arch.patch
$(APPLY) $(SRC)/soxr/find_ff_pkgconfig.patch
$(APPLY) $(SRC)/soxr/soxr-check-function.patch
$(APPLY) $(SRC)/soxr/aarch64.patch
$(call pkg_static,"src/soxr.pc.in")
$(MOVE)
......
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