|
From: <sv...@va...> - 2008-10-21 23:13:02
|
Author: sewardj
Date: 2008-10-22 00:12:56 +0100 (Wed, 22 Oct 2008)
New Revision: 8690
Log:
Don't simply break the build if gcc doesn't provide the require primitives on ppc.
Modified:
trunk/helgrind/tests/tc11_XCHG.c
Modified: trunk/helgrind/tests/tc11_XCHG.c
===================================================================
--- trunk/helgrind/tests/tc11_XCHG.c 2008-10-21 23:11:38 UTC (rev 8689)
+++ trunk/helgrind/tests/tc11_XCHG.c 2008-10-21 23:12:56 UTC (rev 8690)
@@ -46,30 +46,33 @@
: /*in*/ "m"(_addr) \
: "memory", "cc" \
)
+
#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
|| defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5)
-#ifdef HAVE_BUILTIN_ATOMIC
-# 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)
-#else
-#error "XCHG_M_R() implementation is missing. Either provide one or use a newer gcc version."
-#endif
+# if defined(HAVE_BUILTIN_ATOMIC)
+# 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)
+# else
+# warning "XCHG_M_R() implementation is missing. Either" \
+ "provide one or use a newer gcc version."
+# define XCHG_M_R(_addr,_lval) \
+ do { int tmp = *(int*)(& _addr); \
+ *(int*)(& _addr) = (_lval); \
+ _lval = tmp; \
+ } while (0)
+# endif
# 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); \
- *(int*)(& _addr) = (_lval); \
- _lval = tmp; \
- } while (0)
-# define XCHG_M_R_with_redundant_LOCK(_addr,_lval) \
- XCHG_M_R(_addr,_lval)
+# error "Unsupported architecture"
+
#endif
int x = 0;
|