1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s -Wno-openmp-mapping | FileCheck %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 -Wno-openmp-mapping | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s -Wno-openmp-mapping | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s
8 // expected-no-diagnostics
29 S7(typename
T::type v
) : a(v
) {
32 #pragma omp distribute private(a) private(this->a) private(T::a) allocate(a)
33 for (int k
= 0; k
< a
.a
; ++k
)
36 S7
&operator=(S7
&s
) {
39 #pragma omp distribute allocate(a) private(a) private(this->a)
40 for (int k
= 0; k
< s
.a
.a
; ++k
)
46 // CHECK: #pragma omp target
47 // CHECK-NEXT: #pragma omp teams
48 // CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(T::a) allocate(this->a)
49 // CHECK: #pragma omp target
50 // CHECK-NEXT: #pragma omp teams
51 // CHECK-NEXT: #pragma omp distribute allocate(this->a) private(this->a) private(this->a)
52 // CHECK: #pragma omp target
53 // CHECK-NEXT: #pragma omp teams
54 // CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S::a) allocate(this->a)
56 class S8
: public S7
<S
> {
63 #pragma omp distribute private(a) private(this->a) private(S7<S>::a)
64 for (int k
= 0; k
< a
.a
; ++k
)
67 S8
&operator=(S8
&s
) {
70 #pragma omp distribute private(a) private(this->a)
71 for (int k
= 0; k
< s
.a
.a
; ++k
)
77 // CHECK: #pragma omp target
78 // CHECK-NEXT: #pragma omp teams
79 // CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S7<S>::a)
80 // CHECK: #pragma omp target
81 // CHECK-NEXT: #pragma omp teams
82 // CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a)
84 template <class T
, int N
>
86 T b
= argc
, c
, d
, e
, f
, g
;
89 #pragma omp distribute
90 // CHECK-NEXT: #pragma omp distribute{{$}}
91 for (int i
=0; i
< 2; ++i
)a
=2;
92 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
96 #pragma omp distribute private(argc, b), firstprivate(c, d), collapse(2)
97 for (int i
= 0; i
< 10; ++i
)
98 for (int j
= 0; j
< 10; ++j
)foo();
99 // CHECK-NEXT: #pragma omp target
100 // CHECK-NEXT: #pragma omp teams
101 // CHECK-NEXT: #pragma omp distribute private(argc,b) firstprivate(c,d) collapse(2)
102 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
103 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
104 // CHECK-NEXT: foo();
105 for (int i
= 0; i
< 10; ++i
)foo();
106 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
107 // CHECK-NEXT: foo();
108 #pragma omp distribute
109 // CHECK: #pragma omp distribute
110 for (int i
= 0; i
< 10; ++i
)foo();
111 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
112 // CHECK-NEXT: foo();
116 int main (int argc
, char **argv
) {
117 int b
= argc
, c
, d
, e
, f
, g
;
119 // CHECK: static int a;
120 #pragma omp distribute
121 // CHECK-NEXT: #pragma omp distribute
122 for (int i
=0; i
< 2; ++i
)a
=2;
123 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
124 // CHECK-NEXT: a = 2;
127 #pragma omp distribute private(argc,b),firstprivate(argv, c), collapse(2)
128 for (int i
= 0; i
< 10; ++i
)
129 for (int j
= 0; j
< 10; ++j
)foo();
130 // CHECK-NEXT: #pragma omp target
131 // CHECK-NEXT: #pragma omp teams
132 // CHECK-NEXT: #pragma omp distribute private(argc,b) firstprivate(argv,c) collapse(2)
133 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
134 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
135 // CHECK-NEXT: foo();
136 for (int i
= 0; i
< 10; ++i
)foo();
137 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
138 // CHECK-NEXT: foo();
139 #pragma omp distribute
140 // CHECK: #pragma omp distribute
141 for (int i
= 0; i
< 10; ++i
)foo();
142 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
143 // CHECK-NEXT: foo();