1! { dg-do compile }
2! { dg-additional-options "-fdump-tree-original" }
3
4! { dg-final { scan-tree-dump-times "#pragma omp atomic relaxed" 4 "original" } }
5! { dg-final { scan-tree-dump-times "#pragma omp atomic release" 4 "original" } }
6! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture relaxed" 4 "original" } }
7! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture release" 2 "original" } }
8! { dg-final { scan-tree-dump-times "v = #pragma omp atomic read acquire" 1 "original" } }
9
10! { dg-final { scan-tree-dump-times "#pragma omp atomic seq_cst" 7 "original" } }
11! { dg-final { scan-tree-dump-times "v = #pragma omp atomic read seq_cst" 3 "original" } }
12! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture seq_cst" 6 "original" } }
13
14subroutine foo ()
15  integer :: x, v
16  !$omp atomic
17  i = i + 2
18
19  !$omp atomic relaxed
20  i = i + 2
21
22  !$omp atomic seq_cst read
23  v = x
24  !$omp atomic seq_cst, read
25  v = x
26  !$omp atomic seq_cst write
27  x = v
28  !$omp atomic seq_cst ,write
29  x = v
30  !$omp atomic seq_cst update
31  x = x + v
32  !$omp atomic seq_cst , update
33  x = x + v
34  !$omp atomic seq_cst capture
35  x = x + 2
36  v = x
37  !$omp end atomic
38  !$omp atomic seq_cst, capture
39  x = x + 2
40  v = x
41  !$omp end atomic
42  !$omp atomic read , seq_cst
43  v = x
44  !$omp atomic write ,seq_cst
45  x = v
46  !$omp atomic update, seq_cst
47  x = x + v
48  !$omp atomic capture, seq_cst
49  x = x + 2
50  v = x
51  !$omp end atomic
52end
53
54subroutine bar
55  integer :: i, v
56  real :: f
57  !$omp atomic release, hint (0), update
58  i = i + 1
59  !$omp end atomic
60  !$omp atomic hint(0)seq_cst
61  i = i + 1
62  !$omp atomic relaxed,update,hint (0)
63  i = i + 1
64  !$omp atomic release
65  i = i + 1
66  !$omp atomic relaxed
67  i = i + 1
68  !$omp atomic relaxed capture
69  i = i + 1
70  v = i
71  !$omp end atomic
72  !$omp atomic capture,release , hint (1)
73  i = i + 1
74  v = i
75  !$omp end atomic
76  !$omp atomic hint(0),relaxed capture
77  i = i + 1
78  v = i
79  !$omp end atomic
80  !$omp atomic read acquire
81  v = i
82  !$omp atomic release,write
83  i = v
84  !$omp atomic hint(1),update,release
85  f = f + 2.0
86end
87
88subroutine openmp51_foo
89  integer :: x, v
90  !$omp atomic update seq_cst capture
91  x = x + 2
92  v = x
93  !$omp end atomic
94  !$omp atomic seq_cst, capture, update
95  x = x + 2
96  v = x
97  !$omp end atomic
98  !$omp atomic capture, seq_cst ,update
99  x = x + 2
100  v = x
101  !$omp end atomic
102end
103
104subroutine openmp51_bar
105  integer :: i, v
106  real :: f
107  !$omp atomic relaxed capture update
108  i = i + 1
109  v = i
110  !$omp end atomic
111  !$omp atomic update capture,release , hint (1)
112  i = i + 1
113  v = i
114  !$omp end atomic
115  !$omp atomic hint(0),update relaxed capture
116  i = i + 1
117  v = i
118  !$omp end atomic
119end
120