[libc][test] Adjust header paths in tests (#119623)
[llvm-project.git] / clang / test / OpenMP / masked_taskloop_simd_ast_print.cpp
blobe35cc7bb7b7d1fc691be968260adc949eb979e06
1 // RUN: %clang_cc1 -verify -fopenmp -DOMP5 -ast-print %s | FileCheck %s --check-prefix CHECK --check-prefix OMP50
2 // RUN: %clang_cc1 -fopenmp -DOMP5 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -DOMP5 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s --check-prefix CHECK --check-prefix OMP50
4 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s -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 -verify %s -ast-print -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
8 // RUN: %clang_cc1 -verify -fopenmp-simd -DOMP5 -ast-print %s | FileCheck %s --check-prefix CHECK --check-prefix OMP50
9 // RUN: %clang_cc1 -fopenmp-simd -DOMP5 -x c++ -std=c++11 -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp-simd -DOMP5 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s --check-prefix CHECK --check-prefix OMP50
11 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
12 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
13 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
14 // expected-no-diagnostics
16 #ifndef HEADER
17 #define HEADER
19 void foo() {}
21 template <class T, int N>
22 T tmain(T argc) {
23 T b = argc, c, d, e, f, g;
24 T *ptr;
25 static T a;
26 // CHECK: static T a;
27 #pragma omp taskgroup task_reduction(+: d) allocate(d)
28 #pragma omp masked taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g) in_reduction(+: d)
29 // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) allocate(d)
30 // CHECK-NEXT: #pragma omp masked taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+: g) in_reduction(+: d){{$}}
31 for (int i = 0; i < 2; ++i)
32 a = 2;
33 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
34 // CHECK-NEXT: a = 2;
35 #pragma omp parallel
36 #pragma omp masked taskloop simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) shared(g) if (c) final(d) mergeable priority(f) simdlen(N) nogroup num_tasks(N)
37 for (int i = 0; i < 2; ++i)
38 for (int j = 0; j < 2; ++j)
39 for (int j = 0; j < 2; ++j)
40 for (int j = 0; j < 2; ++j)
41 for (int j = 0; j < 2; ++j)
42 for (int i = 0; i < 2; ++i)
43 for (int j = 0; j < 2; ++j)
44 for (int j = 0; j < 2; ++j)
45 for (int j = 0; j < 2; ++j)
46 for (int j = 0; j < 2; ++j)
47 foo();
48 // CHECK-NEXT: #pragma omp parallel
49 // CHECK-NEXT: #pragma omp masked taskloop simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) shared(g) if(c) final(d) mergeable priority(f) simdlen(N) nogroup num_tasks(N)
50 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
51 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
52 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
53 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
54 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
55 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
56 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
57 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
58 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
59 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
60 // CHECK-NEXT: foo();
61 return T();
64 // CHECK-LABEL: int main(int argc, char **argv) {
65 int main(int argc, char **argv) {
66 int b = argc, c, d, e, f, g, h;
67 int tid = 0;
68 static int a;
69 // CHECK: static int a;
70 #pragma omp taskgroup task_reduction(+: d)
71 #pragma omp masked taskloop simd if(taskloop: a) default(none) shared(a) final(b) priority(5) safelen(8) linear(b), aligned(argv) num_tasks(argc) reduction(*: g) in_reduction(+: d) filter(tid)
72 // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
73 // CHECK-NEXT: #pragma omp masked taskloop simd if(taskloop: a) default(none) shared(a) final(b) priority(5) safelen(8) linear(b) aligned(argv) num_tasks(argc) reduction(*: g) in_reduction(+: d) filter(tid)
74 for (int i = 0; i < 2; ++i)
75 a = 2;
76 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
77 // CHECK-NEXT: a = 2;
78 #pragma omp parallel
79 #ifdef OMP5
80 #pragma omp masked taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e) nontemporal(argc, c, d) order(concurrent) filter(tid)
81 #else
82 #pragma omp masked taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e)
83 #endif // OMP5
84 for (int i = 0; i < 10; ++i)
85 for (int j = 0; j < 10; ++j)
86 foo();
87 // CHECK-NEXT: #pragma omp parallel
88 // OMP50-NEXT: #pragma omp masked taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e) nontemporal(argc,c,d) order(concurrent) filter(tid)
89 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
90 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
91 // CHECK-NEXT: foo();
92 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
95 #endif