1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
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 -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
4 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
5 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
6 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
7 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
8 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
9 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
10 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
11 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52
12 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
14 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
15 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
16 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
17 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
18 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
19 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
20 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
21 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
22 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
23 // expected-no-diagnostics
24 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
25 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52
26 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
27 // expected-no-diagnostics
46 S7(typename
T::type v
) : a(v
) {
49 #pragma omp distribute simd private(a) private(this->a) private(T::a) allocate(T::a)
50 for (int k
= 0; k
< a
.a
; ++k
)
53 S7
&operator=(S7
&s
) {
56 #pragma omp distribute simd allocate(a) private(a) private(this->a)
57 for (int k
= 0; k
< s
.a
.a
; ++k
)
63 // CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a) allocate(T::a){{$}}
64 // CHECK: #pragma omp distribute simd allocate(this->a) private(this->a) private(this->a)
65 // CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) allocate(this->S::a)
67 class S8
: public S7
<S
> {
74 #pragma omp distribute simd private(a) private(this->a) private(S7<S>::a)
75 for (int k
= 0; k
< a
.a
; ++k
)
78 S8
&operator=(S8
&s
) {
81 #pragma omp distribute simd private(a) private(this->a)
82 for (int k
= 0; k
< s
.a
.a
; ++k
)
88 // CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S7<S>::a)
89 // CHECK: #pragma omp distribute simd private(this->a) private(this->a)
91 template <class T
, int N
>
93 T b
= argc
, c
, d
, e
, f
, h
;
97 #pragma omp threadprivate(g)
101 #pragma omp distribute simd dist_schedule(static, a) firstprivate(a)
102 for (int i
= 0; i
< 2; ++i
)
104 // CHECK: #pragma omp distribute simd dist_schedule(static, a) firstprivate(a)
105 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
106 // CHECK-NEXT: a = 2;
110 #pragma omp distribute simd private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) reduction(+ : h) dist_schedule(static,N)
111 for (int i
= 0; i
< 2; ++i
)
112 for (int j
= 0; j
< 2; ++j
)
113 for (int k
= 0; k
< 10; ++k
)
114 for (int m
= 0; m
< 10; ++m
)
115 for (int n
= 0; n
< 10; ++n
)
117 // CHECK: #pragma omp distribute simd private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) reduction(+: h) dist_schedule(static, N)
118 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
119 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
120 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
121 // CHECK-NEXT: for (int m = 0; m < 10; ++m)
122 // CHECK-NEXT: for (int n = 0; n < 10; ++n)
127 int main(int argc
, char **argv
) {
128 int b
= argc
, c
, d
, e
, f
, h
;
131 // CHECK: static int a;
133 #pragma omp threadprivate(g)
137 #pragma omp distribute simd dist_schedule(static, a) private(a)
138 for (int i
= 0; i
< 2; ++i
)
140 // CHECK: #pragma omp distribute simd dist_schedule(static, a) private(a)
141 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
142 // CHECK-NEXT: a = 2;
147 #pragma omp distribute simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) reduction(+ : h) dist_schedule(static, b) if(simd:argc)
149 #pragma omp distribute simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) reduction(+ : h) dist_schedule(static, b)
151 for (int i
= 0; i
< 10; ++i
)
152 for (int j
= 0; j
< 10; ++j
)
154 // OMP45: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b)
155 // OMP50: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b) if(simd: argc)
156 // OMP51: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b)
157 // OMP52: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b)
158 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
159 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
166 #pragma omp distribute simd aligned(x:8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(reproducible:concurrent)
168 #pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(reproducible:concurrent)
170 #pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(concurrent)
172 #pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8)
174 for (i
= 0; i
< 100; i
++)
175 for (int j
= 0; j
< 200; j
++)
177 // OMP45: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8)
178 // OMP50: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(concurrent)
179 // OMP51: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(reproducible: concurrent)
180 // OMP52: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(reproducible: concurrent)
181 // CHECK-NEXT: for (i = 0; i < 100; i++)
182 // CHECK-NEXT: for (int j = 0; j < 200; j++)
183 // CHECK-NEXT: a += h + x[j];
185 return (tmain
<int, 5>(argc
) + tmain
<char, 1>(argv
[0][0]));