mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
remove __clang
ifdef around atomic emulation
* CI errors led me to believe these were needed, but as it turns out the load/store intrinsics are required even when idf is built by gcc when linking to a clang based project. * remove ... postfix inside `SYNC_LOCK_TEST_AND_SET` expansion
This commit is contained in:
parent
b86fe0c66c
commit
d5e4fc8356
@ -200,7 +200,7 @@ CLANG_DECLARE_ALIAS( __sync_bool_compare_and_swap_ ## n )
|
||||
} \
|
||||
CLANG_DECLARE_ALIAS( __sync_val_compare_and_swap_ ## n )
|
||||
|
||||
#define SYNC_LOCK_TEST_AND_SET(n, type) type CLANG_ATOMIC_SUFFIX(__sync_lock_test_and_set_ ## n) (type *ptr, type val, ...) \
|
||||
#define SYNC_LOCK_TEST_AND_SET(n, type) type CLANG_ATOMIC_SUFFIX(__sync_lock_test_and_set_ ## n) (type *ptr, type val) \
|
||||
{ \
|
||||
unsigned state = _ATOMIC_ENTER_CRITICAL(); \
|
||||
type ret = *ptr; \
|
||||
@ -210,7 +210,7 @@ CLANG_DECLARE_ALIAS( __sync_val_compare_and_swap_ ## n )
|
||||
}
|
||||
CLANG_DECLARE_ALIAS( __sync_lock_test_and_set_ ## n )
|
||||
|
||||
#define SYNC_LOCK_RELEASE(n, type) void CLANG_ATOMIC_SUFFIX(__sync_lock_release_ ## n) (type *ptr, ...) \
|
||||
#define SYNC_LOCK_RELEASE(n, type) void CLANG_ATOMIC_SUFFIX(__sync_lock_release_ ## n) (type *ptr) \
|
||||
{ \
|
||||
unsigned state = _ATOMIC_ENTER_CRITICAL(); \
|
||||
*ptr = 0; \
|
||||
@ -277,16 +277,6 @@ SYNC_VAL_CMP_EXCHANGE(1, uint8_t)
|
||||
SYNC_VAL_CMP_EXCHANGE(2, uint16_t)
|
||||
SYNC_VAL_CMP_EXCHANGE(4, uint32_t)
|
||||
|
||||
#ifdef __clang__
|
||||
|
||||
// LLVM has not implemented native atomic load/stores for riscv targets without the Atomic extension
|
||||
// therfore we provide libcalls here when building with the clang toolchain. LLVM thread: https://reviews.llvm.org/D47553.
|
||||
ATOMIC_LOAD(1, uint8_t)
|
||||
ATOMIC_LOAD(2, uint16_t)
|
||||
ATOMIC_LOAD(4, uint32_t)
|
||||
ATOMIC_STORE(1, uint8_t)
|
||||
ATOMIC_STORE(2, uint16_t)
|
||||
ATOMIC_STORE(4, uint32_t)
|
||||
|
||||
SYNC_LOCK_TEST_AND_SET(1, uint8_t)
|
||||
SYNC_LOCK_TEST_AND_SET(2, uint16_t)
|
||||
@ -296,16 +286,19 @@ SYNC_LOCK_RELEASE(1, uint8_t)
|
||||
SYNC_LOCK_RELEASE(2, uint16_t)
|
||||
SYNC_LOCK_RELEASE(4, uint32_t)
|
||||
|
||||
#endif
|
||||
// LLVM has not implemented native atomic load/stores for riscv targets without the Atomic extension. LLVM thread: https://reviews.llvm.org/D47553.
|
||||
// Even though GCC does transform them, these libcalls need to be available for the case where a LLVM based project links against IDF.
|
||||
ATOMIC_LOAD(1, uint8_t)
|
||||
ATOMIC_LOAD(2, uint16_t)
|
||||
ATOMIC_LOAD(4, uint32_t)
|
||||
ATOMIC_STORE(1, uint8_t)
|
||||
ATOMIC_STORE(2, uint16_t)
|
||||
ATOMIC_STORE(4, uint32_t)
|
||||
|
||||
#endif // !HAS_ATOMICS_32
|
||||
|
||||
#if !HAS_ATOMICS_64
|
||||
|
||||
ATOMIC_LOAD(8, uint64_t)
|
||||
|
||||
ATOMIC_STORE(8, uint64_t)
|
||||
|
||||
ATOMIC_EXCHANGE(8, uint64_t)
|
||||
|
||||
CMP_EXCHANGE(8, uint64_t)
|
||||
@ -334,11 +327,12 @@ SYNC_BOOL_CMP_EXCHANGE(8, uint64_t)
|
||||
|
||||
SYNC_VAL_CMP_EXCHANGE(8, uint64_t)
|
||||
|
||||
#ifdef __clang__
|
||||
|
||||
SYNC_LOCK_TEST_AND_SET(8, uint64_t)
|
||||
SYNC_LOCK_RELEASE(8, uint64_t)
|
||||
|
||||
#endif
|
||||
// LLVM has not implemented native atomic load/stores for riscv targets without the Atomic extension. LLVM thread: https://reviews.llvm.org/D47553.
|
||||
// Even though GCC does transform them, these libcalls need to be available for the case where a LLVM based project links against IDF.
|
||||
ATOMIC_LOAD(8, uint64_t)
|
||||
ATOMIC_STORE(8, uint64_t)
|
||||
|
||||
#endif // !HAS_ATOMICS_64
|
||||
|
Loading…
Reference in New Issue
Block a user