From 48205b221a6df0244338436825b193b8e869ef29 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 19 Aug 2016 01:05:39 +0300 Subject: [PATCH] Avoid extra nop_full in stack_pop_acquire if atomic intrinsics used (x86) * src/atomic_ops/generalize.h [AO_HAVE_double_compare_and_swap_acquire] (AO_compare_double_and_swap_double_acquire): Implement (by redirecting to AO_double_compare_and_swap_acquire). * src/atomic_ops/generalize.h [AO_HAVE_double_compare_and_swap_release] (AO_compare_double_and_swap_double_release): Implement (by redirecting to AO_double_compare_and_swap_release). --- src/atomic_ops/generalize.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/atomic_ops/generalize.h b/src/atomic_ops/generalize.h index 3e66341..317c5e7 100644 --- a/src/atomic_ops/generalize.h +++ b/src/atomic_ops/generalize.h @@ -323,6 +323,40 @@ } # define AO_HAVE_compare_double_and_swap_double # endif +# if defined(AO_HAVE_double_compare_and_swap_acquire) \ + && !defined(AO_HAVE_compare_double_and_swap_double_acquire) + AO_INLINE int + AO_compare_double_and_swap_double_acquire(volatile AO_double_t *addr, + AO_t old_val1, AO_t old_val2, + AO_t new_val1, AO_t new_val2) + { + AO_double_t old_w; + AO_double_t new_w; + old_w.AO_val1 = old_val1; + old_w.AO_val2 = old_val2; + new_w.AO_val1 = new_val1; + new_w.AO_val2 = new_val2; + return AO_double_compare_and_swap_acquire(addr, old_w, new_w); + } +# define AO_HAVE_compare_double_and_swap_double_acquire +# endif +# if defined(AO_HAVE_double_compare_and_swap_release) \ + && !defined(AO_HAVE_compare_double_and_swap_double_release) + AO_INLINE int + AO_compare_double_and_swap_double_release(volatile AO_double_t *addr, + AO_t old_val1, AO_t old_val2, + AO_t new_val1, AO_t new_val2) + { + AO_double_t old_w; + AO_double_t new_w; + old_w.AO_val1 = old_val1; + old_w.AO_val2 = old_val2; + new_w.AO_val1 = new_val1; + new_w.AO_val2 = new_val2; + return AO_double_compare_and_swap_release(addr, old_w, new_w); + } +# define AO_HAVE_compare_double_and_swap_double_release +# endif # if defined(AO_HAVE_double_compare_and_swap_full) \ && !defined(AO_HAVE_compare_double_and_swap_double_full) AO_INLINE int -- 2.40.0