1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
9 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s | FileCheck %s
10 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s
11 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
13 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
14 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
15 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
17 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
18 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
19 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
21 // expected-no-diagnostics
26 template <typename T
, int C
>
27 T
tmain(T argc
, T
*argv
) {
28 T i
, j
, b
, c
, d
, e
, x
[20];
31 #pragma omp target exit data map(from: i)
33 #pragma omp target exit data map(from: i) if (target exit data: j > 0)
35 #pragma omp target exit data map(from: i) if (b)
37 #pragma omp target exit data map(from: c)
39 #pragma omp target exit data map(from: c) if(b>e)
41 #pragma omp target exit data map(release: x[0:10], c)
43 #pragma omp target exit data map(delete: x[0:10])
45 #pragma omp target exit data map(always, delete: x[0:10])
47 #pragma omp target exit data map(from: c) map(release: d)
49 #pragma omp target exit data map(always,release: e)
51 #pragma omp target exit data nowait map(from: i)
53 #pragma omp target exit data nowait map(from: i) if (target exit data: j > 0)
55 #pragma omp target exit data map(from: i) if (b) nowait
57 #pragma omp target exit data map(from: c) nowait
59 #pragma omp target exit data map(from: c) nowait if(b>e)
61 #pragma omp target exit data nowait map(release: x[0:10], c)
63 #pragma omp target exit data nowait map(from: c) map(release: d)
65 #pragma omp target exit data nowait map(always,release: e)
67 #pragma omp target exit data depend(in : argc, argv[i:argc], x[:]) nowait map(from: i)
69 #pragma omp target exit data nowait depend(in : argc, argv[i:argc], x[:]) map(from: i) if (target exit data: j > 0)
71 #pragma omp target exit data map(from: i) depend(in : argc, argv[i:argc], x[:]) if (b) nowait
73 #pragma omp target exit data map(from: c) depend(in : argc, argv[i:argc], x[:]) nowait
75 #pragma omp target exit data map(from: c) depend(in : argc, argv[i:argc], x[:]) nowait if(b>e)
77 #pragma omp target exit data nowait map(release: x[0:10], c) depend(in : argc, argv[i:argc], x[:])
79 #pragma omp target exit data nowait map(from: c) depend(in : argc, argv[i:argc], x[:]) map(release: d)
81 #pragma omp target exit data depend(in : argc, argv[i:argc], x[:]) nowait map(always,release: e)
86 // CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
87 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
88 // CHECK-NEXT: i = argc;
89 // CHECK-NEXT: #pragma omp target exit data map(from: i){{$}}
90 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0)
91 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
92 // CHECK-NEXT: #pragma omp target exit data map(from: c)
93 // CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
94 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
95 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
96 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
97 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
98 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
99 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
100 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
101 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
102 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
103 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
104 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
105 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
106 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
107 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
108 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
109 // CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
110 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
111 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
112 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
113 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
114 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e)
115 // CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
116 // CHECK-NEXT: int i, j, b, c, d, e, x[20];
117 // CHECK-NEXT: i = argc;
118 // CHECK-NEXT: #pragma omp target exit data map(from: i)
119 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0)
120 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
121 // CHECK-NEXT: #pragma omp target exit data map(from: c)
122 // CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
123 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
124 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
125 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
126 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
127 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
128 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
129 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
130 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
131 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
132 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
133 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
134 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
135 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
136 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
137 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
138 // CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
139 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
140 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
141 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
142 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
143 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e)
144 // CHECK: template<> char tmain<char, 1>(char argc, char *argv) {
145 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
146 // CHECK-NEXT: i = argc;
147 // CHECK-NEXT: #pragma omp target exit data map(from: i)
148 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0)
149 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
150 // CHECK-NEXT: #pragma omp target exit data map(from: c)
151 // CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
152 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
153 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
154 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
155 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
156 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
157 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
158 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
159 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
160 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
161 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
162 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
163 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
164 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
165 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
166 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
167 // CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
168 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
169 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
170 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
171 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
172 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e)
174 int main (int argc
, char **argv
) {
175 int b
= argc
, i
, c
, d
, e
, f
, g
, x
[20];
177 // CHECK: static int a;
179 #pragma omp target exit data map(from: a)
180 // CHECK: #pragma omp target exit data map(from: a)
182 // CHECK-NEXT: a = 2;
183 #pragma omp target exit data map(from: a) if (target exit data: b)
184 // CHECK: #pragma omp target exit data map(from: a) if(target exit data: b)
186 #pragma omp target exit data map(from: a) if (b > g)
187 // CHECK: #pragma omp target exit data map(from: a) if(b > g)
189 #pragma omp target exit data map(from: c)
190 // CHECK-NEXT: #pragma omp target exit data map(from: c)
192 #pragma omp target exit data map(release: c) if(b>g)
193 // CHECK-NEXT: #pragma omp target exit data map(release: c) if(b > g)
195 #pragma omp target exit data map(from: x[0:10], c)
196 // CHECK-NEXT: #pragma omp target exit data map(from: x[0:10],c)
198 #pragma omp target exit data map(delete: x[0:10])
199 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
201 #pragma omp target exit data map(always, delete: x[0:10])
202 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
204 #pragma omp target exit data map(from: c) map(release: d)
205 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
207 #pragma omp target exit data map(always,release: e)
208 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
210 #pragma omp target exit data nowait map(from: a)
211 // CHECK: #pragma omp target exit data nowait map(from: a)
213 #pragma omp target exit data nowait map(from: a) if (target exit data: b)
214 // CHECK: #pragma omp target exit data nowait map(from: a) if(target exit data: b)
216 #pragma omp target exit data map(from: a) if (b > g) nowait
217 // CHECK: #pragma omp target exit data map(from: a) if(b > g) nowait
219 #pragma omp target exit data map(from: c) nowait
220 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
222 #pragma omp target exit data map(release: c) nowait if(b>g)
223 // CHECK-NEXT: #pragma omp target exit data map(release: c) nowait if(b > g)
225 #pragma omp target exit data nowait map(from: x[0:10], c)
226 // CHECK-NEXT: #pragma omp target exit data nowait map(from: x[0:10],c)
228 #pragma omp target exit data nowait map(from: c) map(release: d)
229 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
231 #pragma omp target exit data nowait map(always,release: e)
232 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
234 #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: a)
235 // CHECK: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: a)
237 #pragma omp target exit data nowait map(from: a) depend(in : argc,argv[i:argc],x[:]) if (target exit data: b)
238 // CHECK: #pragma omp target exit data nowait map(from: a) depend(in : argc,argv[i:argc],x[:]) if(target exit data: b)
240 #pragma omp target exit data map(from: a) if (b > g) nowait depend(in : argc,argv[i:argc],x[:])
241 // CHECK: #pragma omp target exit data map(from: a) if(b > g) nowait depend(in : argc,argv[i:argc],x[:])
243 #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
244 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
246 #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) map(release: c) nowait if(b>g)
247 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) map(release: c) nowait if(b > g)
249 #pragma omp target exit data nowait map(from: x[0:10], c) depend(in : argc,argv[i:argc],x[:])
250 // CHECK-NEXT: #pragma omp target exit data nowait map(from: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
252 #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
253 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
255 #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(always,release: e)
256 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(always,release: e)
258 return tmain
<int, 5>(argc
, &argc
) + tmain
<char, 1>(argv
[0][0], argv
[0]);