PAPI 7.1.0.0
Loading...
Searching...
No Matches
gcc/x86.h File Reference
Include dependency graph for gcc/x86.h:

Go to the source code of this file.

Macros

#define AO_HAVE_fetch_and_add_full
 
#define AO_HAVE_char_fetch_and_add_full
 
#define AO_HAVE_short_fetch_and_add_full
 
#define AO_HAVE_and_full
 
#define AO_HAVE_or_full
 
#define AO_HAVE_xor_full
 
#define AO_HAVE_char_and_full
 
#define AO_HAVE_char_or_full
 
#define AO_HAVE_char_xor_full
 
#define AO_HAVE_short_and_full
 
#define AO_HAVE_short_or_full
 
#define AO_HAVE_short_xor_full
 
#define AO_HAVE_test_and_set_full
 
#define AO_HAVE_compare_and_swap_full
 
#define AO_HAVE_fetch_compare_and_swap_full
 
#define AO_HAVE_char_fetch_compare_and_swap_full
 
#define AO_HAVE_short_fetch_compare_and_swap_full
 
#define AO_T_IS_INT
 

Functions

AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
 
AO_INLINE unsigned char AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr)
 
AO_INLINE unsigned short AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr)
 
AO_INLINE void AO_and_full (volatile AO_t *p, AO_t value)
 
AO_INLINE void AO_or_full (volatile AO_t *p, AO_t value)
 
AO_INLINE void AO_xor_full (volatile AO_t *p, AO_t value)
 
AO_INLINE void AO_char_and_full (volatile unsigned char *p, unsigned char value)
 
AO_INLINE void AO_char_or_full (volatile unsigned char *p, unsigned char value)
 
AO_INLINE void AO_char_xor_full (volatile unsigned char *p, unsigned char value)
 
AO_INLINE void AO_short_and_full (volatile unsigned short *p, unsigned short value)
 
AO_INLINE void AO_short_or_full (volatile unsigned short *p, unsigned short value)
 
AO_INLINE void AO_short_xor_full (volatile unsigned short *p, unsigned short value)
 
AO_INLINE AO_TS_VAL_t AO_test_and_set_full (volatile AO_TS_t *addr)
 
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_compare_and_swap_full (volatile AO_t *addr, AO_t old_val, AO_t new_val)
 
AO_INLINE unsigned char AO_char_fetch_compare_and_swap_full (volatile unsigned char *addr, unsigned char old_val, unsigned char new_val)
 
AO_INLINE unsigned short AO_short_fetch_compare_and_swap_full (volatile unsigned short *addr, unsigned short old_val, unsigned short new_val)
 

Macro Definition Documentation

◆ AO_HAVE_and_full

#define AO_HAVE_and_full

Definition at line 172 of file gcc/x86.h.

◆ AO_HAVE_char_and_full

#define AO_HAVE_char_and_full

Definition at line 206 of file gcc/x86.h.

◆ AO_HAVE_char_fetch_and_add_full

#define AO_HAVE_char_fetch_and_add_full

Definition at line 148 of file gcc/x86.h.

◆ AO_HAVE_char_fetch_compare_and_swap_full

#define AO_HAVE_char_fetch_compare_and_swap_full

Definition at line 340 of file gcc/x86.h.

◆ AO_HAVE_char_or_full

#define AO_HAVE_char_or_full

Definition at line 216 of file gcc/x86.h.

◆ AO_HAVE_char_xor_full

#define AO_HAVE_char_xor_full

Definition at line 226 of file gcc/x86.h.

◆ AO_HAVE_compare_and_swap_full

#define AO_HAVE_compare_and_swap_full

Definition at line 301 of file gcc/x86.h.

◆ AO_HAVE_fetch_and_add_full

#define AO_HAVE_fetch_and_add_full

Definition at line 134 of file gcc/x86.h.

◆ AO_HAVE_fetch_compare_and_swap_full

#define AO_HAVE_fetch_compare_and_swap_full

Definition at line 320 of file gcc/x86.h.

◆ AO_HAVE_or_full

#define AO_HAVE_or_full

Definition at line 182 of file gcc/x86.h.

◆ AO_HAVE_short_and_full

#define AO_HAVE_short_and_full

Definition at line 236 of file gcc/x86.h.

◆ AO_HAVE_short_fetch_and_add_full

#define AO_HAVE_short_fetch_and_add_full

Definition at line 161 of file gcc/x86.h.

◆ AO_HAVE_short_fetch_compare_and_swap_full

#define AO_HAVE_short_fetch_compare_and_swap_full

Definition at line 360 of file gcc/x86.h.

◆ AO_HAVE_short_or_full

#define AO_HAVE_short_or_full

Definition at line 246 of file gcc/x86.h.

◆ AO_HAVE_short_xor_full

#define AO_HAVE_short_xor_full

Definition at line 256 of file gcc/x86.h.

◆ AO_HAVE_test_and_set_full

#define AO_HAVE_test_and_set_full

Definition at line 270 of file gcc/x86.h.

◆ AO_HAVE_xor_full

#define AO_HAVE_xor_full

Definition at line 192 of file gcc/x86.h.

◆ AO_T_IS_INT

#define AO_T_IS_INT

Definition at line 429 of file gcc/x86.h.

Function Documentation

◆ AO_and_full()

AO_INLINE void AO_and_full ( volatile AO_t p,
AO_t  value 
)

Definition at line 165 of file gcc/x86.h.

166 {
167 __asm__ __volatile__ ("lock; and %1, %0"
168 : "+m" (*p)
169 : "r" (value)
170 : "memory");
171 }

◆ AO_char_and_full()

AO_INLINE void AO_char_and_full ( volatile unsigned char *  p,
unsigned char  value 
)

Definition at line 199 of file gcc/x86.h.

200{
201 __asm__ __volatile__ ("lock; andb %1, %0"
202 : "+m" (*p)
203 : "r" (value)
204 : "memory");
205}

◆ AO_char_fetch_and_add_full()

AO_INLINE unsigned char AO_char_fetch_and_add_full ( volatile unsigned char *  p,
unsigned char  incr 
)

Definition at line 138 of file gcc/x86.h.

139{
140 unsigned char result;
141
142 __asm__ __volatile__ ("lock; xaddb %0, %1"
143 : "=q" (result), "+m" (*p)
144 : "0" (incr)
145 : "memory");
146 return result;
147}
volatile int result

◆ AO_char_fetch_compare_and_swap_full()

AO_INLINE unsigned char AO_char_fetch_compare_and_swap_full ( volatile unsigned char *  addr,
unsigned char  old_val,
unsigned char  new_val 
)

Definition at line 323 of file gcc/x86.h.

326 {
327# ifdef AO_USE_SYNC_CAS_BUILTIN
328 return __sync_val_compare_and_swap(addr, old_val, new_val
329 /* empty protection list */);
330# else
331 unsigned char fetched_val;
332
333 __asm__ __volatile__ ("lock; cmpxchgb %3, %1"
334 : "=a" (fetched_val), "+m" (*addr)
335 : "a" (old_val), "q" (new_val)
336 : "memory");
337 return fetched_val;
338# endif
339 }

◆ AO_char_or_full()

AO_INLINE void AO_char_or_full ( volatile unsigned char *  p,
unsigned char  value 
)

Definition at line 209 of file gcc/x86.h.

210{
211 __asm__ __volatile__ ("lock; orb %1, %0"
212 : "+m" (*p)
213 : "r" (value)
214 : "memory");
215}

◆ AO_char_xor_full()

AO_INLINE void AO_char_xor_full ( volatile unsigned char *  p,
unsigned char  value 
)

Definition at line 219 of file gcc/x86.h.

220{
221 __asm__ __volatile__ ("lock; xorb %1, %0"
222 : "+m" (*p)
223 : "r" (value)
224 : "memory");
225}

◆ AO_compare_and_swap_full()

AO_INLINE int AO_compare_and_swap_full ( volatile AO_t addr,
AO_t  old,
AO_t  new_val 
)

Definition at line 275 of file gcc/x86.h.

276 {
277# ifdef AO_USE_SYNC_CAS_BUILTIN
278 return (int)__sync_bool_compare_and_swap(addr, old, new_val
279 /* empty protection list */);
280 /* Note: an empty list of variables protected by the */
281 /* memory barrier should mean all globally accessible */
282 /* variables are protected. */
283# else
284 char result;
285# if defined(__GCC_ASM_FLAG_OUTPUTS__)
286 AO_t dummy;
287
288 __asm__ __volatile__ ("lock; cmpxchg %3, %0"
289 : "+m" (*addr), "=@ccz" (result), "=a" (dummy)
290 : "r" (new_val), "a" (old)
291 : "memory");
292# else
293 __asm__ __volatile__ ("lock; cmpxchg %2, %0; setz %1"
294 : "+m" (*addr), "=a" (result)
295 : "r" (new_val), "a" (old)
296 : "memory");
297# endif
298 return (int)result;
299# endif
300 }
#define AO_t
Definition: atomic_ops.h:156
void dummy(void *array)
Definition: do_loops.c:306
Here is the call graph for this function:

◆ AO_fetch_and_add_full()

AO_INLINE AO_t AO_fetch_and_add_full ( volatile AO_t p,
AO_t  incr 
)

Definition at line 124 of file gcc/x86.h.

125 {
126 AO_t result;
127
128 __asm__ __volatile__ ("lock; xadd %0, %1"
129 : "=r" (result), "+m" (*p)
130 : "0" (incr)
131 : "memory");
132 return result;
133 }

◆ AO_fetch_compare_and_swap_full()

AO_INLINE AO_t AO_fetch_compare_and_swap_full ( volatile AO_t addr,
AO_t  old_val,
AO_t  new_val 
)

Definition at line 305 of file gcc/x86.h.

307{
308# ifdef AO_USE_SYNC_CAS_BUILTIN
309 return __sync_val_compare_and_swap(addr, old_val, new_val
310 /* empty protection list */);
311# else
312 AO_t fetched_val;
313 __asm__ __volatile__ ("lock; cmpxchg %3, %1"
314 : "=a" (fetched_val), "+m" (*addr)
315 : "a" (old_val), "r" (new_val)
316 : "memory");
317 return fetched_val;
318# endif
319}

◆ AO_or_full()

AO_INLINE void AO_or_full ( volatile AO_t p,
AO_t  value 
)

Definition at line 175 of file gcc/x86.h.

176 {
177 __asm__ __volatile__ ("lock; or %1, %0"
178 : "+m" (*p)
179 : "r" (value)
180 : "memory");
181 }

◆ AO_short_and_full()

AO_INLINE void AO_short_and_full ( volatile unsigned short *  p,
unsigned short  value 
)

Definition at line 229 of file gcc/x86.h.

230{
231 __asm__ __volatile__ ("lock; andw %1, %0"
232 : "+m" (*p)
233 : "r" (value)
234 : "memory");
235}

◆ AO_short_fetch_and_add_full()

AO_INLINE unsigned short AO_short_fetch_and_add_full ( volatile unsigned short *  p,
unsigned short  incr 
)

Definition at line 151 of file gcc/x86.h.

152{
153 unsigned short result;
154
155 __asm__ __volatile__ ("lock; xaddw %0, %1"
156 : "=r" (result), "+m" (*p)
157 : "0" (incr)
158 : "memory");
159 return result;
160}

◆ AO_short_fetch_compare_and_swap_full()

AO_INLINE unsigned short AO_short_fetch_compare_and_swap_full ( volatile unsigned short *  addr,
unsigned short  old_val,
unsigned short  new_val 
)

Definition at line 343 of file gcc/x86.h.

346 {
347# ifdef AO_USE_SYNC_CAS_BUILTIN
348 return __sync_val_compare_and_swap(addr, old_val, new_val
349 /* empty protection list */);
350# else
351 unsigned short fetched_val;
352
353 __asm__ __volatile__ ("lock; cmpxchgw %3, %1"
354 : "=a" (fetched_val), "+m" (*addr)
355 : "a" (old_val), "r" (new_val)
356 : "memory");
357 return fetched_val;
358# endif
359 }

◆ AO_short_or_full()

AO_INLINE void AO_short_or_full ( volatile unsigned short *  p,
unsigned short  value 
)

Definition at line 239 of file gcc/x86.h.

240{
241 __asm__ __volatile__ ("lock; orw %1, %0"
242 : "+m" (*p)
243 : "r" (value)
244 : "memory");
245}

◆ AO_short_xor_full()

AO_INLINE void AO_short_xor_full ( volatile unsigned short *  p,
unsigned short  value 
)

Definition at line 249 of file gcc/x86.h.

250{
251 __asm__ __volatile__ ("lock; xorw %1, %0"
252 : "+m" (*p)
253 : "r" (value)
254 : "memory");
255}

◆ AO_test_and_set_full()

AO_INLINE AO_TS_VAL_t AO_test_and_set_full ( volatile AO_TS_t addr)

Definition at line 260 of file gcc/x86.h.

261{
262 unsigned char oldval;
263 /* Note: the "xchg" instruction does not need a "lock" prefix */
264 __asm__ __volatile__ ("xchgb %0, %1"
265 : "=q" (oldval), "+m" (*addr)
266 : "0" ((unsigned char)0xff)
267 : "memory");
268 return (AO_TS_VAL_t)oldval;
269}
#define AO_TS_VAL_t
Definition: gcc/hppa.h:44

◆ AO_xor_full()

AO_INLINE void AO_xor_full ( volatile AO_t p,
AO_t  value 
)

Definition at line 185 of file gcc/x86.h.

186 {
187 __asm__ __volatile__ ("lock; xor %1, %0"
188 : "+m" (*p)
189 : "r" (value)
190 : "memory");
191 }