diff options
author | Janne Grunau <j@jannau.net> | 2014-09-04 18:29:58 +0200 |
---|---|---|
committer | Janne Grunau <j@jannau.net> | 2014-10-09 23:22:33 +0200 |
commit | eb5ce0ca4206ed4f74009c1b9a3a72407693448b (patch) | |
tree | 755a68f435fc53f93a015e8a695eab5422905b35 /m4/ax_ext.m4 | |
parent | 568df90edc6ae07744de45de8665fb86ce6c84ee (diff) | |
download | gf-complete-eb5ce0ca4206ed4f74009c1b9a3a72407693448b.tar.gz |
configure: add ARM/AArch64 NEON support
Checks for arm_neon.h header.
Diffstat (limited to 'm4/ax_ext.m4')
-rw-r--r-- | m4/ax_ext.m4 | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/m4/ax_ext.m4 b/m4/ax_ext.m4 index cfbb797..c03ccef 100644 --- a/m4/ax_ext.m4 +++ b/m4/ax_ext.m4 @@ -41,6 +41,55 @@ AC_DEFUN([AX_EXT], AC_REQUIRE([AC_CANONICAL_HOST]) case $host_cpu in + aarch64*) + AC_DEFINE(HAVE_ARCH_AARCH64,,[targeting AArch64]) + SIMD_FLAGS="$SIMD_FLAGS -DARCH_AARCH64" + + AC_CACHE_CHECK([whether NEON is supported], [ax_cv_have_neon_ext], + [ + # TODO: detect / cross-compile + ax_cv_have_neon_ext=yes + ]) + AC_CACHE_CHECK([whether cryptographic extension is supported], [ax_cv_have_arm_crypt_ext], + [ + # TODO: detect / cross-compile + ax_cv_have_arm_crypt_ext=yes + ]) + + if test "$ax_cv_have_arm_crypt_ext" = yes; then + AC_DEFINE(HAVE_ARM_CRYPT_EXT,,[Support ARM cryptographic extension]) + fi + + if test "$ax_cv_have_neon_ext" = yes; then + AC_DEFINE(HAVE_NEON,,[Support NEON instructions]) + fi + + if test "$ax_cv_have_arm_crypt_ext" = yes && test "$ax_cv_have_neon_ext" = yes; then + AX_CHECK_COMPILE_FLAG(-march=armv8-a+simd+crypto, + SIMD_FLAGS="$SIMD_FLAGS -march=armv8-a+simd+crypto -DARM_CRYPT -DARM_NEON", []) + elif test "$ax_cv_have_arm_crypt_ext" = yes; then + AX_CHECK_COMPILE_FLAG(-march=armv8-a+crypto, + SIMD_FLAGS="$SIMD_FLAGS -march=armv8-a+crypto -DARM_CRYPT", []) + elif test "$ax_cv_have_neon_ext" = yes; then + AX_CHECK_COMPILE_FLAG(-march=armv8-a+simd, + SIMD_FLAGS="$SIMD_FLAGS -march=armv8-a+simd -DARM_NEON", []) + fi + ;; + + arm*) + AC_CACHE_CHECK([whether NEON is supported], [ax_cv_have_neon_ext], + [ + # TODO: detect / cross-compile + ax_cv_have_neon_ext=yes + ]) + + if test "$ax_cv_have_neon_ext" = yes; then + AC_DEFINE(HAVE_NEON,,[Support NEON instructions]) + AX_CHECK_COMPILE_FLAG(-mfpu=neon, + SIMD_FLAGS="$SIMD_FLAGS -mfpu=neon -DARM_NEON", []) + fi + ;; + powerpc*) AC_CACHE_CHECK([whether altivec is supported], [ax_cv_have_altivec_ext], [ |