diff options
author | Matias Elo <matias.elo@nokia.com> | 2021-03-15 12:48:20 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2021-03-19 08:36:54 +0200 |
commit | f09a85f0fe20d1d130db152f318384786bcefb5b (patch) | |
tree | 19c4d11527984b14f3b34ab27608b5934111207d /platform/linux-generic/arch/aarch64/odp_atomic.h | |
parent | 8f99312bbd002c2d71e3e6d68d19d3dcacc64237 (diff) |
linux-gen: atomic: reorganize architecture specific implementations
Move architecture specific atomic function implementations to separate
header files. Enables 128-bit atomic function inlining.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform/linux-generic/arch/aarch64/odp_atomic.h')
-rw-r--r-- | platform/linux-generic/arch/aarch64/odp_atomic.h | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/platform/linux-generic/arch/aarch64/odp_atomic.h b/platform/linux-generic/arch/aarch64/odp_atomic.h index dbeccebde..d6648a1f0 100644 --- a/platform/linux-generic/arch/aarch64/odp_atomic.h +++ b/platform/linux-generic/arch/aarch64/odp_atomic.h @@ -217,54 +217,4 @@ static inline __int128 __lockfree_load_16(__int128 *var, int mo) return old; } -#ifdef _ODP_LOCK_FREE_128BIT_ATOMICS - -/** - * @internal - * Helper macro for lockless atomic CAS operations on 128-bit integers - * @param[in,out] atom Pointer to the 128-bit atomic variable - * @param oper CAS operation - * @param old_val Old value - * @param new_val New value to be swapped - * @return 1 for success and 0 for fail - */ -#define ATOMIC_CAS_OP_128(atom, oper, old_val, new_val, val) \ -({ \ - odp_u128_t _val; \ - odp_atomic_u128_t *_atom = atom; \ - odp_u128_t *_old_val = old_val; \ - odp_u128_t _new_val = new_val; \ - odp_u128_t *ptr = (odp_u128_t *)(_atom); \ - register uint64_t old0 __asm__ ("x0"); \ - register uint64_t old1 __asm__ ("x1"); \ - register uint64_t new0 __asm__ ("x2"); \ - register uint64_t new1 __asm__ ("x3"); \ - old0 = (uint64_t)(_old_val)->u64[0]; \ - old1 = (uint64_t)(_old_val)->u64[1]; \ - new0 = (uint64_t)(_new_val).u64[0]; \ - new1 = (uint64_t)(_new_val).u64[1]; \ - __asm__ volatile(oper " %[old0], %[old1], %[new0], %[new1], [%[ptr]]" \ - : [old0] "+r" (old0), [old1] "+r" (old1) \ - : [new0] "r" (new0), [new1] "r" (new1), \ - [ptr] "r" (ptr) \ - : "memory"); \ - _val.u64[0] = old0; \ - _val.u64[1] = old1; \ - val = _val; \ -}) - -#define ATOMIC_CAS_OP_128_NO_ORDER(atom, old_value, new_value, val) \ - ATOMIC_CAS_OP_128(atom, "casp", old_value, new_value, val) - -#define ATOMIC_CAS_OP_128_ACQ(atom, old_value, new_value, val) \ - ATOMIC_CAS_OP_128(atom, "caspa", old_value, new_value, val) - -#define ATOMIC_CAS_OP_128_REL(atom, old_value, new_value, val) \ - ATOMIC_CAS_OP_128(atom, "caspl", old_value, new_value, val) - -#define ATOMIC_CAS_OP_128_ACQ_REL(atom, old_value, new_value, val) \ - ATOMIC_CAS_OP_128(atom, "caspal", old_value, new_value, val) - -#endif - #endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_ATOMIC_H */ |