From 2a28e66d5603dae37031ff8105fdf6acb649b46d Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 2 Mar 2012 21:06:58 +0100 Subject: [PATCH] Fallback to pthread implementation on ARMv5 and earlier ARMv6 and newer has optimized code, earlier versions need to fall back to the pthread implementation. Signed-off-by: Niels de Vos --- src/atomic_ops.h | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/atomic_ops.h b/src/atomic_ops.h index 3f9000d..af09501 100644 --- a/src/atomic_ops.h +++ b/src/atomic_ops.h @@ -193,16 +193,22 @@ # define AO_compiler_barrier() asm("") #endif -#if defined(AO_USE_PTHREAD_DEFS) -# include "atomic_ops/sysdeps/generic_pthread.h" -#endif /* AO_USE_PTHREAD_DEFS */ - #if (defined(__CC_ARM) || defined(__ARMCC__)) && !defined(__GNUC__) \ && !defined(AO_USE_PTHREAD_DEFS) -# include "atomic_ops/sysdeps/armcc/arm_v6.h" -# define AO_GENERALIZE_TWICE +# if __TARGET_ARCH_ARM >= 6 + /* ARMv6 and newer has optimized code, earlier versions */ + /* need to fall back to the pthread implementation. */ +# include "atomic_ops/sysdeps/armcc/arm_v6.h" +# define AO_GENERALIZE_TWICE +# else +# define AO_USE_PTHREAD_DEFS +# endif #endif +#if defined(AO_USE_PTHREAD_DEFS) +# include "atomic_ops/sysdeps/generic_pthread.h" +#endif /* AO_USE_PTHREAD_DEFS */ + #if defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS) \ && !defined(__INTEL_COMPILER) # if defined(__i386__) -- 1.7.3.4