29#include "../all_atomic_load_store.h"
31#include "../all_acquire_release_volatile.h"
33#include "../test_and_set_t_is_char.h"
35#include <machine/sys/inline.h>
38# define AO_T_FASIZE _FASZ_D
39# define AO_T_SIZE _SZ_D
41# define AO_T_FASIZE _FASZ_W
42# define AO_T_SIZE _SZ_W
50#define AO_HAVE_nop_full
52#ifndef AO_PREFER_GENERALIZED
57 _LDHINT_NONE, _DOWN_MEM_FENCE);
59#define AO_HAVE_fetch_and_add1_acquire
65 _LDHINT_NONE, _UP_MEM_FENCE);
67#define AO_HAVE_fetch_and_add1_release
73 _LDHINT_NONE, _DOWN_MEM_FENCE);
75#define AO_HAVE_fetch_and_sub1_acquire
81 _LDHINT_NONE, _UP_MEM_FENCE);
83#define AO_HAVE_fetch_and_sub1_release
90 _Asm_mov_to_ar(_AREG_CCV, old_val, _DOWN_MEM_FENCE);
91 return _Asm_cmpxchg(
AO_T_SIZE, _SEM_ACQ, addr,
92 new_val, _LDHINT_NONE, _DOWN_MEM_FENCE);
94#define AO_HAVE_fetch_compare_and_swap_acquire
100 _Asm_mov_to_ar(_AREG_CCV, old_val, _UP_MEM_FENCE);
101 return _Asm_cmpxchg(
AO_T_SIZE, _SEM_REL, addr,
102 new_val, _LDHINT_NONE, _UP_MEM_FENCE);
104#define AO_HAVE_fetch_compare_and_swap_release
108 unsigned char old_val,
unsigned char new_val)
110 _Asm_mov_to_ar(_AREG_CCV, old_val, _DOWN_MEM_FENCE);
111 return _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr,
112 new_val, _LDHINT_NONE, _DOWN_MEM_FENCE);
114#define AO_HAVE_char_fetch_compare_and_swap_acquire
118 unsigned char old_val,
unsigned char new_val)
120 _Asm_mov_to_ar(_AREG_CCV, old_val, _UP_MEM_FENCE);
121 return _Asm_cmpxchg(_SZ_B, _SEM_REL, addr,
122 new_val, _LDHINT_NONE, _UP_MEM_FENCE);
124#define AO_HAVE_char_fetch_compare_and_swap_release
128 unsigned short old_val,
129 unsigned short new_val)
131 _Asm_mov_to_ar(_AREG_CCV, old_val, _DOWN_MEM_FENCE);
132 return _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr,
133 new_val, _LDHINT_NONE, _DOWN_MEM_FENCE);
135#define AO_HAVE_short_fetch_compare_and_swap_acquire
139 unsigned short old_val,
140 unsigned short new_val)
142 _Asm_mov_to_ar(_AREG_CCV, old_val, _UP_MEM_FENCE);
143 return _Asm_cmpxchg(_SZ_B, _SEM_REL, addr,
144 new_val, _LDHINT_NONE, _UP_MEM_FENCE);
146#define AO_HAVE_short_fetch_compare_and_swap_release
AO_INLINE unsigned short AO_short_fetch_compare_and_swap_acquire(volatile unsigned short *addr, unsigned short old_val, unsigned short new_val)
AO_INLINE AO_t AO_fetch_compare_and_swap_release(volatile AO_t *addr, AO_t old_val, AO_t new_val)
AO_INLINE AO_t AO_fetch_and_sub1_release(volatile AO_t *p)
AO_INLINE unsigned char AO_char_fetch_compare_and_swap_release(volatile unsigned char *addr, unsigned char old_val, unsigned char new_val)
AO_INLINE AO_t AO_fetch_and_add1_acquire(volatile AO_t *p)
AO_INLINE AO_t AO_fetch_and_sub1_acquire(volatile AO_t *p)
AO_INLINE unsigned short AO_short_fetch_compare_and_swap_release(volatile unsigned short *addr, unsigned short old_val, unsigned short new_val)
AO_INLINE AO_t AO_fetch_and_add1_release(volatile AO_t *p)
AO_INLINE unsigned char AO_char_fetch_compare_and_swap_acquire(volatile unsigned char *addr, unsigned char old_val, unsigned char new_val)
AO_INLINE AO_t AO_fetch_compare_and_swap_acquire(volatile AO_t *addr, AO_t old_val, AO_t new_val)
AO_INLINE void AO_nop_full(void)