111
|
1 /* Test __atomic routines for existence and execution. */
|
|
2 /* { dg-do run } */
|
|
3 /* { dg-require-effective-target sync_char_short } */
|
|
4
|
|
5 /* Test that __atomic_test_and_set and __atomic_clear builtins execute. */
|
|
6
|
|
7 extern void abort(void);
|
|
8 unsigned char a;
|
|
9
|
|
10 int
|
|
11 main ()
|
|
12 {
|
|
13 int b;
|
|
14
|
|
15 __atomic_clear (&a, __ATOMIC_RELAXED);
|
|
16 if (a != 0)
|
|
17 abort ();
|
|
18
|
|
19 b = __atomic_test_and_set (&a, __ATOMIC_SEQ_CST);
|
|
20 if (a != __GCC_ATOMIC_TEST_AND_SET_TRUEVAL || b != 0)
|
|
21 abort ();
|
|
22
|
|
23 b = __atomic_test_and_set (&a, __ATOMIC_ACQ_REL);
|
|
24 if (a != __GCC_ATOMIC_TEST_AND_SET_TRUEVAL || b != 1)
|
|
25 abort ();
|
|
26
|
|
27 __atomic_clear (&a, __ATOMIC_SEQ_CST);
|
|
28 if (a != 0)
|
|
29 abort ();
|
|
30
|
|
31 return 0;
|
|
32 }
|