21#include "../all_aligned_atomic_load_store.h"
23#include "../test_and_set_t_is_char.h"
25#if !defined(AO_USE_PENTIUM4_INSTRS) && !defined(__i386)
27# define AO_USE_PENTIUM4_INSTRS
30#if defined(AO_USE_PENTIUM4_INSTRS)
34 __asm__ __volatile__ (
"mfence" : : :
"memory");
36# define AO_HAVE_nop_full
48#ifndef AO_PREFER_GENERALIZED
54 __asm__ __volatile__ (
"lock; xadd %0, %1"
60# define AO_HAVE_fetch_and_add_full
68 __asm__ __volatile__ (
"lock; xaddb %0, %1"
74#define AO_HAVE_char_fetch_and_add_full
81 __asm__ __volatile__ (
"lock; xaddw %0, %1"
87#define AO_HAVE_short_fetch_and_add_full
89#ifndef AO_PREFER_GENERALIZED
93 __asm__ __volatile__ (
"lock; and %1, %0"
98# define AO_HAVE_and_full
103 __asm__ __volatile__ (
"lock; or %1, %0"
108# define AO_HAVE_or_full
113 __asm__ __volatile__ (
"lock; xor %1, %0"
118# define AO_HAVE_xor_full
126 __asm__ __volatile__ (
"xchg %b0, %1"
127 :
"=q" (oldval),
"+m" (*addr)
132#define AO_HAVE_test_and_set_full
134#ifndef AO_GENERALIZE_ASM_BOOL_CAS
140 __asm__ __volatile__ (
"lock; cmpxchg %2, %0; setz %1"
141 :
"+m" (*addr),
"=a" (
result)
142 :
"r" (new_val),
"a" (old)
146# define AO_HAVE_compare_and_swap_full
154 __asm__ __volatile__ (
"lock; cmpxchg %2, %0"
155 :
"+m" (*addr),
"=a" (fetched_val)
156 :
"r" (new_val),
"a" (old_val)
160#define AO_HAVE_fetch_compare_and_swap_full
164# ifndef AO_NO_CMPXCHG8B
165# include "../standard_ao_double_t.h"
169# define AO_ACCESS_double_CHECK_ALIGNED
170# include "../loadstore/double_atomic_load_store.h"
182 __asm__ __volatile__ (
"lock; cmpxchg8b %0; setz %1"
184 :
"d" (old_val2),
"a" (old_val1),
185 "c" (new_val2),
"b" (new_val1)
189# define AO_HAVE_compare_double_and_swap_double_full
201 __asm__ __volatile__ (
"lock; xaddl %0, %1"
202 :
"=r" (
result),
"+m" (*p)
207# define AO_HAVE_int_fetch_and_add_full
209# ifdef AO_CMPXCHG16B_AVAILABLE
210# include "../standard_ao_double_t.h"
222 __asm__ __volatile__ (
"lock; cmpxchg16b %0; setz %1"
224 :
"d" (old_val2),
"a" (old_val1),
225 "c" (new_val2),
"b" (new_val1)
229# define AO_HAVE_compare_double_and_swap_double_full
240#include "../ordered_except_wr.h"
#define AO_compare_double_and_swap_double_full(addr, old1, old2, newval1, newval2)
#define AO_fetch_compare_and_swap_full(addr, old, newval)
AO_INLINE unsigned char AO_char_fetch_and_add_full(volatile unsigned char *p, unsigned char incr)
AO_INLINE unsigned int AO_int_fetch_and_add_full(volatile unsigned int *p, unsigned int incr)
AO_INLINE void AO_xor_full(volatile AO_t *p, AO_t value)
AO_INLINE void AO_or_full(volatile AO_t *p, AO_t value)
AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val)
AO_INLINE AO_t AO_fetch_and_add_full(volatile AO_t *p, AO_t incr)
AO_INLINE unsigned short AO_short_fetch_and_add_full(volatile unsigned short *p, unsigned short incr)
AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr)
AO_INLINE void AO_and_full(volatile AO_t *p, AO_t value)
AO_INLINE void AO_nop_full(void)