]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
autotools: ARM/AArch64 NEON detection similar to x86
authorJanne Grunau <j@jannau.net>
Tue, 9 Sep 2014 07:47:16 +0000 (09:47 +0200)
committerLoic Dachary <ldachary@redhat.com>
Tue, 25 Nov 2014 13:17:37 +0000 (14:17 +0100)
configure.ac
m4/ax_arm.m4 [new file with mode: 0644]

index cb277bdbd8407a9c33fed1cfeee32accd0767052..04237a0360292c0afc413dd1ff96ccc653a40356 100644 (file)
@@ -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 (file)
index 0000000..2ccc9a9
--- /dev/null
@@ -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)
+])