diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2013-02-03 12:29:25 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2013-02-03 12:29:25 +0400 |
commit | 76e589081ea588b9c830cf125b1efdcd796583eb (patch) | |
tree | 9317c797eb2e1e4beeed8e78c2e4cb78546496a1 | |
parent | 4c7df2c778c8bf1e13ae2f1456425eb99c75d866 (diff) | |
download | libatomic_ops-add-dbl-load-store.tar.gz |
Add generalized fetch_and_add_acquire/release (for ARMv6+)add-dbl-load-store
* src/atomic_ops/generalize-arithm.template
(AO_XSIZE_fetch_and_add_acquire, AO_XSIZE_fetch_and_add_release):
Add generalized template primitives based on AO_XSIZE_fetch_and_add.
* src/atomic_ops/generalize-arithm.h: Regenerate.
-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) \ |