From 002f1d341b37c6db55f1a260f6a6d93233b9eb70 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Mon, 4 Oct 2010 23:55:35 +0000 Subject: [PATCH] Filling out the infrastructure in git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115577 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/atomic | 9452 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 9371 insertions(+), 81 deletions(-) diff --git a/include/atomic b/include/atomic index edcfd2ed..e55d092c 100644 --- a/include/atomic +++ b/include/atomic @@ -2439,7 +2439,7 @@ mutex& __not_atomic_mut(); template _Tp -__load_seq_cst(const volatile _Tp* __obj) +__load_seq_cst(_Tp const volatile* __obj) { unique_lock _(__not_atomic_mut()); return *__obj; @@ -2449,7 +2449,7 @@ __load_seq_cst(const volatile _Tp* __obj) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_load_seq_cst(const volatile bool* __obj) +__choose_load_seq_cst(bool const volatile* __obj) { #if __has_feature(__atomic_load_seq_cst_b) return __atomic_load_seq_cst(__obj); @@ -2460,7 +2460,7 @@ __choose_load_seq_cst(const volatile bool* __obj) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_load_acquire(const volatile bool* __obj) +__choose_load_acquire(bool const volatile* __obj) { #if __has_feature(__atomic_load_acquire_b) return __atomic_load_acquire(__obj); @@ -2471,7 +2471,7 @@ __choose_load_acquire(const volatile bool* __obj) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_load_consume(const volatile bool* __obj) +__choose_load_consume(bool const volatile* __obj) { #if __has_feature(__atomic_load_consume_b) return __atomic_load_consume(__obj); @@ -2482,7 +2482,7 @@ __choose_load_consume(const volatile bool* __obj) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_load_relaxed(const volatile bool* __obj) +__choose_load_relaxed(bool const volatile* __obj) { #if __has_feature(__atomic_load_relaxed_b) return __atomic_load_relaxed(__obj); @@ -2491,11 +2491,705 @@ __choose_load_relaxed(const volatile bool* __obj) #endif } +// load char + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_load_seq_cst(char const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_c) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_load_acquire(char const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_c) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_load_consume(char const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_c) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_load_relaxed(char const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_c) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load signed char + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_load_seq_cst(signed char const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_a) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_load_acquire(signed char const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_a) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_load_consume(signed char const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_a) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_load_relaxed(signed char const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_a) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load unsigned char + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_load_seq_cst(unsigned char const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_h) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_load_acquire(unsigned char const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_h) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_load_consume(unsigned char const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_h) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_load_relaxed(unsigned char const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_h) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + +// load char16_t + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_load_seq_cst(char16_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_Ds) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_load_acquire(char16_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_Ds) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_load_consume(char16_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_Ds) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_load_relaxed(char16_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_Ds) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load char32_t + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_load_seq_cst(char32_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_Di) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_load_acquire(char32_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_Di) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_load_consume(char32_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_Di) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_load_relaxed(char32_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_Di) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS + +// load wchar_t + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_load_seq_cst(wchar_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_w) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_load_acquire(wchar_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_w) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_load_consume(wchar_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_w) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_load_relaxed(wchar_t const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_w) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load short + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_load_seq_cst(short const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_s) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_load_acquire(short const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_s) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_load_consume(short const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_s) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_load_relaxed(short const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_s) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load unsigned short + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_load_seq_cst(unsigned short const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_t) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_load_acquire(unsigned short const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_t) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_load_consume(unsigned short const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_t) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_load_relaxed(unsigned short const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_t) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load int + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_load_seq_cst(int const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_i) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_load_acquire(int const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_i) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_load_consume(int const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_i) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_load_relaxed(int const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_i) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load unsigned int + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_load_seq_cst(unsigned int const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_j) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_load_acquire(unsigned int const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_j) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_load_consume(unsigned int const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_j) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_load_relaxed(unsigned int const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_j) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load long + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_load_seq_cst(long const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_l) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_load_acquire(long const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_l) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_load_consume(long const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_l) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_load_relaxed(long const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_l) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load unsigned long + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_load_seq_cst(unsigned long const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_m) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_load_acquire(unsigned long const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_m) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_load_consume(unsigned long const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_m) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_load_relaxed(unsigned long const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_m) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load long long + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_load_seq_cst(long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_x) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_load_acquire(long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_x) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_load_consume(long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_x) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_load_relaxed(long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_x) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load unsigned long long + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_load_seq_cst(unsigned long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_y) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_load_acquire(unsigned long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_y) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_load_consume(unsigned long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_y) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_load_relaxed(unsigned long long const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_y) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + +// load void* + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_load_seq_cst(void* const volatile* __obj) +{ +#if __has_feature(__atomic_load_seq_cst_Py) + return __atomic_load_seq_cst(__obj); +#else + return __load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_load_acquire(void* const volatile* __obj) +{ +#if __has_feature(__atomic_load_acquire_Py) + return __atomic_load_acquire(__obj); +#else + return __choose_load_seq_cst(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_load_consume(void* const volatile* __obj) +{ +#if __has_feature(__atomic_load_consume_Py) + return __atomic_load_consume(__obj); +#else + return __choose_load_acquire(__obj); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_load_relaxed(void* const volatile* __obj) +{ +#if __has_feature(__atomic_load_relaxed_Py) + return __atomic_load_relaxed(__obj); +#else + return __choose_load_consume(__obj); +#endif +} + // store template void -__store_seq_cst(volatile _Tp* __obj, _Tp __desr) +__store_seq_cst(_Tp volatile* __obj, _Tp __desr) { unique_lock _(__not_atomic_mut()); *__obj = __desr; @@ -2505,7 +3199,7 @@ __store_seq_cst(volatile _Tp* __obj, _Tp __desr) inline _LIBCPP_INLINE_VISIBILITY void -__choose_store_seq_cst(volatile bool* __obj, bool __desr) +__choose_store_seq_cst(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_store_seq_cst_b) __atomic_store_seq_cst(__obj, __desr); @@ -2516,7 +3210,7 @@ __choose_store_seq_cst(volatile bool* __obj, bool __desr) inline _LIBCPP_INLINE_VISIBILITY void -__choose_store_release(volatile bool* __obj, bool __desr) +__choose_store_release(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_store_release_b) __atomic_store_release(__obj, __desr); @@ -2527,7 +3221,7 @@ __choose_store_release(volatile bool* __obj, bool __desr) inline _LIBCPP_INLINE_VISIBILITY void -__choose_store_relaxed(volatile bool* __obj, bool __desr) +__choose_store_relaxed(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_store_relaxed_b) __atomic_store_relaxed(__obj, __desr); @@ -2536,11 +3230,540 @@ __choose_store_relaxed(volatile bool* __obj, bool __desr) #endif } +// store char + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_store_seq_cst_c) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_store_release_c) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_store_relaxed_c) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store signed char + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_store_seq_cst_a) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_store_release_a) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_store_relaxed_a) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store unsigned char + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_store_seq_cst_h) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_store_release_h) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_store_relaxed_h) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + +// store char16_t + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_store_seq_cst_Ds) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_store_release_Ds) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_store_relaxed_Ds) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store char32_t + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_store_seq_cst_Di) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_store_release_Di) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_store_relaxed_Di) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS + +// store wchar_t + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_store_seq_cst_w) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_store_release_w) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_store_relaxed_w) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store short + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_store_seq_cst_s) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_store_release_s) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_store_relaxed_s) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store unsigned short + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_store_seq_cst_t) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_store_release_t) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_store_relaxed_t) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store int + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_store_seq_cst_i) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_store_release_i) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_store_relaxed_i) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store unsigned int + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_store_seq_cst_j) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_store_release_j) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_store_relaxed_j) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store long + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_store_seq_cst_l) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_store_release_l) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_store_relaxed_l) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store unsigned long + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_store_seq_cst_m) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_store_release_m) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_store_relaxed_m) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store long long + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_store_seq_cst_x) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_store_release_x) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_store_relaxed_x) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store unsigned long long + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_store_seq_cst_y) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_store_release_y) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_store_relaxed_y) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + +// store void* + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_seq_cst(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_store_seq_cst_Py) + __atomic_store_seq_cst(__obj, __desr); +#else + __store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_release(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_store_release_Py) + __atomic_store_release(__obj, __desr); +#else + __choose_store_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void +__choose_store_relaxed(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_store_relaxed_Py) + __atomic_store_relaxed(__obj, __desr); +#else + __choose_store_release(__obj, __desr); +#endif +} + // exchange template _Tp -__exchange_seq_cst(volatile _Tp* __obj, _Tp __desr) +__exchange_seq_cst(_Tp volatile* __obj, _Tp __desr) { unique_lock _(__not_atomic_mut()); _Tp __r = *__obj; @@ -2552,7 +3775,7 @@ __exchange_seq_cst(volatile _Tp* __obj, _Tp __desr) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_exchange_seq_cst(volatile bool* __obj, bool __desr) +__choose_exchange_seq_cst(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_exchange_seq_cst_b) return __atomic_exchange_seq_cst(__obj, __desr); @@ -2563,7 +3786,7 @@ __choose_exchange_seq_cst(volatile bool* __obj, bool __desr) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_exchange_acq_rel(volatile bool* __obj, bool __desr) +__choose_exchange_acq_rel(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_exchange_acq_rel_b) return __atomic_exchange_acq_rel(__obj, __desr); @@ -2574,7 +3797,7 @@ __choose_exchange_acq_rel(volatile bool* __obj, bool __desr) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_exchange_release(volatile bool* __obj, bool __desr) +__choose_exchange_release(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_exchange_release_b) return __atomic_exchange_release(__obj, __desr); @@ -2585,7 +3808,7 @@ __choose_exchange_release(volatile bool* __obj, bool __desr) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_exchange_acquire(volatile bool* __obj, bool __desr) +__choose_exchange_acquire(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_exchange_acquire_b) return __atomic_exchange_acquire(__obj, __desr); @@ -2596,7 +3819,7 @@ __choose_exchange_acquire(volatile bool* __obj, bool __desr) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_exchange_consume(volatile bool* __obj, bool __desr) +__choose_exchange_consume(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_exchange_consume_b) return __atomic_exchange_consume(__obj, __desr); @@ -2607,7 +3830,7 @@ __choose_exchange_consume(volatile bool* __obj, bool __desr) inline _LIBCPP_INLINE_VISIBILITY bool -__choose_exchange_relaxed(volatile bool* __obj, bool __desr) +__choose_exchange_relaxed(bool volatile* __obj, bool __desr) { #if __has_feature(__atomic_exchange_relaxed_b) return __atomic_exchange_relaxed(__obj, __desr); @@ -2616,11 +3839,1035 @@ __choose_exchange_relaxed(volatile bool* __obj, bool __desr) #endif } +// exchange char + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_exchange_seq_cst(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_c) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_exchange_acq_rel(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_c) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_exchange_release(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_exchange_release_c) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_exchange_acquire(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_exchange_acquire_c) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_exchange_consume(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_exchange_consume_c) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char +__choose_exchange_relaxed(char volatile* __obj, char __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_c) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange signed char + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_exchange_seq_cst(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_a) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_exchange_acq_rel(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_a) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_exchange_release(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_exchange_release_a) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_exchange_acquire(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_exchange_acquire_a) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_exchange_consume(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_exchange_consume_a) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +signed char +__choose_exchange_relaxed(signed char volatile* __obj, signed char __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_a) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange unsigned char + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_exchange_seq_cst(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_h) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_exchange_acq_rel(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_h) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_exchange_release(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_exchange_release_h) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_exchange_acquire(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_exchange_acquire_h) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_exchange_consume(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_exchange_consume_h) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned char +__choose_exchange_relaxed(unsigned char volatile* __obj, unsigned char __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_h) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + +// exchange char16_t + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_exchange_seq_cst(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_Ds) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_exchange_acq_rel(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_Ds) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_exchange_release(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_exchange_release_Ds) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_exchange_acquire(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_exchange_acquire_Ds) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_exchange_consume(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_exchange_consume_Ds) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char16_t +__choose_exchange_relaxed(char16_t volatile* __obj, char16_t __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_Ds) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange char32_t + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_exchange_seq_cst(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_Di) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_exchange_acq_rel(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_Di) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_exchange_release(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_exchange_release_Di) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_exchange_acquire(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_exchange_acquire_Di) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_exchange_consume(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_exchange_consume_Di) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +char32_t +__choose_exchange_relaxed(char32_t volatile* __obj, char32_t __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_Di) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS + +// exchange wchar_t + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_exchange_seq_cst(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_w) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_exchange_acq_rel(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_w) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_exchange_release(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_exchange_release_w) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_exchange_acquire(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_exchange_acquire_w) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_exchange_consume(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_exchange_consume_w) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +wchar_t +__choose_exchange_relaxed(wchar_t volatile* __obj, wchar_t __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_w) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange short + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_exchange_seq_cst(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_s) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_exchange_acq_rel(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_s) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_exchange_release(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_exchange_release_s) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_exchange_acquire(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_exchange_acquire_s) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_exchange_consume(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_exchange_consume_s) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +short +__choose_exchange_relaxed(short volatile* __obj, short __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_s) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange unsigned short + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_exchange_seq_cst(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_t) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_exchange_acq_rel(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_t) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_exchange_release(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_exchange_release_t) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_exchange_acquire(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_exchange_acquire_t) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_exchange_consume(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_exchange_consume_t) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned short +__choose_exchange_relaxed(unsigned short volatile* __obj, unsigned short __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_t) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange int + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_exchange_seq_cst(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_i) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_exchange_acq_rel(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_i) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_exchange_release(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_exchange_release_i) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_exchange_acquire(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_exchange_acquire_i) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_exchange_consume(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_exchange_consume_i) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +int +__choose_exchange_relaxed(int volatile* __obj, int __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_i) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange unsigned int + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_exchange_seq_cst(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_j) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_exchange_acq_rel(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_j) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_exchange_release(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_exchange_release_j) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_exchange_acquire(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_exchange_acquire_j) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_exchange_consume(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_exchange_consume_j) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned int +__choose_exchange_relaxed(unsigned int volatile* __obj, unsigned int __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_j) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange long + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_exchange_seq_cst(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_l) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_exchange_acq_rel(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_l) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_exchange_release(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_exchange_release_l) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_exchange_acquire(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_exchange_acquire_l) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_exchange_consume(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_exchange_consume_l) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long +__choose_exchange_relaxed(long volatile* __obj, long __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_l) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange unsigned long + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_exchange_seq_cst(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_m) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_exchange_acq_rel(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_m) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_exchange_release(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_exchange_release_m) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_exchange_acquire(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_exchange_acquire_m) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_exchange_consume(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_exchange_consume_m) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__choose_exchange_relaxed(unsigned long volatile* __obj, unsigned long __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_m) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange long long + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_exchange_seq_cst(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_x) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_exchange_acq_rel(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_x) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_exchange_release(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_exchange_release_x) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_exchange_acquire(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_exchange_acquire_x) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_exchange_consume(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_exchange_consume_x) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +long long +__choose_exchange_relaxed(long long volatile* __obj, long long __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_x) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange unsigned long long + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_exchange_seq_cst(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_y) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_exchange_acq_rel(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_y) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_exchange_release(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_exchange_release_y) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_exchange_acquire(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_exchange_acquire_y) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_exchange_consume(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_exchange_consume_y) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__choose_exchange_relaxed(unsigned long long volatile* __obj, unsigned long long __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_y) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + +// exchange void* + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_exchange_seq_cst(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_exchange_seq_cst_Py) + return __atomic_exchange_seq_cst(__obj, __desr); +#else + return __exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_exchange_acq_rel(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_exchange_acq_rel_Py) + return __atomic_exchange_acq_rel(__obj, __desr); +#else + return __choose_exchange_seq_cst(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_exchange_release(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_exchange_release_Py) + return __atomic_exchange_release(__obj, __desr); +#else + return __choose_exchange_acq_rel(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_exchange_acquire(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_exchange_acquire_Py) + return __atomic_exchange_acquire(__obj, __desr); +#else + return __choose_exchange_release(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_exchange_consume(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_exchange_consume_Py) + return __atomic_exchange_consume(__obj, __desr); +#else + return __choose_exchange_acquire(__obj, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +void* +__choose_exchange_relaxed(void* volatile* __obj, void* __desr) +{ +#if __has_feature(__atomic_exchange_relaxed_Py) + return __atomic_exchange_relaxed(__obj, __desr); +#else + return __choose_exchange_consume(__obj, __desr); +#endif +} + // compare_exchange_strong template bool -__compare_exchange_strong_seq_cst_seq_cst(volatile _Tp* __obj, _Tp* __exp, +__compare_exchange_strong_seq_cst_seq_cst(_Tp volatile* __obj, _Tp* __exp, _Tp __desr) { unique_lock _(__not_atomic_mut()); @@ -2637,8 +4884,9 @@ __compare_exchange_strong_seq_cst_seq_cst(volatile _Tp* __obj, _Tp* __exp, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_seq_cst_seq_cst(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_seq_cst_seq_cst(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_b) return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, @@ -2650,8 +4898,9 @@ __choose_compare_exchange_strong_seq_cst_seq_cst(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_seq_cst_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_seq_cst_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_b) return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, @@ -2664,8 +4913,9 @@ __choose_compare_exchange_strong_seq_cst_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_seq_cst_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_seq_cst_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_b) return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, @@ -2678,8 +4928,9 @@ __choose_compare_exchange_strong_seq_cst_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_seq_cst_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_seq_cst_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_b) return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, @@ -2692,8 +4943,9 @@ __choose_compare_exchange_strong_seq_cst_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_acq_rel_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_acq_rel_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_b) return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, @@ -2706,8 +4958,9 @@ __choose_compare_exchange_strong_acq_rel_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_acq_rel_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_acq_rel_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_b) return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, @@ -2720,8 +4973,9 @@ __choose_compare_exchange_strong_acq_rel_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_acq_rel_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_acq_rel_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_b) return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, @@ -2734,8 +4988,9 @@ __choose_compare_exchange_strong_acq_rel_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_release_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_release_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_release_acquire_b) return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, @@ -2748,8 +5003,9 @@ __choose_compare_exchange_strong_release_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_release_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_release_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_release_consume_b) return __atomic_compare_exchange_strong_release_consume(__obj, __exp, @@ -2762,8 +5018,9 @@ __choose_compare_exchange_strong_release_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_release_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_release_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_release_relaxed_b) return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, @@ -2776,8 +5033,9 @@ __choose_compare_exchange_strong_release_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_acquire_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_acquire_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_b) return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, @@ -2790,8 +5048,9 @@ __choose_compare_exchange_strong_acquire_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_acquire_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_acquire_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_acquire_consume_b) return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, @@ -2804,8 +5063,9 @@ __choose_compare_exchange_strong_acquire_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_acquire_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_acquire_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_b) return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, @@ -2818,8 +5078,9 @@ __choose_compare_exchange_strong_acquire_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_consume_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_consume_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_consume_consume_b) return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, @@ -2832,8 +5093,9 @@ __choose_compare_exchange_strong_consume_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_consume_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_consume_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_b) return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, @@ -2846,8 +5108,9 @@ __choose_compare_exchange_strong_consume_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_strong_relaxed_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_strong_relaxed_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_b) return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, @@ -2858,12 +5121,3632 @@ __choose_compare_exchange_strong_relaxed_relaxed(volatile bool* __obj, #endif } +// compare_exchange_strong char + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_c) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_c) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_c) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_c) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_c) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_c) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_c) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_c) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_c) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_c) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_c) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_c) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_c) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_c) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_c) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(char volatile* __obj, + char* __exp, + char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_c) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong signed char + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_a) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_a) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_a) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_a) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_a) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_a) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_a) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_a) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_a) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_a) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_a) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_a) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_a) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_a) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_a) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_a) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong unsigned char + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_h) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_h) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_h) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_h) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_h) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_h) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_h) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_h) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_h) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_h) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_h) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_h) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_h) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_h) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_h) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_h) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + +// compare_exchange_strong char16_t + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_Ds) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_Ds) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_Ds) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_Ds) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_Ds) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_Ds) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_Ds) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_Ds) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_Ds) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_Ds) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_Ds) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_Ds) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_Ds) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_Ds) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_Ds) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_Ds) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong char32_t + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_Di) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_Di) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_Di) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_Di) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_Di) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_Di) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_Di) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_Di) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_Di) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_Di) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_Di) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_Di) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_Di) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_Di) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_Di) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_Di) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS + +// compare_exchange_strong wchar_t + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_w) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_w) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_w) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_w) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_w) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_w) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_w) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_w) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_w) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_w) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_w) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_w) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_w) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_w) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_w) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_w) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong short + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_s) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_s) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_s) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_s) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_s) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_s) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_s) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_s) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_s) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_s) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_s) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_s) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_s) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_s) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_s) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_s) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong unsigned short + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_t) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_t) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_t) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_t) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_t) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_t) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_t) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_t) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_t) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_t) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_t) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_t) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_t) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_t) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_t) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_t) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong int + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_i) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_i) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_i) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_i) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_i) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_i) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_i) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_i) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_i) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_i) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_i) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_i) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_i) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_i) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_i) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_i) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong unsigned int + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_j) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_j) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_j) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_j) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_j) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_j) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_j) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_j) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_j) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_j) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_j) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_j) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_j) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_j) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_j) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_j) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_l) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_l) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_l) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_l) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_l) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_l) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_l) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_l) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_l) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_l) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_l) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_l) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_l) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_l) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_l) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_l) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong unsigned long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_m) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_m) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_m) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_m) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_m) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_m) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_m) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_m) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_m) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_m) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_m) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_m) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_m) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_m) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_m) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_m) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong long long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_x) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_x) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_x) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_x) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_x) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_x) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_x) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_x) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_x) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_x) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_x) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_x) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_x) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_x) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_x) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_x) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong unsigned long long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_y) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_y) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_y) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_y) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_y) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_y) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_y) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_y) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_y) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_y) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_y) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_y) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_y) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_y) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_y) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_y) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_strong void* + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_seq_cst(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_seq_cst_Py) + return __atomic_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_acquire_Py) + return __atomic_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_consume_Py) + return __atomic_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_seq_cst_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_seq_cst_relaxed_Py) + return __atomic_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_acquire_Py) + return __atomic_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_consume_Py) + return __atomic_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acq_rel_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acq_rel_relaxed_Py) + return __atomic_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_acquire_Py) + return __atomic_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_consume_Py) + return __atomic_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_release_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_release_relaxed_Py) + return __atomic_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_acquire_Py) + return __atomic_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_consume_Py) + return __atomic_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_acquire_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_acquire_relaxed_Py) + return __atomic_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_consume_Py) + return __atomic_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_consume_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_consume_relaxed_Py) + return __atomic_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_strong_relaxed_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_strong_relaxed_relaxed_Py) + return __atomic_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + // compare_exchange_weak bool inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_seq_cst_seq_cst(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_seq_cst_seq_cst(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_b) return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, @@ -2876,8 +8759,9 @@ __choose_compare_exchange_weak_seq_cst_seq_cst(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_seq_cst_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_seq_cst_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_b) return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, @@ -2890,8 +8774,9 @@ __choose_compare_exchange_weak_seq_cst_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_seq_cst_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_seq_cst_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_b) return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, @@ -2904,8 +8789,9 @@ __choose_compare_exchange_weak_seq_cst_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_seq_cst_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_seq_cst_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_b) return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, @@ -2918,8 +8804,9 @@ __choose_compare_exchange_weak_seq_cst_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_acq_rel_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_acq_rel_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_b) return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, @@ -2932,8 +8819,9 @@ __choose_compare_exchange_weak_acq_rel_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_acq_rel_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_acq_rel_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_b) return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, @@ -2946,8 +8834,9 @@ __choose_compare_exchange_weak_acq_rel_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_acq_rel_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_acq_rel_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_b) return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, @@ -2960,8 +8849,9 @@ __choose_compare_exchange_weak_acq_rel_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_release_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_release_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_release_acquire_b) return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, @@ -2974,8 +8864,9 @@ __choose_compare_exchange_weak_release_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_release_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_release_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_release_consume_b) return __atomic_compare_exchange_weak_release_consume(__obj, __exp, @@ -2988,8 +8879,9 @@ __choose_compare_exchange_weak_release_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_release_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_release_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_release_relaxed_b) return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, @@ -3002,8 +8894,9 @@ __choose_compare_exchange_weak_release_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_acquire_acquire(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_acquire_acquire(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_b) return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, @@ -3016,8 +8909,9 @@ __choose_compare_exchange_weak_acquire_acquire(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_acquire_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_acquire_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_acquire_consume_b) return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, @@ -3030,8 +8924,9 @@ __choose_compare_exchange_weak_acquire_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_acquire_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_acquire_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_b) return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, @@ -3044,8 +8939,9 @@ __choose_compare_exchange_weak_acquire_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_consume_consume(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_consume_consume(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_consume_consume_b) return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, @@ -3058,8 +8954,9 @@ __choose_compare_exchange_weak_consume_consume(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_consume_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_consume_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_b) return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, @@ -3072,8 +8969,9 @@ __choose_compare_exchange_weak_consume_relaxed(volatile bool* __obj, inline _LIBCPP_INLINE_VISIBILITY bool -__choose_compare_exchange_weak_relaxed_relaxed(volatile bool* __obj, - bool* __exp, bool __desr) +__choose_compare_exchange_weak_relaxed_relaxed(bool volatile* __obj, + bool* __exp, + bool __desr) { #if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_b) return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, @@ -3084,6 +8982,3398 @@ __choose_compare_exchange_weak_relaxed_relaxed(volatile bool* __obj, #endif } +// compare_exchange_weak signed char + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_a) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_a) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_a) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_a) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_a) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_a) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_a) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_a) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_a) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_a) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_a) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_a) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_a) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_a) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_a) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(signed char volatile* __obj, + signed char* __exp, + signed char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_a) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak unsigned char + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_h) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_h) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_h) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_h) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_h) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_h) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_h) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_h) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_h) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_h) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_h) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_h) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_h) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_h) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_h) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(unsigned char volatile* __obj, + unsigned char* __exp, + unsigned char __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_h) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + +// compare_exchange_weak char16_t + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_Ds) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_Ds) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_Ds) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_Ds) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_Ds) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_Ds) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_Ds) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_Ds) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_Ds) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_Ds) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_Ds) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_Ds) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_Ds) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_Ds) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_Ds) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(char16_t volatile* __obj, + char16_t* __exp, + char16_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_Ds) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak char32_t + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_Di) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_Di) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_Di) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_Di) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_Di) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_Di) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_Di) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_Di) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_Di) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_Di) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_Di) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_Di) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_Di) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_Di) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_Di) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(char32_t volatile* __obj, + char32_t* __exp, + char32_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_Di) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS + +// compare_exchange_weak wchar_t + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_w) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_w) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_w) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_w) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_w) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_w) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_w) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_w) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_w) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_w) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_w) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_w) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_w) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_w) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_w) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(wchar_t volatile* __obj, + wchar_t* __exp, + wchar_t __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_w) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak short + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_s) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_s) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_s) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_s) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_s) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_s) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_s) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_s) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_s) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_s) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_s) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_s) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_s) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_s) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_s) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(short volatile* __obj, + short* __exp, + short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_s) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak unsigned short + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_t) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_t) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_t) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_t) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_t) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_t) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_t) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_t) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_t) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_t) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_t) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_t) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_t) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_t) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_t) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(unsigned short volatile* __obj, + unsigned short* __exp, + unsigned short __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_t) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak int + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_i) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_i) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_i) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_i) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_i) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_i) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_i) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_i) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_i) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_i) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_i) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_i) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_i) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_i) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_i) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(int volatile* __obj, + int* __exp, + int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_i) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak unsigned int + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_j) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_j) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_j) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_j) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_j) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_j) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_j) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_j) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_j) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_j) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_j) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_j) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_j) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_j) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_j) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(unsigned int volatile* __obj, + unsigned int* __exp, + unsigned int __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_j) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_l) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_l) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_l) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_l) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_l) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_l) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_l) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_l) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_l) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_l) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_l) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_l) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_l) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_l) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_l) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(long volatile* __obj, + long* __exp, + long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_l) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak unsigned long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_m) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_m) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_m) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_m) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_m) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_m) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_m) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_m) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_m) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_m) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_m) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_m) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_m) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_m) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_m) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(unsigned long volatile* __obj, + unsigned long* __exp, + unsigned long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_m) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak long long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_x) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_x) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_x) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_x) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_x) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_x) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_x) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_x) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_x) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_x) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_x) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_x) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_x) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_x) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_x) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(long long volatile* __obj, + long long* __exp, + long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_x) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak unsigned long long + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_y) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_y) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_y) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_y) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_y) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_y) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_y) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_y) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_y) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_y) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_y) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_y) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_y) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_y) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_y) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(unsigned long long volatile* __obj, + unsigned long long* __exp, + unsigned long long __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_y) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + +// compare_exchange_weak void* + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_seq_cst(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_seq_cst_Py) + return __atomic_compare_exchange_weak_seq_cst_seq_cst(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_seq_cst(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_acquire_Py) + return __atomic_compare_exchange_weak_seq_cst_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_consume_Py) + return __atomic_compare_exchange_weak_seq_cst_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_seq_cst_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_seq_cst_relaxed_Py) + return __atomic_compare_exchange_weak_seq_cst_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_seq_cst_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_acquire_Py) + return __atomic_compare_exchange_weak_acq_rel_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_consume_Py) + return __atomic_compare_exchange_weak_acq_rel_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acq_rel_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acq_rel_relaxed_Py) + return __atomic_compare_exchange_weak_acq_rel_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acq_rel_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_acquire_Py) + return __atomic_compare_exchange_weak_release_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_consume_Py) + return __atomic_compare_exchange_weak_release_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_release_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_release_relaxed_Py) + return __atomic_compare_exchange_weak_release_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_release_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_acquire(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_acquire_Py) + return __atomic_compare_exchange_weak_acquire_acquire(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_acquire(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_consume_Py) + return __atomic_compare_exchange_weak_acquire_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_acquire_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_acquire_relaxed_Py) + return __atomic_compare_exchange_weak_acquire_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_acquire_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_consume(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_consume_Py) + return __atomic_compare_exchange_weak_consume_consume(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_consume(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_consume_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_consume_relaxed_Py) + return __atomic_compare_exchange_weak_consume_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_consume_relaxed(__obj, __exp, + __desr); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +__choose_compare_exchange_weak_relaxed_relaxed(void* volatile* __obj, + void** __exp, + void* __desr) +{ +#if __has_feature(__atomic_compare_exchange_weak_relaxed_relaxed_Py) + return __atomic_compare_exchange_weak_relaxed_relaxed(__obj, __exp, + __desr); +#else + return __choose_compare_exchange_strong_relaxed_relaxed(__obj, __exp, + __desr); +#endif +} + // flag type and operations struct atomic_flag;