summaryrefslogtreecommitdiff
path: root/mpi/longlong.h
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2013-07-03 11:32:25 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2013-07-10 21:53:57 +0300
commit97f392f43cf2e4da1297cbecacbfbff33a869478 (patch)
tree3c0a2685bec3580e6d29137ce4a93551f8c1a1c1 /mpi/longlong.h
parent8aa4f2161cf643ce36d87d2e2786b546736f8232 (diff)
downloadlibgcrypt-97f392f43cf2e4da1297cbecacbfbff33a869478.tar.gz
mpi: Add __ARM_ARCH for older GCC
* mpi/longlong.h [__arm__]: Construct __ARM_ARCH if not provided by compiler. -- GCC 4.8 defines __ARM_ARCH which provides forward compatible way to detect ARM architecture. Use this when available and construct otherwise. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'mpi/longlong.h')
-rw-r--r--mpi/longlong.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/mpi/longlong.h b/mpi/longlong.h
index 0f860af6..699b6b3f 100644
--- a/mpi/longlong.h
+++ b/mpi/longlong.h
@@ -186,6 +186,30 @@ extern UDItype __udiv_qrnnd ();
***************************************/
#if defined (__arm__) && W_TYPE_SIZE == 32 && \
(!defined (__thumb__) || defined (__thumb2__))
+/* The __ARM_ARCH define is provided by gcc 4.8. Construct it otherwise. */
+#ifndef __ARM_ARCH
+# ifdef __ARM_ARCH_2__
+# define __ARM_ARCH 2
+# elif defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
+# define __ARM_ARCH 3
+# elif defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__)
+# define __ARM_ARCH 4
+# elif defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5E__) \
+ || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+# define __ARM_ARCH 5
+# elif defined (__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+ || defined (__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
+ || defined (__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__)
+# define __ARM_ARCH 6
+# elif defined (__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+ || defined(__ARM_ARCH_7EM__)
+# define __ARM_ARCH 7
+# else
+ /* could not detect? */
+# endif
+#endif
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("adds %1, %4, %5\n" \
"adc %0, %2, %3" \
@@ -204,9 +228,7 @@ extern UDItype __udiv_qrnnd ();
"rI" ((USItype)(bh)), \
"r" ((USItype)(al)), \
"rI" ((USItype)(bl)) __CLOBBER_CC)
-/* The __ARM_ARCH define is provided by gcc 4.8 */
-#if (defined __ARM_ARCH && __ARM_ARCH <= 3) || \
- defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__
+#if (defined __ARM_ARCH && __ARM_ARCH <= 3)
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("%@ Inlined umul_ppmm\n" \
"mov %|r0, %2, lsr #16 @ AAAA\n" \
@@ -238,10 +260,7 @@ extern UDItype __udiv_qrnnd ();
#endif /* __ARM_ARCH >= 4 */
#define UMUL_TIME 20
#define UDIV_TIME 100
-/* The __ARM_ARCH define is provided by gcc 4.8 */
-#if (defined __ARM_ARCH && __ARM_ARCH >= 5) || !(defined __ARM_ARCH_2__ || \
- defined __ARM_ARCH_3__ || defined __ARM_ARCH_3M__ || __ARM_ARCH_4__ || \
- __ARM_ARCH_4T__)
+#if (defined __ARM_ARCH && __ARM_ARCH >= 5)
#define count_leading_zeros(count, x) \
__asm__ ("clz %0, %1" \
: "=r" ((USItype)(count)) \