1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck -check-prefixes CHECK,OMP51 %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck -check-prefixes CHECK,OMP51 %s
5 // RUN: %clang_cc1 -verify -fopenmp-version=52 -fopenmp -ast-print %s | FileCheck -check-prefixes CHECK,OMP52 %s
6 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck -check-prefixes CHECK,OMP52 %s
9 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck -check-prefixes CHECK,OMP51 %s
10 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
11 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck -check-prefixes CHECK,OMP51 %s
12 // expected-no-diagnostics
19 template <class T
, int N
>
21 T b
= argc
, c
, d
, e
, f
, g
;
23 #pragma omp for ordered
24 for (int i
=0 ; i
< argc
; ++i
)
29 #pragma omp for ordered
30 for (int i
=0 ; i
< argc
; ++i
)
31 #pragma omp ordered threads
36 for (int i
=0 ; i
< argc
; ++i
)
37 #pragma omp ordered simd
42 for (int i
=0 ; i
< argc
; ++i
)
43 #pragma omp ordered simd
47 #pragma omp parallel for simd
48 for (int i
=0 ; i
< argc
; ++i
)
49 #pragma omp ordered simd
53 #pragma omp parallel for ordered(1)
54 for (int i
=0 ; i
< argc
; ++i
) {
56 #pragma omp ordered doacross(source:)
57 #pragma omp ordered doacross(sink:i+N)
58 #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
59 #pragma omp ordered doacross(source: omp_cur_iteration)
61 #pragma omp ordered depend(source)
62 #pragma omp ordered depend(sink:i+N)
70 // CHECK-NEXT: #pragma omp for ordered
71 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
72 // CHECK-NEXT: #pragma omp ordered{{$}}
76 // CHECK-NEXT: #pragma omp for ordered
77 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
78 // CHECK-NEXT: #pragma omp ordered threads
82 // CHECK-NEXT: #pragma omp simd
83 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
84 // CHECK-NEXT: #pragma omp ordered simd
88 // CHECK-NEXT: #pragma omp for simd
89 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
90 // CHECK-NEXT: #pragma omp ordered simd
94 // CHECK-NEXT: #pragma omp parallel for simd
95 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
96 // CHECK-NEXT: #pragma omp ordered simd
100 // CHECK-NEXT: #pragma omp parallel for ordered(1)
101 // CHECK-NEXT: for (int i = 0; i < argc; ++i) {
102 #if _OPENMP >= 202111
103 // OMP52: #pragma omp ordered doacross(source:)
104 // OMP52-NEXT: #pragma omp ordered doacross(sink: i + N)
105 // OMP52-NEXT: #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
106 // OMP52-NEXT: #pragma omp ordered doacross(source: omp_cur_iteration)
108 // OMP51: #pragma omp ordered depend(source)
109 // OMP51-NEXT: #pragma omp ordered depend(sink : i + N)
111 // CHECK-NEXT: a = 2;
113 // CHECK: static int a;
114 // CHECK-NEXT: #pragma omp for ordered
115 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
116 // CHECK-NEXT: #pragma omp ordered
118 // CHECK-NEXT: a = 2;
120 // CHECK-NEXT: #pragma omp for ordered
121 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
122 // CHECK-NEXT: #pragma omp ordered threads
124 // CHECK-NEXT: a = 2;
126 // CHECK-NEXT: #pragma omp simd
127 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
128 // CHECK-NEXT: #pragma omp ordered simd
130 // CHECK-NEXT: a = 2;
132 // CHECK-NEXT: #pragma omp for simd
133 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
134 // CHECK-NEXT: #pragma omp ordered simd
136 // CHECK-NEXT: a = 2;
138 // CHECK-NEXT: #pragma omp parallel for simd
139 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
140 // CHECK-NEXT: #pragma omp ordered simd
142 // CHECK-NEXT: a = 2;
144 // CHECK-NEXT: #pragma omp parallel for ordered(1)
145 // CHECK-NEXT: for (int i = 0; i < argc; ++i) {
146 #if _OPENMP >= 202111
147 // OMP52: #pragma omp ordered doacross(source:)
148 // OMP52-NEXT: #pragma omp ordered doacross(sink: i + 3)
149 // OMP52-NEXT: #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
150 // OMP52-NEXT: #pragma omp ordered doacross(source: omp_cur_iteration)
152 // OMP51: #pragma omp ordered depend(source)
153 // OMP51-NEXT: #pragma omp ordered depend(sink : i + 3)
155 // CHECK-NEXT: a = 2;
158 // CHECK-LABEL: int main(
159 int main (int argc
, char **argv
) {
160 int b
= argc
, c
, d
, e
, f
, g
;
162 // CHECK: static int a;
163 #pragma omp for ordered
164 for (int i
=0 ; i
< argc
; ++i
)
169 #pragma omp for ordered
170 for (int i
=0 ; i
< argc
; ++i
)
171 #pragma omp ordered threads
176 for (int i
=0 ; i
< argc
; ++i
)
177 #pragma omp ordered simd
182 for (int i
=0 ; i
< argc
; ++i
)
183 #pragma omp ordered simd
187 #pragma omp parallel for simd
188 for (int i
=0 ; i
< argc
; ++i
)
189 #pragma omp ordered simd
193 #pragma omp parallel for ordered(1)
194 for (int i
=0 ; i
< argc
; ++i
) {
195 #if _OPENMP >= 202111
196 #pragma omp ordered doacross(source:)
197 #pragma omp ordered doacross(sink: i - 5)
198 #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
199 #pragma omp ordered doacross(source: omp_cur_iteration)
201 #pragma omp ordered depend(source)
202 #pragma omp ordered depend(sink: i - 5)
206 // CHECK-NEXT: #pragma omp for ordered
207 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
208 // CHECK-NEXT: #pragma omp ordered
210 // CHECK-NEXT: a = 2;
212 // CHECK-NEXT: #pragma omp for ordered
213 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
214 // CHECK-NEXT: #pragma omp ordered threads
216 // CHECK-NEXT: a = 2;
218 // CHECK-NEXT: #pragma omp simd
219 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
220 // CHECK-NEXT: #pragma omp ordered simd
222 // CHECK-NEXT: a = 2;
224 // CHECK-NEXT: #pragma omp for simd
225 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
226 // CHECK-NEXT: #pragma omp ordered simd
228 // CHECK-NEXT: a = 2;
230 // CHECK-NEXT: #pragma omp parallel for simd
231 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
232 // CHECK-NEXT: #pragma omp ordered simd
234 // CHECK-NEXT: a = 2;
236 // CHECK-NEXT: #pragma omp parallel for ordered(1)
237 // CHECK-NEXT: for (int i = 0; i < argc; ++i) {
238 #if _OPENMP >= 202111
239 // OMP52: #pragma omp ordered doacross(source:)
240 // OMP52-NEXT: #pragma omp ordered doacross(sink: i - 5)
241 // OMP52-NEXT: #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
242 // OMP52-NEXT: #pragma omp ordered doacross(source: omp_cur_iteration)
244 // OMP51: #pragma omp ordered depend(source)
245 // OMP51-NEXT: #pragma omp ordered depend(sink : i - 5)
247 // CHECK-NEXT: a = 2;
249 return tmain
<int, 3>(argc
);