| 1 |
#include "libgomp.h" |
| 2 |
|
| 3 |
#include "../../atomic.c" |
| 4 |
|
| 5 |
/* Implement __sync_val_compare_and_swap_16, to support offloading from hosts |
| 6 |
that support this builtin. Fallback on libatomic. This can be removed |
| 7 |
once omp-expand starts using __atomic_compare_exchange_n instead. */ |
| 8 |
|
| 9 |
unsigned __int128 |
| 10 |
__sync_val_compare_and_swap_16 (volatile void *vptr, unsigned __int128 oldval, |
| 11 |
unsigned __int128 newval) |
| 12 |
{ |
| 13 |
volatile __int128 *ptr = vptr; |
| 14 |
__int128 expected = oldval; |
| 15 |
__atomic_compare_exchange_n (ptr, &expected, newval, false, |
| 16 |
MEMMODEL_SEQ_CST, MEMMODEL_SEQ_CST); |
| 17 |
return expected; |
| 18 |
} |