[PATCH 4/5] Move ARMv6 detection to configure.ac

Jussi Kivilinna jussi.kivilinna at iki.fi
Mon Aug 19 11:16:11 CEST 2013


* cipher/blowfish-armv6.S: Replace __ARM_ARCH >= 6 checks with
HAVE_ARM_ARCH_V6.
* cipher/blowfish.c: Ditto.
* cipher/camellia-armv6.S: Ditto.
* cipher/camellia.h: Ditto.
* cipher/cast5-armv6.S: Ditto.
* cipher/cast5.c: Ditto.
* cipher/rijndael-armv6.S: Ditto.
* cipher/rijndael.c: Ditto.
* configure.ac: Add HAVE_ARM_ARCH_V6 check.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/blowfish-armv6.S |    9 +--------
 cipher/blowfish.c       |    9 +--------
 cipher/camellia-armv6.S |    9 +--------
 cipher/camellia.h       |    9 +--------
 cipher/cast5-armv6.S    |    9 +--------
 cipher/cast5.c          |    9 +--------
 cipher/rijndael-armv6.S |    9 +--------
 cipher/rijndael.c       |    9 +--------
 configure.ac            |   23 +++++++++++++++++++++++
 9 files changed, 31 insertions(+), 64 deletions(-)

diff --git a/cipher/blowfish-armv6.S b/cipher/blowfish-armv6.S
index b11d27f..eea879f 100644
--- a/cipher/blowfish-armv6.S
+++ b/cipher/blowfish-armv6.S
@@ -20,14 +20,7 @@
 
 #include <config.h>
 
-#if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+#if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 #ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
 
 .text
diff --git a/cipher/blowfish.c b/cipher/blowfish.c
index fe4e280..2806433 100644
--- a/cipher/blowfish.c
+++ b/cipher/blowfish.c
@@ -52,14 +52,7 @@
 
 /* USE_ARMV6_ASM indicates whether to use ARMv6 assembly code. */
 #undef USE_ARMV6_ASM
-#if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+#if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 # if (BLOWFISH_ROUNDS == 16) && defined(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS)
 #  define USE_ARMV6_ASM 1
 # endif
diff --git a/cipher/camellia-armv6.S b/cipher/camellia-armv6.S
index 769db02..3544754 100644
--- a/cipher/camellia-armv6.S
+++ b/cipher/camellia-armv6.S
@@ -20,14 +20,7 @@
 
 #include <config.h>
 
-#if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+#if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 #ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
 
 .text
diff --git a/cipher/camellia.h b/cipher/camellia.h
index 48f9160..72f2d1f 100644
--- a/cipher/camellia.h
+++ b/cipher/camellia.h
@@ -32,14 +32,7 @@
 #include <config.h>
 /* USE_ARMV6_ASM indicates whether to use ARMv6 assembly code. */
 # undef USE_ARMV6_ASM
-# if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+# if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 #  ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
 #   define USE_ARMV6_ASM 1
 #  endif
diff --git a/cipher/cast5-armv6.S b/cipher/cast5-armv6.S
index e4b2339..038fc4f 100644
--- a/cipher/cast5-armv6.S
+++ b/cipher/cast5-armv6.S
@@ -20,14 +20,7 @@
 
 #include <config.h>
 
-#if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+#if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 #ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
 
 .text
diff --git a/cipher/cast5.c b/cipher/cast5.c
index 9e7b50f..4377c28 100644
--- a/cipher/cast5.c
+++ b/cipher/cast5.c
@@ -53,14 +53,7 @@
 
 /* USE_ARMV6_ASM indicates whether to use ARMv6 assembly code. */
 #undef USE_ARMV6_ASM
-#if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+#if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 # ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
 #  define USE_ARMV6_ASM 1
 # endif
diff --git a/cipher/rijndael-armv6.S b/cipher/rijndael-armv6.S
index e778a94..bbbfb0e 100644
--- a/cipher/rijndael-armv6.S
+++ b/cipher/rijndael-armv6.S
@@ -20,14 +20,7 @@
 
 #include <config.h>
 
-#if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+#if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 #ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
 
 .text
diff --git a/cipher/rijndael.c b/cipher/rijndael.c
index 8855e0c..314f106 100644
--- a/cipher/rijndael.c
+++ b/cipher/rijndael.c
@@ -69,14 +69,7 @@
 
 /* USE_ARMV6_ASM indicates whether to use ARMv6 assembly code. */
 #undef USE_ARMV6_ASM
-#if defined(__arm__) && defined(__ARMEL__) && \
-	 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
-	|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-	|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
-	|| defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-	|| defined(__ARM_ARCH_7EM__))
+#if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__)
 # ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
 #  define USE_ARMV6_ASM 1
 # endif
diff --git a/configure.ac b/configure.ac
index c33f36b..f20d0a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -965,6 +965,29 @@ fi
 
 
 #
+# Check whether compiler is configured for ARMv6 or newer architecture
+#
+AC_CACHE_CHECK([whether compiler is configured for ARMv6 or newer architecture],
+       [gcry_cv_cc_arm_arch_is_v6],
+       [AC_EGREP_CPP(yes,
+          [#if defined(__arm__) && \
+             ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
+             || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+             || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
+             || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
+             || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+             || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+             || defined(__ARM_ARCH_7EM__))
+            yes
+           #endif
+          ], gcry_cv_cc_arm_arch_is_v6=yes, gcry_cv_cc_arm_arch_is_v6=no)])
+if test "$gcry_cv_cc_arm_arch_is_v6" = "yes" ; then
+   AC_DEFINE(HAVE_ARM_ARCH_V6,1,
+     [Defined if ARM architecture is v6 or newer])
+fi
+
+
+#
 # Check whether GCC assembler supports features needed for our ARM
 # implementations
 #




More information about the Gcrypt-devel mailing list