summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/atomic-fence.c
blob: ab5c7d62c9c8315d8081e1fe37157a10581e21c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Test __atomic routines for existence and execution with each valid 
   memory model.  */
/* { dg-do run } */
/* { dg-require-effective-target sync_char_short } */


/* Test that __atomic_{thread,signal}_fence builtins execute.  */

int
main ()
{
  __atomic_thread_fence (__ATOMIC_RELAXED);
  __atomic_thread_fence (__ATOMIC_CONSUME);
  __atomic_thread_fence (__ATOMIC_ACQUIRE);
  __atomic_thread_fence (__ATOMIC_RELEASE);
  __atomic_thread_fence (__ATOMIC_ACQ_REL);
  __atomic_thread_fence (__ATOMIC_SEQ_CST);

  __atomic_signal_fence (__ATOMIC_RELAXED);
  __atomic_signal_fence (__ATOMIC_CONSUME);
  __atomic_signal_fence (__ATOMIC_ACQUIRE);
  __atomic_signal_fence (__ATOMIC_RELEASE);
  __atomic_signal_fence (__ATOMIC_ACQ_REL);
  __atomic_signal_fence (__ATOMIC_SEQ_CST);

  return 0;
}