From: Bart Van Assche Date: Thu, 26 Jun 2008 08:34:53 +0000 (+0000) Subject: Added ppc implementation of atomic compare and swap. X-Git-Tag: svn/VALGRIND_3_4_0~432 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1af3a135df3ecd4681d78ed4e3da6fe2fc376b90;p=thirdparty%2Fvalgrind.git Added ppc implementation of atomic compare and swap. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8282 --- diff --git a/helgrind/tests/tc11_XCHG.c b/helgrind/tests/tc11_XCHG.c index 5b46c7ed80..1d9df4c281 100644 --- a/helgrind/tests/tc11_XCHG.c +++ b/helgrind/tests/tc11_XCHG.c @@ -45,6 +45,18 @@ : /*in*/ "m"(_addr) \ : "memory", "cc" \ ) +#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \ + || defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5) +# define XCHG_M_R(_addr,_lval) \ + do { \ + int tmp; \ + while ((tmp = *(int*)(& _addr)), \ + ! __sync_bool_compare_and_swap((int*)&_addr, tmp, _lval)) \ + ; \ + _lval = tmp; \ + } while (0) +# define XCHG_M_R_with_redundant_LOCK(_addr,_lval) \ + XCHG_M_R(_addr,_lval) #else # define XCHG_M_R(_addr,_lval) \ do { int tmp = *(int*)(& _addr); \