1 /* Test generic __atomic routines for proper function calling.
3 /* { dg-options "-w" } */
6 /* Test that the generioc atomic builtins execute as expected..
7 sync-mem-generic-aux.c supplies a functional external entry point for
8 the 4 generic functions. */
19 test_struct zero = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
20 test_struct ones = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
23 int size = sizeof (test_struct);
24 /* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */
29 __atomic_store (&a, &zero, __ATOMIC_RELAXED);
30 if (memcmp (&a, &zero, size))
33 __atomic_exchange (&a, &ones, &c, __ATOMIC_SEQ_CST);
34 if (memcmp (&c, &zero, size))
36 if (memcmp (&a, &ones, size))
39 __atomic_load (&a, &b, __ATOMIC_RELAXED);
40 if (memcmp (&b, &ones, size))
43 if (!__atomic_compare_exchange (&a, &b, &zero, false, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE))
45 if (memcmp (&a, &zero, size))
48 if (__atomic_compare_exchange (&a, &b, &ones, false, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE))
50 if (memcmp (&b, &zero, size))