diff mbox

[2/5] autotools: ARM/AArch64 NEON detection similar to x86

Message ID 1414434036-29313-3-git-send-email-j@jannau.net (mailing list archive)
State New, archived
Headers show

Commit Message

Janne Grunau Oct. 27, 2014, 6:20 p.m. UTC
---
 configure.ac |  7 +++----
 m4/ax_arm.m4 | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)
 create mode 100644 m4/ax_arm.m4

Comments

Janne Grunau Oct. 27, 2014, 6:49 p.m. UTC | #1
On 2014-10-27 19:20:33 +0100, Janne Grunau wrote:
> ---
>  configure.ac |  7 +++----
>  m4/ax_arm.m4 | 27 +++++++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 4 deletions(-)
>  create mode 100644 m4/ax_arm.m4
> 
> diff --git a/configure.ac b/configure.ac
> index d994712..feb85a1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -141,9 +141,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])
> -

This conflicts with the wip-neon-crc32c branch. I removed it since 
ENABLE_FPU_NEON is currently unused. I think that branch should be 
updated to use the defines/flags in this patch since this is more in 
line with behaviour for x86.

Janne
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index d994712..feb85a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,9 +141,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])
@@ -537,7 +534,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 0000000..2ccc9a9
--- /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)
+])