diff options
-rw-r--r-- | src/atomic_ops/generalize-arithm.h | 72 | ||||
-rw-r--r-- | src/atomic_ops/generalize-arithm.template | 18 |
2 files changed, 90 insertions, 0 deletions
diff --git a/src/atomic_ops/generalize-arithm.h b/src/atomic_ops/generalize-arithm.h index 2607d6e..e03395a 100644 --- a/src/atomic_ops/generalize-arithm.h +++ b/src/atomic_ops/generalize-arithm.h @@ -226,6 +226,24 @@ # endif #endif /* AO_HAVE_char_fetch_and_add_full */ +#if defined(AO_HAVE_char_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_char_fetch_and_add_acquire) + AO_INLINE unsigned/**/char + AO_char_fetch_and_add_acquire(volatile unsigned/**/char *addr, unsigned/**/char incr) + { + unsigned/**/char result = AO_char_fetch_and_add(addr, incr); + AO_nop_full(); + return result; + } +# define AO_HAVE_char_fetch_and_add_acquire +#endif +#if defined(AO_HAVE_char_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_char_fetch_and_add_release) +# define AO_char_fetch_and_add_release(addr, incr) \ + (AO_nop_full(), AO_char_fetch_and_add(addr, incr)) +# define AO_HAVE_char_fetch_and_add_release +#endif + #if !defined(AO_HAVE_char_fetch_and_add) \ && defined(AO_HAVE_char_fetch_and_add_release) # define AO_char_fetch_and_add(addr, val) \ @@ -1053,6 +1071,24 @@ # endif #endif /* AO_HAVE_short_fetch_and_add_full */ +#if defined(AO_HAVE_short_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_short_fetch_and_add_acquire) + AO_INLINE unsigned/**/short + AO_short_fetch_and_add_acquire(volatile unsigned/**/short *addr, unsigned/**/short incr) + { + unsigned/**/short result = AO_short_fetch_and_add(addr, incr); + AO_nop_full(); + return result; + } +# define AO_HAVE_short_fetch_and_add_acquire +#endif +#if defined(AO_HAVE_short_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_short_fetch_and_add_release) +# define AO_short_fetch_and_add_release(addr, incr) \ + (AO_nop_full(), AO_short_fetch_and_add(addr, incr)) +# define AO_HAVE_short_fetch_and_add_release +#endif + #if !defined(AO_HAVE_short_fetch_and_add) \ && defined(AO_HAVE_short_fetch_and_add_release) # define AO_short_fetch_and_add(addr, val) \ @@ -1880,6 +1916,24 @@ # endif #endif /* AO_HAVE_int_fetch_and_add_full */ +#if defined(AO_HAVE_int_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_int_fetch_and_add_acquire) + AO_INLINE unsigned + AO_int_fetch_and_add_acquire(volatile unsigned *addr, unsigned incr) + { + unsigned result = AO_int_fetch_and_add(addr, incr); + AO_nop_full(); + return result; + } +# define AO_HAVE_int_fetch_and_add_acquire +#endif +#if defined(AO_HAVE_int_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_int_fetch_and_add_release) +# define AO_int_fetch_and_add_release(addr, incr) \ + (AO_nop_full(), AO_int_fetch_and_add(addr, incr)) +# define AO_HAVE_int_fetch_and_add_release +#endif + #if !defined(AO_HAVE_int_fetch_and_add) \ && defined(AO_HAVE_int_fetch_and_add_release) # define AO_int_fetch_and_add(addr, val) \ @@ -2707,6 +2761,24 @@ # endif #endif /* AO_HAVE_fetch_and_add_full */ +#if defined(AO_HAVE_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_fetch_and_add_acquire) + AO_INLINE AO_t + AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr) + { + AO_t result = AO_fetch_and_add(addr, incr); + AO_nop_full(); + return result; + } +# define AO_HAVE_fetch_and_add_acquire +#endif +#if defined(AO_HAVE_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_fetch_and_add_release) +# define AO_fetch_and_add_release(addr, incr) \ + (AO_nop_full(), AO_fetch_and_add(addr, incr)) +# define AO_HAVE_fetch_and_add_release +#endif + #if !defined(AO_HAVE_fetch_and_add) \ && defined(AO_HAVE_fetch_and_add_release) # define AO_fetch_and_add(addr, val) \ diff --git a/src/atomic_ops/generalize-arithm.template b/src/atomic_ops/generalize-arithm.template index 3696782..8b21912 100644 --- a/src/atomic_ops/generalize-arithm.template +++ b/src/atomic_ops/generalize-arithm.template @@ -226,6 +226,24 @@ # endif #endif /* AO_HAVE_XSIZE_fetch_and_add_full */ +#if defined(AO_HAVE_XSIZE_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) + AO_INLINE XCTYPE + AO_XSIZE_fetch_and_add_acquire(volatile XCTYPE *addr, XCTYPE incr) + { + XCTYPE result = AO_XSIZE_fetch_and_add(addr, incr); + AO_nop_full(); + return result; + } +# define AO_HAVE_XSIZE_fetch_and_add_acquire +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add_release) +# define AO_XSIZE_fetch_and_add_release(addr, incr) \ + (AO_nop_full(), AO_XSIZE_fetch_and_add(addr, incr)) +# define AO_HAVE_XSIZE_fetch_and_add_release +#endif + #if !defined(AO_HAVE_XSIZE_fetch_and_add) \ && defined(AO_HAVE_XSIZE_fetch_and_add_release) # define AO_XSIZE_fetch_and_add(addr, val) \ |