| 1 | /* |
| 2 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
| 3 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
| 4 | * |
| 5 | * Permission is hereby granted to use or copy this program |
| 6 | * for any purpose, provided the above notices are retained on all copies. |
| 7 | * Permission to modify the code and to distribute modified code is granted, |
| 8 | * provided the above notices are retained, and a notice that the code was |
| 9 | * modified is included with the above copyright notice. |
| 10 | */ |
| 11 | |
| 12 | #if (AO_GNUC_PREREQ(4, 8) || AO_CLANG_PREREQ(3, 4)) \ |
| 13 | && !defined(AO_DISABLE_GCC_ATOMICS) |
| 14 | |
| 15 | # include "generic.h" |
| 16 | |
| 17 | #else /* AO_DISABLE_GCC_ATOMICS */ |
| 18 | |
| 19 | /* Minimal support for tile. */ |
| 20 | |
| 21 | # include "../all_atomic_load_store.h" |
| 22 | |
| 23 | # include "../test_and_set_t_is_ao_t.h" |
| 24 | |
| 25 | AO_INLINE void |
| 26 | AO_nop_full(void) |
| 27 | { |
| 28 | __sync_synchronize(); |
| 29 | } |
| 30 | # define AO_HAVE_nop_full |
| 31 | |
| 32 | AO_INLINE AO_t |
| 33 | AO_fetch_and_add_full(volatile AO_t *p, AO_t incr) |
| 34 | { |
| 35 | return __sync_fetch_and_add(p, incr); |
| 36 | } |
| 37 | # define AO_HAVE_fetch_and_add_full |
| 38 | |
| 39 | AO_INLINE AO_t |
| 40 | AO_fetch_compare_and_swap_full(volatile AO_t *addr, AO_t old_val, |
| 41 | AO_t new_val) |
| 42 | { |
| 43 | return __sync_val_compare_and_swap(addr, old_val, new_val |
| 44 | /* empty protection list */); |
| 45 | } |
| 46 | # define AO_HAVE_fetch_compare_and_swap_full |
| 47 | |
| 48 | #endif /* AO_DISABLE_GCC_ATOMICS */ |
| 49 | |