From: Ivan Maidanski Date: Fri, 9 Jun 2017 07:59:55 +0000 (+0300) Subject: Use GCC atomic intrinsics for Hexagon (clang 3.9+) X-Git-Tag: v7.6.2~70 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0785231858fff3ac0635668c4f6341208e425a64;p=platform%2Fupstream%2Flibatomic_ops.git Use GCC atomic intrinsics for Hexagon (clang 3.9+) * src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9) && !AO_DISABLE_GCC_ATOMICS] (AO_GCC_FORCE_HAVE_CAS, AO_GCC_HAVE_double_SYNC_CAS): Define. * src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9) && !AO_DISABLE_GCC_ATOMICS]: Include standard_ao_double_t.h, generic.h. * src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9) && !AO_DISABLE_GCC_ATOMICS]: Do not include test_and_set_t_is_ao_t.h, all_aligned_atomic_load_store.h. * src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9) && !AO_DISABLE_GCC_ATOMICS]: Do not define AO_nop_full, AO_fetch_and_add, AO_test_and_set, AO_compare_and_swap, AO_fetch_compare_and_swap, AO_T_IS_INT. --- diff --git a/src/atomic_ops/sysdeps/gcc/hexagon.h b/src/atomic_ops/sysdeps/gcc/hexagon.h index 93a236b..19b348b 100644 --- a/src/atomic_ops/sysdeps/gcc/hexagon.h +++ b/src/atomic_ops/sysdeps/gcc/hexagon.h @@ -9,6 +9,19 @@ * modified is included with the above copyright notice. */ +#if AO_CLANG_PREREQ(3, 9) && !defined(AO_DISABLE_GCC_ATOMICS) + /* Probably, it could be enabled for earlier clang versions as well. */ + + /* As of clang-3.9, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n are missing. */ +# define AO_GCC_FORCE_HAVE_CAS + +# define AO_GCC_HAVE_double_SYNC_CAS +# include "../standard_ao_double_t.h" + +# include "generic.h" + +#else /* AO_DISABLE_GCC_ATOMICS */ + #include "../all_aligned_atomic_load_store.h" #include "../test_and_set_t_is_ao_t.h" @@ -120,3 +133,5 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val) #define AO_HAVE_fetch_compare_and_swap #define AO_T_IS_INT + +#endif /* AO_DISABLE_GCC_ATOMICS */