summaryrefslogtreecommitdiff
path: root/src/atomic_ops/sysdeps/gcc/arm.h
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-12-08 16:39:56 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-12-08 16:39:56 +0400
commita6d9efc45938225665f7708f98a81fb6a7724f0f (patch)
tree226daa2a700b586980ef400db31c5178489d70bc /src/atomic_ops/sysdeps/gcc/arm.h
parent9a9c43a0ff7f36c4326f696efc31579dd141156d (diff)
downloadlibatomic_ops-a6d9efc45938225665f7708f98a81fb6a7724f0f.tar.gz
Add new macro (AO_PREFER_GENERALIZED) to favor generalized primitives
over direct assembly-based ones * configure.ac (AO_PREFER_GENERALIZED): New AC template. * src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_test_and_set, AO_HAVE_test_and_set, AO_fetch_and_add, AO_HAVE_fetch_and_add, AO_fetch_and_add1, AO_HAVE_fetch_and_add1, AO_fetch_and_sub1, AO_HAVE_fetch_and_sub1): Do not define if AO_PREFER_GENERALIZED. * src/atomic_ops/sysdeps/gcc/arm.h (AO_test_and_set, AO_HAVE_test_and_set, AO_fetch_and_add, AO_HAVE_fetch_and_add, AO_fetch_and_add1, AO_HAVE_fetch_and_add1, AO_fetch_and_sub1, AO_HAVE_fetch_and_sub1): Likewise. * src/atomic_ops/sysdeps/gcc/avr32.h (AO_test_and_set_full, AO_HAVE_test_and_set_full): Likewise. * src/atomic_ops/sysdeps/gcc/hexagon.h (AO_fetch_and_add, AO_HAVE_fetch_and_add, AO_test_and_set, AO_HAVE_test_and_set): Likewise. * src/atomic_ops/sysdeps/gcc/ia64.h (AO_fetch_and_add1_acquire, AO_HAVE_fetch_and_add1_acquire, AO_fetch_and_add1_release, AO_HAVE_fetch_and_add1_release, AO_fetch_and_sub1_acquire, AO_HAVE_fetch_and_sub1_acquire, AO_fetch_and_sub1_release, AO_HAVE_fetch_and_sub1_release, AO_int_fetch_and_add1_acquire, AO_HAVE_int_fetch_and_add1_acquire, AO_int_fetch_and_add1_release, AO_HAVE_int_fetch_and_add1_release, AO_int_fetch_and_sub1_acquire, AO_HAVE_int_fetch_and_sub1_acquire, AO_int_fetch_and_sub1_release, AO_HAVE_int_fetch_and_sub1_release): Likewise. * src/atomic_ops/sysdeps/gcc/powerpc.h (AO_test_and_set, AO_HAVE_test_and_set, AO_test_and_set_acquire, AO_HAVE_test_and_set_acquire, AO_test_and_set_release, AO_HAVE_test_and_set_release, AO_test_and_set_full, AO_HAVE_test_and_set_full): Likewise. * src/atomic_ops/sysdeps/gcc/x86.h (AO_fetch_and_add_full, AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full, AO_or_full, AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise. * src/atomic_ops/sysdeps/gcc/x86_64.h (AO_fetch_and_add_full, AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full, AO_or_full, AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise. * src/atomic_ops/sysdeps/hpc/ia64.h (AO_fetch_and_add1_acquire, AO_HAVE_fetch_and_add1_acquire, AO_fetch_and_add1_release, AO_HAVE_fetch_and_add1_release, AO_fetch_and_sub1_acquire, AO_HAVE_fetch_and_sub1_acquire, AO_fetch_and_sub1_release, AO_HAVE_fetch_and_sub1_release): Likewise. * src/atomic_ops/sysdeps/ibmc/powerpc.h (AO_test_and_set_acquire, AO_HAVE_test_and_set_acquire, AO_test_and_set_release, AO_HAVE_test_and_set_release, AO_test_and_set_full, AO_HAVE_test_and_set_full): Likewise. * src/atomic_ops/sysdeps/icc/ia64.h (AO_fetch_and_add1_acquire, AO_HAVE_fetch_and_add1_acquire, AO_fetch_and_add1_release, AO_HAVE_fetch_and_add1_release, AO_fetch_and_sub1_acquire, AO_HAVE_fetch_and_sub1_acquire, AO_fetch_and_sub1_release, AO_HAVE_fetch_and_sub1_release): Likewise. * src/atomic_ops/sysdeps/msftc/x86_64.h (AO_fetch_and_add_full, AO_HAVE_fetch_and_add_full, AO_fetch_and_add1_full, AO_HAVE_fetch_and_add1_full, AO_fetch_and_sub1_full, AO_HAVE_fetch_and_sub1_full): Likewise. * src/atomic_ops/sysdeps/sunc/x86.h (AO_fetch_and_add_full, AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full, AO_or_full, AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise. * src/atomic_ops/sysdeps/sunc/x86_64.h (AO_fetch_and_add_full, AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full, AO_or_full, AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise. * src/atomic_ops/sysdeps/gcc/arm.h (AO_test_and_set_full, AO_HAVE_test_and_set_full): Do not define if AO_PREFER_GENERALIZED (but only in case of ARMv6+). * src/atomic_ops/sysdeps/msftc/common32_defs.h (_InterlockedIncrement, _InterlockedDecrement, _InterlockedExchangeAdd): Do not declare intrinsic if both AO_PREFER_GENERALIZED and AO_ASSUME_WINDOWS98. * src/atomic_ops/sysdeps/msftc/common32_defs.h (AO_fetch_and_add_full, AO_HAVE_fetch_and_add_full, AO_fetch_and_add1_full, AO_HAVE_fetch_and_add1_full, AO_fetch_and_sub1_full, AO_HAVE_fetch_and_sub1_full): Do not define if both AO_PREFER_GENERALIZED and AO_ASSUME_WINDOWS98. * src/atomic_ops/sysdeps/msftc/x86_64.h (_InterlockedIncrement64, _InterlockedDecrement64, _InterlockedExchangeAdd64): Do not declare intrinsic if AO_PREFER_GENERALIZED.
Diffstat (limited to 'src/atomic_ops/sysdeps/gcc/arm.h')
-rw-r--r--src/atomic_ops/sysdeps/gcc/arm.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/arm.h b/src/atomic_ops/sysdeps/gcc/arm.h
index 4f14271..4496d9a 100644
--- a/src/atomic_ops/sysdeps/gcc/arm.h
+++ b/src/atomic_ops/sysdeps/gcc/arm.h
@@ -145,6 +145,7 @@ AO_INLINE void AO_store(volatile AO_t *addr, AO_t value)
interrupt latencies. LDREX, STREX are more flexible, other instructions
can be done between the LDREX and STREX accesses."
*/
+#ifndef AO_PREFER_GENERALIZED
#if !defined(AO_FORCE_USE_SWP) || defined(__thumb2__)
/* But, on the other hand, there could be a considerable performance */
/* degradation in case of a race. Eg., test_atomic.c executing */
@@ -238,6 +239,7 @@ AO_fetch_and_sub1(volatile AO_t *p)
return result;
}
#define AO_HAVE_fetch_and_sub1
+#endif /* !AO_PREFER_GENERALIZED */
/* NEC LE-IT: compare and swap */
#ifndef AO_GENERALIZE_ASM_BOOL_CAS
@@ -351,6 +353,8 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
#endif /* __ARM_ARCH_x */
#if !defined(AO_HAVE_test_and_set_full) && !defined(AO_HAVE_test_and_set) \
+ && (!defined(AO_PREFER_GENERALIZED) \
+ || !defined(AO_HAVE_fetch_compare_and_swap)) \
&& !defined(__ARM_ARCH_2__) && !defined(__ARM_ARCH_6M__)
AO_INLINE AO_TS_VAL_t
AO_test_and_set_full(volatile AO_TS_t *addr)