• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // expected-no-diagnostics
2 #ifndef HEADER
3 #define HEADER
4 
5 ///==========================================================================///
6 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 CK23 --check-prefix CK23-64
7 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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 CK23 --check-prefix CK23-64
9 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 CK23 --check-prefix CK23-32
10 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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 CK23 --check-prefix CK23-32
12 
13 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 CK23 --check-prefix CK23-64
14 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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 CK23 --check-prefix CK23-64
16 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 CK23 --check-prefix CK23-32
17 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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 CK23 --check-prefix CK23-32
19 
20 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 CK23 --check-prefix CK23-64
21 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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 CK23 --check-prefix CK23-64
23 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 CK23 --check-prefix CK23-32
24 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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 CK23 --check-prefix CK23-32
26 
27 // RUN: %clang_cc1 -std=c++11 -DCK23 -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-ONLY22 %s
28 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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-ONLY22 %s
30 // RUN: %clang_cc1 -std=c++11 -DCK23 -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-ONLY22 %s
31 // RUN: %clang_cc1 -std=c++11 -DCK23 -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 -std=c++11 -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-ONLY22 %s
33 // SIMD-ONLY22-NOT: {{__kmpc|__tgt}}
34 #ifdef CK23
35 
36 // CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
37 // CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4]
38 // CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
39 
40 // CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
41 // CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 4]
42 // CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
43 
44 // CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
45 // CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 400]
46 // CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
47 
48 // CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
49 // CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}]
50 // CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
51 
52 // CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
53 // CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 16]
54 // CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
55 
56 // CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
57 // CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] [i64 16]
58 // CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
59 
60 // CK23-LABEL: explicit_maps_inside_captured{{.*}}(
explicit_maps_inside_captured(int a)61 int explicit_maps_inside_captured(int a){
62   float b;
63   float c[100];
64   float *d;
65 
66   // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}})
67   // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
68   [&](void){
69     // Region 00
70     // CK23-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null, i8** null)
71     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
72     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
73 
74     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
75     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
76     // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
77     // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
78     // CK23-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
79     // CK23-DAG: store i32* [[VAR00:%.+]], i32** [[CP0]]
80     // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
81     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
82     // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
83     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
84 
85     // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
86     #pragma omp target map(a)
87       { a+=1; }
88     // Region 01
89     // CK23-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null, i8** null)
90     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
91     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
92 
93     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
94     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
95     // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
96     // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
97     // CK23-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
98     // CK23-DAG: store float* [[VAR00:%.+]], float** [[CP0]]
99     // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
100     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
101     // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
102     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
103 
104     // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
105     #pragma omp target map(b)
106       { b+=1; }
107     // Region 02
108     // CK23-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null, i8** null)
109     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
110     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
111 
112     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
113     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
114     // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
115     // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x float]**
116     // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
117     // CK23-DAG: store [100 x float]* [[VAR00:%.+]], [100 x float]** [[CP0]]
118     // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
119     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
120     // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
121     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
122 
123     // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
124     #pragma omp target map(c)
125       { c[3]+=1; }
126 
127     // Region 03
128     // CK23-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null, i8** null)
129     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
130     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
131 
132     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
133     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
134     // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float***
135     // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
136     // CK23-DAG: store float** [[VAR0:%.+]], float*** [[CBP0]]
137     // CK23-DAG: store float** [[VAR00:%.+]], float*** [[CP0]]
138     // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
139     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
140     // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
141     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
142 
143     // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
144     #pragma omp target map(d)
145       { d[3]+=1; }
146     // Region 04
147     // CK23-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null, i8** null)
148     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
149     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
150 
151     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
152     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
153     // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
154     // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
155     // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
156     // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
157     // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
158     // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
159     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
160     // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
161     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
162 
163     // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}})
164     #pragma omp target map(c[2:4])
165       { c[3]+=1; }
166 
167     // Region 05
168     // CK23-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null, i8** null)
169     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
170     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
171 
172     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
173     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
174     // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
175     // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
176     // CK23-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
177     // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
178     // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
179     // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
180     // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
181     // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
182     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
183     // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
184     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
185 
186     // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
187     #pragma omp target map(d[2:4])
188       { d[3]+=1; }
189   }();
190   return b;
191 }
192 
193 // CK23: define {{.+}}[[CALL00]]
194 // CK23: define {{.+}}[[CALL01]]
195 // CK23: define {{.+}}[[CALL02]]
196 // CK23: define {{.+}}[[CALL03]]
197 // CK23: define {{.+}}[[CALL04]]
198 // CK23: define {{.+}}[[CALL05]]
199 #endif // CK23
200 #endif
201