summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorRonenGvili <92885945+RonenGvili@users.noreply.github.com>2022-04-29 15:46:07 +0300
committerGitHub <noreply@github.com>2022-04-29 14:46:07 +0200
commit95e2c52980977e78976e2090d19e4cbae9d0a2e9 (patch)
tree55e2d788b735cabaeefa28932b9a295e6bb7ba60 /cmake
parent5df56dbcf50bdbc1924bc097567549995d3b3a70 (diff)
downloadflac-95e2c52980977e78976e2090d19e4cbae9d0a2e9.tar.gz
Adding ARM64 support and optimized Neon implementation (#270)
Add NEON intrinsics routines for lpc_compute_residual_from_qlp_coefficients and lpc_compute_residual_from_qlp_coefficients_wide
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CheckA64NEON.c.in6
-rw-r--r--cmake/CheckA64NEON.cmake14
-rw-r--r--cmake/CheckCPUArch.cmake8
3 files changed, 26 insertions, 2 deletions
diff --git a/cmake/CheckA64NEON.c.in b/cmake/CheckA64NEON.c.in
new file mode 100644
index 00000000..4d43d4fa
--- /dev/null
+++ b/cmake/CheckA64NEON.c.in
@@ -0,0 +1,6 @@
+#include <arm_neon.h>
+int main (void)
+{
+ float64x2_t tmp;
+ tmp = vdupq_n_f64(0.0f);
+}
diff --git a/cmake/CheckA64NEON.cmake b/cmake/CheckA64NEON.cmake
new file mode 100644
index 00000000..247b8648
--- /dev/null
+++ b/cmake/CheckA64NEON.cmake
@@ -0,0 +1,14 @@
+macro(CHECK_A64NEON VARIABLE)
+ if(NOT DEFINED HAVE_${VARIABLE})
+ message(STATUS "Check whether A64 NEON can be used")
+ configure_file(${PROJECT_SOURCE_DIR}/cmake/CheckA64NEON.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckA64NEON.c @ONLY)
+ try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}"
+ "${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckA64NEON.c")
+ if(HAVE_${VARIABLE})
+ message(STATUS "Check whether A64 NEON can be used - yes")
+ set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_A64NEON" FORCE)
+ else ()
+ message(STATUS "Check whether A64 NEON can be used - no")
+ endif()
+ endif ()
+endmacro(CHECK_A64NEON)
diff --git a/cmake/CheckCPUArch.cmake b/cmake/CheckCPUArch.cmake
index c9b7a5c3..4c444363 100644
--- a/cmake/CheckCPUArch.cmake
+++ b/cmake/CheckCPUArch.cmake
@@ -7,7 +7,7 @@ macro(_CHECK_CPU_ARCH ARCH ARCH_DEFINES VARIABLE)
"${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c")
if(HAVE_${VARIABLE})
message(STATUS "Check CPU architecture is ${ARCH} - yes")
- set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH_X64" FORCE)
+ set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH" FORCE)
else ()
message(STATUS "Check CPU architecture is ${ARCH} - no")
endif()
@@ -24,4 +24,8 @@ endmacro(CHECK_CPU_ARCH_X86)
macro(CHECK_CPU_ARCH_PPC64 VARIABLE)
_CHECK_CPU_ARCH(ppc64 "defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) ||defined(_ARCH_PPC64)" ${VARIABLE})
-endmacro(CHECK_CPU_ARCH_PPC64) \ No newline at end of file
+endmacro(CHECK_CPU_ARCH_PPC64)
+
+macro(CHECK_CPU_ARCH_ARM64 VARIABLE)
+ _CHECK_CPU_ARCH(arm64 "defined(__aarch64__) || defined(__arm64__)" ${VARIABLE})
+endmacro(CHECK_CPU_ARCH_ARM64)