diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-08-01 23:20:36 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-08-01 23:25:56 +0300 |
commit | fb1c731d1d765671da058cdb594ff2c9a32463ea (patch) | |
tree | ec76b39360ecab2ae638c4490bb5fade9a0c956b | |
parent | d809f6a02162435996be16444fa70e0d57ed1c2c (diff) | |
download | libatomic_ops-fb1c731d1d765671da058cdb594ff2c9a32463ea.tar.gz |
Use GCC atomic intrinsics for sparc
The intrinsics are used in gcc/sparc.h (unless AO_DISABLE_GCC_ATOMICS)
starting from gcc-12 and clang-13.
* src/atomic_ops/sysdeps/gcc/sparc.h: Remove TODO item that support
is incomplete and about compare-and-swap.
* src/atomic_ops/sysdeps/gcc/sparc.h [(AO_GNUC_PREREQ(12,0)
|| AO_CLANG_PREREQ(13,0)) && !AO_DISABLE_GCC_ATOMICS]: Include
generic.h; do not include all_atomic_load_store.h, ordered_except_wr.h,
test_and_set_t_is_char.h.
* src/atomic_ops/sysdeps/gcc/sparc.h [(AO_GNUC_PREREQ(12,0)
|| AO_CLANG_PREREQ(13,0)) && !AO_DISABLE_GCC_ATOMICS]
(AO_test_and_set_full, AO_compare_and_swap_full,
AO_fetch_compare_and_swap_full): Do not define as an asm-based
implementation.
-rw-r--r-- | src/atomic_ops/sysdeps/gcc/sparc.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/sparc.h b/src/atomic_ops/sysdeps/gcc/sparc.h index 99483e4..1d52be7 100644 --- a/src/atomic_ops/sysdeps/gcc/sparc.h +++ b/src/atomic_ops/sysdeps/gcc/sparc.h @@ -15,8 +15,13 @@ * */ -/* TODO: Very incomplete; Add support for sparc64. */ -/* Non-ancient SPARCs provide compare-and-swap (casa). */ +#if (AO_GNUC_PREREQ(12, 0) || AO_CLANG_PREREQ(13, 0)) \ + && !defined(AO_DISABLE_GCC_ATOMICS) + /* Probably, it could be enabled for earlier compiler versions as well. */ + +# include "generic.h" + +#else /* AO_DISABLE_GCC_ATOMICS */ #include "../all_atomic_load_store.h" @@ -85,3 +90,5 @@ AO_fetch_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { /* TODO: Extend this for SPARC v8 and v9 (V8 also has swap, V9 has CAS, */ /* there are barriers like membar #LoadStore, CASA (32-bit) and */ /* CASXA (64-bit) instructions added in V9). */ + +#endif /* AO_DISABLE_GCC_ATOMICS */ |