1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
2 // RUN: -fsyntax-only -verify %s
4 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
5 // RUN: -ast-print %s | FileCheck %s
7 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
8 // RUN: -emit-pch -o %t %s
10 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
11 // RUN: -include-pch %t -ast-print %s | FileCheck %s
13 // expected-no-diagnostics
18 //CHECK: template <typename T, int C> void templ_foo(T t) {
20 //CHECK: #pragma omp teams loop collapse(C) reduction(+: z) lastprivate(j) bind(thread) num_teams(C + 2)
21 //CHECK: for (T i = 0; i < t; ++i)
22 //CHECK: for (j = 0; j < t; ++j)
26 //CHECK: template<> void templ_foo<int, 2>(int t) {
28 //CHECK: #pragma omp teams loop collapse(2) reduction(+: z) lastprivate(j) bind(thread) num_teams(2 + 2)
29 //CHECK: for (int i = 0; i < t; ++i)
30 //CHECK: for (j = 0; j < t; ++j)
33 template <typename T
, int C
>
37 #pragma omp teams loop collapse(C) reduction(+:z) lastprivate(j) bind(thread) num_teams(C+2)
38 for (T i
= 0; i
<t
; ++i
)
44 //CHECK: void test() {
46 constexpr int N
= 100;
50 //CHECK: #pragma omp target map(tofrom: MTX)
51 //CHECK: #pragma omp teams loop
52 #pragma omp target map(MTX)
53 #pragma omp teams loop
54 for (auto j
= 0; j
< N
; ++j
) {
59 //CHECK: #pragma omp teams loop collapse(2) private(z) lastprivate(j) order(concurrent) reduction(+: z1) bind(parallel)
60 #pragma omp teams loop collapse(2) private(z) lastprivate(j) \
61 order(concurrent) reduction(+:z1) bind(parallel)
62 for (auto i
= 0; i
< N
; ++i
) {
63 for (j
= 0; j
< N
; ++j
) {
70 //CHECK: #pragma omp target
71 //CHECK: #pragma omp teams loop bind(teams) num_teams(16) thread_limit(8) default(none)
73 #pragma omp teams loop bind(teams) num_teams(16) thread_limit(8) default(none)
74 for (auto i
= 0; i
< N
; ++i
) { }
80 //CHECK: #pragma omp target
81 //CHECK: #pragma omp teams loop bind(teams) private(pr) firstprivate(fpr) shared(s) allocate(k) reduction(+: k)
83 #pragma omp teams loop bind(teams) private(pr) firstprivate(fpr) \
84 shared(s) allocate(k) reduction(+:k)
85 for (auto i
= 0; i
< N
; ++i
) {
90 //CHECK: void nobindingfunc() {
93 //CHECK: #pragma omp teams loop
94 #pragma omp teams loop
95 for (int i
=0; i
<10; ++i
) { }