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 typedef void **omp_allocator_handle_t
;
19 extern const omp_allocator_handle_t omp_null_allocator
;
20 extern const omp_allocator_handle_t omp_default_mem_alloc
;
21 extern const omp_allocator_handle_t omp_large_cap_mem_alloc
;
22 extern const omp_allocator_handle_t omp_const_mem_alloc
;
23 extern const omp_allocator_handle_t omp_high_bw_mem_alloc
;
24 extern const omp_allocator_handle_t omp_low_lat_mem_alloc
;
25 extern const omp_allocator_handle_t omp_cgroup_mem_alloc
;
26 extern const omp_allocator_handle_t omp_pteam_mem_alloc
;
27 extern const omp_allocator_handle_t omp_thread_mem_alloc
;
29 //CHECK: template <typename T, int C> void templ_foo(T t) {
31 //CHECK: #pragma omp parallel loop collapse(C) reduction(+: z) lastprivate(j) bind(thread)
32 //CHECK: for (T i = 0; i < t; ++i)
33 //CHECK: for (j = 0; j < t; ++j)
37 //CHECK: template<> void templ_foo<int, 2>(int t) {
39 //CHECK: #pragma omp parallel loop collapse(2) reduction(+: z) lastprivate(j) bind(thread)
40 //CHECK: for (int i = 0; i < t; ++i)
41 //CHECK: for (j = 0; j < t; ++j)
44 template <typename T
, int C
>
48 #pragma omp parallel loop collapse(C) reduction(+:z) lastprivate(j) bind(thread)
49 for (T i
= 0; i
<t
; ++i
)
55 //CHECK: void test() {
57 constexpr int N
= 100;
61 //CHECK: #pragma omp target teams distribute parallel for map(tofrom: MTX)
62 //CHECK: #pragma omp parallel loop
63 #pragma omp target teams distribute parallel for map(MTX)
64 for (auto i
= 0; i
< N
; ++i
) {
65 #pragma omp parallel loop
66 for (auto j
= 0; j
< N
; ++j
) {
71 //CHECK: #pragma omp target teams
72 //CHECK: #pragma omp parallel loop
73 #pragma omp target teams
74 for (int i
=0; i
<1000; ++i
) {
75 #pragma omp parallel loop
76 for (int j
=0; j
<100; j
++) {
81 int j
, z
, z1
, z2
= 1, z3
= 2;
82 //CHECK: #pragma omp parallel loop collapse(2) private(z) lastprivate(j) order(concurrent) firstprivate(z2) num_threads(4) if(1) allocate(omp_default_mem_alloc: z2) shared(z3) reduction(+: z1) bind(parallel) proc_bind(primary)
83 #pragma omp parallel loop collapse(2) private(z) lastprivate(j) \
84 order(concurrent) firstprivate(z2) num_threads(4) if(1) \
85 allocate(omp_default_mem_alloc:z2) shared(z3) \
86 reduction(+:z1) bind(parallel) proc_bind(primary)
87 for (auto i
= 0; i
< N
; ++i
) {
88 for (j
= 0; j
< N
; ++j
) {
95 //CHECK: #pragma omp target teams
96 //CHECK: #pragma omp parallel loop bind(teams)
97 #pragma omp target teams
98 #pragma omp parallel loop bind(teams)
99 for (auto i
= 0; i
< N
; ++i
) { }
101 //CHECK: #pragma omp target
102 //CHECK: #pragma omp teams
103 //CHECK: #pragma omp parallel loop bind(teams)
106 #pragma omp parallel loop bind(teams)
107 for (auto i
= 0; i
< N
; ++i
) { }
110 //CHECK: void nobindingfunc() {
113 //CHECK: #pragma omp parallel loop
114 #pragma omp parallel loop
115 for (int i
=0; i
<10; ++i
) { }