From: Janne Grunau Date: Tue, 9 Sep 2014 07:47:16 +0000 (+0200) Subject: autotools: ARM/AArch64 NEON detection similar to x86 X-Git-Tag: v0.91~163^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cec00c9f4ad99fd50334339bf6cc0727692f3b0f;p=ceph.git autotools: ARM/AArch64 NEON detection similar to x86 --- diff --git a/configure.ac b/configure.ac index cb277bdbd840..04237a036029 100644 --- a/configure.ac +++ b/configure.ac @@ -143,9 +143,6 @@ AC_DEFUN([AC_CHECK_CC_FLAG], AC_CHECK_CC_FLAG([-Wtype-limits], [WARN_TYPE_LIMITS]) AC_CHECK_CC_FLAG([-Wignored-qualifiers], [WARN_IGNORED_QUALIFIERS]) -# Checks for architecture stuff -AM_CONDITIONAL([ENABLE_FPU_NEON], [case $target_cpu in arm*) true;; *) false;; esac]) - # Check for compiler VTA support AX_CHECK_COMPILE_FLAG([-fvar-tracking-assignments], [HAS_VTA_SUPPORT=1], [HAS_VTA_SUPPORT=0]) AM_CONDITIONAL(COMPILER_HAS_VTA, [test "$HAS_VTA_SUPPORT" = 1]) @@ -545,7 +542,9 @@ AC_LANG_PUSH([C++]) AC_CHECK_HEADER([leveldb/filter_policy.h], [AC_DEFINE([HAVE_LEVELDB_FILTER_POLICY], [1], [Defined if LevelDB supports bloom filters ])]) AC_LANG_POP([C++]) -# Find supported SIMD / SSE extensions supported by the compiler +# Find supported SIMD / NEON / SSE extensions supported by the compiler +AX_ARM_FEATURES() +AM_CONDITIONAL(HAVE_NEON, [ test "x$ax_cv_support_neon_ext" = "xyes"]) AX_INTEL_FEATURES() AM_CONDITIONAL(HAVE_SSSE3, [ test "x$ax_cv_support_ssse3_ext" = "xyes"]) AM_CONDITIONAL(HAVE_SSE4_PCLMUL, [ test "x$ax_cv_support_pclmuldq_ext" = "xyes"]) diff --git a/m4/ax_arm.m4 b/m4/ax_arm.m4 new file mode 100644 index 000000000000..2ccc9a977f82 --- /dev/null +++ b/m4/ax_arm.m4 @@ -0,0 +1,27 @@ +AC_DEFUN([AX_ARM_FEATURES], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + + case $target_cpu in + arm*) + AX_CHECK_COMPILE_FLAG(-mfpu=neon, ax_cv_support_neon_ext=yes, []) + if test x"$ax_cv_support_neon_ext" = x"yes"; then + ARM_NEON_FLAGS="-mfpu=neon -DARM_NEON" + AC_SUBST(ARM_NEON_FLAGS) + ARM_FLAGS="$ARM_FLAGS $ARM_NEON_FLAGS" + AC_DEFINE(HAVE_NEON,,[Support NEON instructions]) + fi + ;; + aarch64*) + AX_CHECK_COMPILE_FLAG(-march=armv8-a+simd, ax_cv_support_neon_ext=yes, []) + if test x"$ax_cv_support_neon_ext" = x"yes"; then + ARM_NEON_FLAGS="-march=armv8-a+simd -DARCH_AARCH64 -DARM_NEON" + AC_SUBST(ARM_NEON_FLAGS) + ARM_FLAGS="$ARM_FLAGS $ARM_NEON_FLAGS" + AC_DEFINE(HAVE_NEON,,[Support NEON instructions]) + fi + ;; + esac + + AC_SUBST(ARM_FLAGS) +])