From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1QM1-0002lG-0h for qemu-devel@nongnu.org; Fri, 13 May 2016 23:35:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1QLy-0005Kd-VU for qemu-devel@nongnu.org; Fri, 13 May 2016 23:34:59 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:49570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1QLw-0005JP-MC for qemu-devel@nongnu.org; Fri, 13 May 2016 23:34:58 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A3B0220B6B for ; Fri, 13 May 2016 23:34:41 -0400 (EDT) From: "Emilio G. Cota" Date: Fri, 13 May 2016 23:34:20 -0400 Message-Id: <1463196873-17737-6-git-send-email-cota@braap.org> In-Reply-To: <1463196873-17737-1-git-send-email-cota@braap.org> References: <1463196873-17737-1-git-send-email-cota@braap.org> Subject: [Qemu-devel] [PATCH v5 05/18] atomics: add atomic_test_and_set_acquire List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers , MTTCG Devel Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Sergey Fedorov This new helper expands to __atomic_test_and_set with acquire semantics where available; otherwise it expands to __sync_test_and_set, which has acquire semantics. Signed-off-by: Emilio G. Cota --- include/qemu/atomic.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 5bc4d6c..6061a46 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -113,6 +113,7 @@ } while(0) #endif +#define atomic_test_and_set_acquire(ptr) __atomic_test_and_set(ptr, __ATOMIC_ACQUIRE) /* All the remaining operations are fully sequentially consistent */ @@ -327,6 +328,8 @@ #endif #endif +#define atomic_test_and_set_acquire(ptr) __sync_lock_test_and_set(ptr, true) + /* Provide shorter names for GCC atomic builtins. */ #define atomic_fetch_inc(ptr) __sync_fetch_and_add(ptr, 1) #define atomic_fetch_dec(ptr) __sync_fetch_and_add(ptr, -1) -- 2.5.0