1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | 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 -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | 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 -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
17 operator T() {return T();}
19 #pragma omp threadprivate(TS)
22 // CHECK: template <class T> struct S {
23 // CHECK: static T TS;
24 // CHECK-NEXT: #pragma omp threadprivate(S::TS)
26 // CHECK: template<> struct S<int> {
27 // CHECK: static int TS;
28 // CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
31 template <typename T
, int C
>
32 T
tmain(T argc
, T
*argv
) {
33 T b
= argc
, c
, d
, e
, f
, g
;
42 #pragma omp teams default(none), private(argc,b) firstprivate(argv) shared (d) reduction(+:c) reduction(max:e) num_teams(C) thread_limit(d*C)
45 #pragma omp teams reduction(^:e, f) reduction(&& : g)
50 // CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
51 // CHECK-NEXT: T b = argc, c, d, e, f, g;
52 // CHECK-NEXT: static T a;
53 // CHECK-NEXT: S<T> s;
54 // CHECK-NEXT: #pragma omp teams
56 // CHECK-NEXT: #pragma omp target
57 // CHECK-NEXT: #pragma omp teams{{$}}
59 // CHECK-NEXT: #pragma omp target
60 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C)
62 // CHECK-NEXT: #pragma omp target
63 // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
65 // CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
66 // CHECK-NEXT: int b = argc, c, d, e, f, g;
67 // CHECK-NEXT: static int a;
68 // CHECK-NEXT: S<int> s;
69 // CHECK-NEXT: #pragma omp teams
71 // CHECK-NEXT: #pragma omp target
72 // CHECK-NEXT: #pragma omp teams
74 // CHECK-NEXT: #pragma omp target
75 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(5) thread_limit(d * 5)
77 // CHECK-NEXT: #pragma omp target
78 // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
80 // CHECK: template<> long tmain<long, 1>(long argc, long *argv) {
81 // CHECK-NEXT: long b = argc, c, d, e, f, g;
82 // CHECK-NEXT: static long a;
83 // CHECK-NEXT: S<long> s;
84 // CHECK-NEXT: #pragma omp teams
86 // CHECK-NEXT: #pragma omp target
87 // CHECK-NEXT: #pragma omp teams
89 // CHECK-NEXT: #pragma omp target
90 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(1) thread_limit(d * 1)
92 // CHECK-NEXT: #pragma omp target
93 // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
98 int main (int argc
, char **argv
) {
100 int b
= argc
, c
, d
, e
, f
, g
;
102 #pragma omp threadprivate(a)
107 // CHECK-NEXT: #pragma omp target
108 // CHECK-NEXT: #pragma omp teams
110 // CHECK-NEXT: a = 2;
112 #pragma omp teams default(none), private(argc,b) num_teams(f) firstprivate(argv) reduction(| : c, d) reduction(* : e) thread_limit(f+g)
113 // CHECK-NEXT: #pragma omp target
114 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) num_teams(f) firstprivate(argv) reduction(|: c,d) reduction(*: e) thread_limit(f + g)
116 // CHECK-NEXT: foo();
117 return tmain
<int, 5>(b
, &b
) + tmain
<long, 1>(x
, &x
);
120 extern template int S
<int>::TS
;
121 extern template long S
<long>::TS
;