| 1 | /* |
| 2 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. |
| 3 | * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. |
| 4 | * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. |
| 5 | * |
| 6 | * |
| 7 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
| 8 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
| 9 | * |
| 10 | * Permission is hereby granted to use or copy this program |
| 11 | * for any purpose, provided the above notices are retained on all copies. |
| 12 | * Permission to modify the code and to distribute modified code is granted, |
| 13 | * provided the above notices are retained, and a notice that the code was |
| 14 | * modified is included with the above copyright notice. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #ifndef AO_NO_XSIZE_ARITHM |
| 19 | |
| 20 | AO_INLINE XCTYPE |
| 21 | AO_XSIZE_fetch_and_add_XBAR(volatile XCTYPE *addr, XCTYPE incr) |
| 22 | { |
| 23 | return __atomic_fetch_add(addr, incr, __ATOMIC_XGCCBAR); |
| 24 | } |
| 25 | #define AO_HAVE_XSIZE_fetch_and_add_XBAR |
| 26 | |
| 27 | #ifndef AO_SKIPATOMIC_ANY_and_ANY |
| 28 | AO_INLINE void |
| 29 | AO_XSIZE_and_XBAR(volatile XCTYPE *addr, XCTYPE value) |
| 30 | { |
| 31 | (void)__atomic_and_fetch(addr, value, __ATOMIC_XGCCBAR); |
| 32 | } |
| 33 | # define AO_HAVE_XSIZE_and_XBAR |
| 34 | #endif |
| 35 | |
| 36 | #ifndef AO_SKIPATOMIC_ANY_or_ANY |
| 37 | AO_INLINE void |
| 38 | AO_XSIZE_or_XBAR(volatile XCTYPE *addr, XCTYPE value) |
| 39 | { |
| 40 | (void)__atomic_or_fetch(addr, value, __ATOMIC_XGCCBAR); |
| 41 | } |
| 42 | # define AO_HAVE_XSIZE_or_XBAR |
| 43 | #endif |
| 44 | |
| 45 | #ifndef AO_SKIPATOMIC_ANY_xor_ANY |
| 46 | AO_INLINE void |
| 47 | AO_XSIZE_xor_XBAR(volatile XCTYPE *addr, XCTYPE value) |
| 48 | { |
| 49 | (void)__atomic_xor_fetch(addr, value, __ATOMIC_XGCCBAR); |
| 50 | } |
| 51 | # define AO_HAVE_XSIZE_xor_XBAR |
| 52 | #endif |
| 53 | |
| 54 | #endif /* !AO_NO_XSIZE_ARITHM */ |
| 55 | |