[libc][docgen] simplify posix links (#119595)
[llvm-project.git] / clang / test / OpenMP / target_map_codegen_19.cpp
blob1d6c781a0990540ea31057e7e9842da7f22634e4
1 // expected-no-diagnostics
2 #ifndef HEADER
3 #define HEADER
5 ///==========================================================================///
6 // RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
7 // RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
8 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
9 // RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
10 // RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
11 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
13 // RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
14 // RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
15 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
16 // RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
17 // RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
18 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
20 // RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
21 // RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
22 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
23 // RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
24 // RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
25 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
27 // RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
28 // RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
29 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
30 // RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
31 // RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
32 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
33 // SIMD-ONLY19-NOT: {{__kmpc|__tgt}}
34 #ifdef CK20
36 // CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
37 // CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4]
38 // CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
40 // CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
41 // CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 20]
42 // CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
44 // CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
45 // CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 4]
46 // CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
48 // CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
49 // CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 12]
50 // CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
52 // CK20-LABEL: explicit_maps_references_and_function_args{{.*}}(
53 void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
55 int &aa = a;
56 float &bb = b;
57 int (&cc)[10] = c;
58 float *&dd = d;
60 // Region 00
61 // CK20-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
62 // CK20-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
63 // CK20-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
64 // CK20-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
65 // CK20-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
66 // CK20-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
67 // CK20-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
69 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
70 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
71 // CK20-DAG: store ptr [[RVAR0:%.+]], ptr [[BP0]]
72 // CK20-DAG: store ptr [[RVAR00:%.+]], ptr [[P0]]
73 // CK20-DAG: [[RVAR0]] = load ptr, ptr [[VAR0:%[^,]+]]
74 // CK20-DAG: [[RVAR00]] = load ptr, ptr [[VAR0]]
76 // CK20: call void [[CALL00:@.+]](ptr {{[^,]+}})
77 #pragma omp target map(to \
78 : aa)
80 aa += 1;
83 // Region 01
84 // CK20-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
85 // CK20-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
86 // CK20-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
87 // CK20-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
88 // CK20-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
89 // CK20-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
90 // CK20-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
92 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
93 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
94 // CK20-DAG: store ptr [[RVAR0:%.+]], ptr [[BP0]]
95 // CK20-DAG: store ptr [[SEC0:%.+]], ptr [[P0]]
96 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}ptr [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
97 // CK20-DAG: [[RVAR0]] = load ptr, ptr [[VAR0:%[^,]+]]
98 // CK20-DAG: [[RVAR00]] = load ptr, ptr [[VAR0]]
100 // CK20: call void [[CALL01:@.+]](ptr {{[^,]+}})
101 #pragma omp target map(to \
102 : cc[:5])
104 cc[3] += 1;
107 // Region 02
108 // CK20-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
109 // CK20-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
110 // CK20-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
111 // CK20-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
112 // CK20-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
113 // CK20-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
114 // CK20-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
116 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
117 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
118 // CK20-DAG: store ptr [[VAR0:%.+]], ptr [[BP0]]
119 // CK20-DAG: store ptr [[VAR0]], ptr [[P0]]
121 // CK20: call void [[CALL02:@.+]](ptr {{[^,]+}})
122 #pragma omp target map(from \
123 : b)
125 b += 1.0f;
128 // Region 03
129 // CK20-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
130 // CK20-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
131 // CK20-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
132 // CK20-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
133 // CK20-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
134 // CK20-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
135 // CK20-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
137 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
138 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
139 // CK20-DAG: store ptr [[RVAR0:%.+]], ptr [[BP0]]
140 // CK20-DAG: store ptr [[SEC0:%.+]], ptr [[P0]]
141 // CK20-DAG: [[RVAR0]] = load ptr, ptr [[VAR0:%[^,]+]]
142 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}ptr [[RVAR00:%.+]], i{{.+}} 2
143 // CK20-DAG: [[RVAR00]] = load ptr, ptr [[VAR0]]
145 // CK20: call void [[CALL03:@.+]](ptr {{[^,]+}})
146 #pragma omp target map(from \
147 : d [2:3])
149 d[2] += 1.0f;
153 // CK20: define {{.+}}[[CALL00]]
154 // CK20: define {{.+}}[[CALL01]]
155 // CK20: define {{.+}}[[CALL02]]
156 // CK20: define {{.+}}[[CALL03]]
158 #endif // CK20
159 #endif