atomic128.h (95a9457fd44ad97c518858a4e1586a5498f9773c) atomic128.h (d73415a315471ac0b127ed3fad45c8ec5d711de1)
1/*
2 * Simple interface for 128-bit atomic operations.
3 *
4 * Copyright (C) 2018 Linaro, Ltd.
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 *

--- 30 unchanged lines hidden (view full) ---

39 * way to connect those two actions.
40 *
41 * Therefore, special case each platform.
42 */
43
44#if defined(CONFIG_ATOMIC128)
45static inline Int128 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new)
46{
1/*
2 * Simple interface for 128-bit atomic operations.
3 *
4 * Copyright (C) 2018 Linaro, Ltd.
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 *

--- 30 unchanged lines hidden (view full) ---

39 * way to connect those two actions.
40 *
41 * Therefore, special case each platform.
42 */
43
44#if defined(CONFIG_ATOMIC128)
45static inline Int128 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new)
46{
47 return atomic_cmpxchg__nocheck(ptr, cmp, new);
47 return qatomic_cmpxchg__nocheck(ptr, cmp, new);
48}
49# define HAVE_CMPXCHG128 1
50#elif defined(CONFIG_CMPXCHG128)
51static inline Int128 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new)
52{
53 return __sync_val_compare_and_swap_16(ptr, cmp, new);
54}
55# define HAVE_CMPXCHG128 1

--- 28 unchanged lines hidden (view full) ---

84 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new);
85# define HAVE_CMPXCHG128 0
86#endif /* Some definition for HAVE_CMPXCHG128 */
87
88
89#if defined(CONFIG_ATOMIC128)
90static inline Int128 atomic16_read(Int128 *ptr)
91{
48}
49# define HAVE_CMPXCHG128 1
50#elif defined(CONFIG_CMPXCHG128)
51static inline Int128 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new)
52{
53 return __sync_val_compare_and_swap_16(ptr, cmp, new);
54}
55# define HAVE_CMPXCHG128 1

--- 28 unchanged lines hidden (view full) ---

84 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new);
85# define HAVE_CMPXCHG128 0
86#endif /* Some definition for HAVE_CMPXCHG128 */
87
88
89#if defined(CONFIG_ATOMIC128)
90static inline Int128 atomic16_read(Int128 *ptr)
91{
92 return atomic_read__nocheck(ptr);
92 return qatomic_read__nocheck(ptr);
93}
94
95static inline void atomic16_set(Int128 *ptr, Int128 val)
96{
93}
94
95static inline void atomic16_set(Int128 *ptr, Int128 val)
96{
97 atomic_set__nocheck(ptr, val);
97 qatomic_set__nocheck(ptr, val);
98}
99
100# define HAVE_ATOMIC128 1
101#elif !defined(CONFIG_USER_ONLY) && defined(__aarch64__)
102/* We can do better than cmpxchg for AArch64. */
103static inline Int128 atomic16_read(Int128 *ptr)
104{
105 uint64_t l, h;

--- 50 unchanged lines hidden ---
98}
99
100# define HAVE_ATOMIC128 1
101#elif !defined(CONFIG_USER_ONLY) && defined(__aarch64__)
102/* We can do better than cmpxchg for AArch64. */
103static inline Int128 atomic16_read(Int128 *ptr)
104{
105 uint64_t l, h;

--- 50 unchanged lines hidden ---