diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/atomic-generic-aux.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/atomic-generic-aux.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/testsuite/gcc.dg/atomic-generic-aux.c b/gcc/testsuite/gcc.dg/atomic-generic-aux.c index a6b552a5dfd..2f4cb2a88f7 100644 --- a/gcc/testsuite/gcc.dg/atomic-generic-aux.c +++ b/gcc/testsuite/gcc.dg/atomic-generic-aux.c @@ -19,17 +19,30 @@ __atomic_exchange (size_t size, void *obj, void *val, void *ret, int model) } +/* Note that the external version of this routine has the boolean weak/strong + parameter removed. This is required by teh external library. */ bool -__atomic_compare_exchange (size_t size, void *obj, void *expected, +__atomic_compare_exchange (size_t size, void *obj, void *expected, void *desired, int model1, int model2) { + bool ret; if (!memcmp (obj, expected, size)) { memcpy (obj, desired, size); - return true; + ret = true; } - memcpy (expected, obj, size); - return false; + else + { + memcpy (expected, obj, size); + ret = false; + } + + /* Make sure the parameters have been properly adjusted for the external + function call (no weak/strong parameter. */ + if (model1 != __ATOMIC_SEQ_CST || model2 != __ATOMIC_ACQUIRE) + ret = !ret; + + return ret; } |