1 /* Test __atomic routines for existence and proper execution on 8 byte
2 values with each valid memory model. */
4 /* { dg-require-effective-target sync_long_long_runtime } */
5 /* { dg-options "" } */
6 /* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
8 /* Test the execution of the __atomic_X builtin for a long_long. */
10 extern void abort(void);
12 long long v, count, ret;
19 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++)
22 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++)
25 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++)
28 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++)
31 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++)
34 /* Now test the generic version. */
38 __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
39 if (ret != count - 1 || v != count)
43 __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
44 if (ret != count - 1 || v != count)
48 __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
49 if (ret != count - 1 || v != count)
53 __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
54 if (ret != count - 1 || v != count)
58 __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
59 if (ret != count - 1 || v != count)