configure.ac, symm/rijndael*: Use ARMv8 AES instructions where available.
[catacomb] / configure.ac
index 1802a8a..86f7944 100644 (file)
@@ -172,6 +172,40 @@ case $CPUFAM in
 esac
 
 dnl--------------------------------------------------------------------------
+dnl CPU-specific assembler features.
+
+AC_LANG([CPPAS])
+
+case $CPUFAM in
+  armel)
+    AC_CACHE_CHECK(
+      [whether the assembler understands ARMv8 crypto extensions],
+      [mdw_cv_as_armv8_crypto],
+      [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+       .arch   armv8-a
+       .fpu    crypto-neon-fp-armv8
+
+       .text
+       .globl  foo
+foo:
+       vldmia  r0, {d0-d3}
+       aese.8  q0, q1
+       aesmc.8 q0, q0
+       vstmia  r0, {d0, d1}
+       bx      r14]])],
+        [mdw_cv_as_armv8_crypto=yes],
+        [mdw_cv_as_armv8_crypto=no])])
+    ;;
+esac
+
+: ${mdw_cv_as_armv8_crypto=no}
+AM_CONDITIONAL([HAVE_AS_ARMV8_CRYPTO], [test $mdw_cv_as_armv8_crypto = yes])
+if test $mdw_cv_as_armv8_crypto = yes; then
+  AC_DEFINE([HAVE_AS_ARMV8_CRYPTO], [1],
+    [Define to 1 if your ARM assembler supports the ARMv8 crypto instructions.])
+fi
+
+dnl--------------------------------------------------------------------------
 dnl C programming environment.
 
 AC_LANG([C])