From 165fe93e5e3ce740fc6d0f1e4de5d4ee3cdd257d Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Tue, 30 Jan 2018 05:19:05 +0000 Subject: [PATCH] added some checks for atomic builtins --- moo/lib/moo-cmn.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/moo/lib/moo-cmn.h b/moo/lib/moo-cmn.h index 3797524..a10013c 100644 --- a/moo/lib/moo-cmn.h +++ b/moo/lib/moo-cmn.h @@ -721,8 +721,36 @@ typedef struct moo_t moo_t; #if __has_builtin(__builtin_expect) #define MOO_HAVE_BUILTIN_EXPECT #endif + + + #if __has_builtin(__sync_lock_test_and_set) + #define MOO_HAVE_SYNC_LOCK_TEST_AND_SET + #endif + #if __has_builtin(__sync_lock_release) + #define MOO_HAVE_SYNC_LOCK_RELEASE + #endif + + #if __has_builtin(__sync_synchronize) + #define MOO_HAVE_SYNC_SYNCHRONIZE + #endif + #if __has_builtin(__sync_bool_compare_and_swap) + #define MOO_HAVE_SYNC_BOOL_COMPARE_AND_SWAP + #endif + #if __has_builtin(__sync_val_compare_and_swap) + #define MOO_HAVE_SYNC_VAL_COMPARE_AND_SWAP + #endif + #elif defined(__GNUC__) && defined(__GNUC_MINOR__) + #if (__GNUC__ >= 4) + #define MOO_HAVE_SYNC_LOCK_TEST_AND_SET + #define MOO_HAVE_SYNC_LOCK_RELEASE + + #define MOO_HAVE_SYNC_SYNCHRONIZE + #define MOO_HAVE_SYNC_BOOL_COMPARE_AND_SWAP + #define MOO_HAVE_SYNC_VAL_COMPARE_AND_SWAP + #endif + #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) #define MOO_HAVE_BUILTIN_CTZ #define MOO_HAVE_BUILTIN_EXPECT