1 /* Test __atomic routines for existence and proper execution on 16 byte
2 values with each valid memory model. */
4 /* { dg-require-effective-target sync_int_128_runtime } */
5 /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */
7 /* Test the execution of the __atomic_X builtin for a 16 byte value. */
9 extern void abort(void);
11 __int128_t v, count, ret;
18 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++)
21 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++)
24 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++)
27 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++)
30 if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++)
33 /* Now test the generic version. */
37 __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
38 if (ret != count - 1 || v != count)
42 __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
43 if (ret != count - 1 || v != count)
47 __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
48 if (ret != count - 1 || v != count)
52 __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
53 if (ret != count - 1 || v != count)
57 __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
58 if (ret != count - 1 || v != count)