Go to the documentation of this file.
18 #ifndef _ASM_TILE_CMPXCHG_H
19 #define _ASM_TILE_CMPXCHG_H
27 #define xchg(ptr, x) \
30 switch (sizeof(*(ptr))) { \
32 __x = (typeof(__x))(typeof(__x-__x))atomic_xchg( \
34 (u32)(typeof((x)-(x)))(x)); \
37 __x = (typeof(__x))(typeof(__x-__x))atomic64_xchg( \
38 (atomic64_t *)(ptr), \
39 (u64)(typeof((x)-(x)))(x)); \
42 __xchg_called_with_bad_pointer(); \
47 #define cmpxchg(ptr, o, n) \
50 switch (sizeof(*(ptr))) { \
52 __x = (typeof(__x))(typeof(__x-__x))atomic_cmpxchg( \
54 (u32)(typeof((o)-(o)))(o), \
55 (u32)(typeof((n)-(n)))(n)); \
58 __x = (typeof(__x))(typeof(__x-__x))atomic64_cmpxchg( \
59 (atomic64_t *)(ptr), \
60 (u64)(typeof((o)-(o)))(o), \
61 (u64)(typeof((n)-(n)))(n)); \
64 __cmpxchg_called_with_bad_pointer(); \
69 #define tas(ptr) (xchg((ptr), 1))