Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / declare_mapper_ast_print.c
blobe6a0546fe5c98a12971ba87730a71923fa2b7d75
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
9 // RUN: %clang_cc1 -DOMP51 -verify -fopenmp -ast-print %s | FileCheck -check-prefixes=CHECK,OMP51 %s
10 // RUN: %clang_cc1 -DOMP51 -fopenmp -emit-pch -o %t %s
11 // RUN: %clang_cc1 -DOMP51 -fopenmp -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck -check-prefixes=CHECK,OMP51 %s
13 // RUN: %clang_cc1 -DOMP51 -verify -fopenmp-simd -ast-print %s | FileCheck -check-prefixes=CHECK,OMP51 %s
14 // RUN: %clang_cc1 -DOMP51 -fopenmp-simd -emit-pch -o %t %s
15 // RUN: %clang_cc1 -DOMP51 -fopenmp-simd -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck -check-prefixes=CHECK,OMP51 %s
17 // RUN: %clang_cc1 -DOMP52 -verify -fopenmp -fopenmp-version=52 -ast-print %s | FileCheck -check-prefixes=CHECK,OMP52 %s
18 // RUN: %clang_cc1 -DOMP52 -fopenmp -fopenmp-version=52 -emit-pch -o %t %s
19 // RUN: %clang_cc1 -DOMP52 -fopenmp -fopenmp-version=52 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck -check-prefixes=CHECK,OMP52 %s
21 // RUN: %clang_cc1 -DOMP52 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s | FileCheck -check-prefixes=CHECK,OMP52 %s
22 // RUN: %clang_cc1 -DOMP52 -fopenmp-simd -fopenmp-version=52 -emit-pch -o %t %s
23 // RUN: %clang_cc1 -DOMP52 -fopenmp-simd -fopenmp-version=52 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck -check-prefixes=CHECK,OMP52 %s
24 // expected-no-diagnostics
26 #ifndef HEADER
27 #define HEADER
29 // CHECK: struct vec {
30 struct vec {
31 int len;
32 double *data;
34 // CHECK: };
36 // CHECK: struct dat {
37 struct dat {
38 int i;
39 double d;
40 #pragma omp declare mapper(id: struct vec v) map(v.len)
41 // CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len){{$}}
43 // CHECK: };
45 #pragma omp declare mapper(id: struct vec v) map(v.len)
46 // CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len){{$}}
47 #pragma omp declare mapper(default : struct vec kk) map(kk.len) map(kk.data[0:2])
48 // CHECK: #pragma omp declare mapper (default : struct vec kk) map(tofrom: kk.len) map(tofrom: kk.data[0:2]){{$}}
49 #pragma omp declare mapper(struct dat d) map(to: d.d)
50 // CHECK: #pragma omp declare mapper (default : struct dat d) map(to: d.d){{$}}
52 // CHECK: int main(void) {
53 int main(void) {
54 #pragma omp declare mapper(id: struct vec v) map(v.len)
55 // CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len)
57 #pragma omp declare mapper(id: struct vec v) map(v.len)
58 // CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len)
59 struct vec vv;
60 struct dat dd[10];
61 #pragma omp target map(mapper(id), alloc: vv)
62 // CHECK: #pragma omp target map(mapper(id),alloc: vv)
63 { vv.len++; }
64 #pragma omp target map(mapper(default), from: dd[0:10])
65 // CHECK: #pragma omp target map(mapper(default),from: dd[0:10])
66 { dd[0].i++; }
67 #pragma omp target update to(mapper(id): vv) from(mapper(default): dd[0:10])
68 // CHECK: #pragma omp target update to(mapper(id): vv) from(mapper(default): dd[0:10])
69 #ifdef OMP51
70 #pragma omp target update to(mapper(id) present: vv) from(mapper(default), present: dd[0:10])
71 // OMP51: #pragma omp target update to(mapper(id), present: vv) from(mapper(default), present: dd[0:10])
72 #pragma omp target update to(present mapper(id): vv) from(present, mapper(default): dd[0:10])
73 // OMP51: #pragma omp target update to(present, mapper(id): vv) from(present, mapper(default): dd[0:10])
74 #endif
76 #ifdef OMP52
77 #pragma omp declare mapper(id1: struct vec vvec) map(iterator(it=0:vvec.len:2), tofrom:vvec.data[it])
78 // OMP52: #pragma omp declare mapper (id1 : struct vec vvec) map(iterator(int it = 0:vvec.len:2),tofrom: vvec.data[it]);
79 #endif
80 return 0;
82 // CHECK: }
84 #endif