[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / interop_codegen.cpp
blob31df2f1ba58c5f13b4ed7ff8652dab8888554f5a
1 // expected-no-diagnostics
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -o - | FileCheck %s
4 // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s
6 #ifndef HEADER
7 #define HEADER
9 typedef void *omp_interop_t;
10 #define omp_interop_none 0
11 #define omp_ipr_fr_id -1
12 typedef long omp_intptr_t;
13 #define NULL 0
15 extern omp_intptr_t omp_get_interop_int(const omp_interop_t, int, int *);
17 int main() {
18 omp_interop_t obj1 = omp_interop_none;
19 omp_interop_t obj2 = omp_interop_none;
20 omp_interop_t i1 = omp_interop_none;
21 omp_interop_t i2 = omp_interop_none;
22 omp_interop_t i3 = omp_interop_none;
23 omp_interop_t i4 = omp_interop_none;
24 omp_interop_t i5 = omp_interop_none;
26 #pragma omp interop init(targetsync: obj1) init(targetsync: obj2)
27 int id = (int )omp_get_interop_int(obj1, omp_ipr_fr_id, NULL);
28 int id1 = (int )omp_get_interop_int(obj2, omp_ipr_fr_id, NULL);
30 #pragma omp interop init(target,targetsync: i1) use(i2) use(i3) destroy(i4) destroy(i5)
31 int id2 = (int )omp_get_interop_int(i1, omp_ipr_fr_id, NULL);
32 int id3 = (int )omp_get_interop_int(i2, omp_ipr_fr_id, NULL);
36 #endif
38 // CHECK-LABEL: define {{.+}}main{{.+}}
39 // CHECK: call {{.+}}__tgt_interop_init({{.+}}obj1{{.*}})
40 // CHECK: call {{.+}}__tgt_interop_init({{.+}}obj2{{.*}})
41 // CHECK: call {{.+}}__tgt_interop_init({{.+}}i1{{.*}})
42 // CHECK: call {{.+}}__tgt_interop_destroy({{.+}}i4{{.*}})
43 // CHECK: call {{.+}}__tgt_interop_destroy({{.+}}i5{{.*}})
44 // CHECK: call {{.+}}__tgt_interop_use({{.+}}i2{{.*}})
45 // CHECK: call {{.+}}__tgt_interop_use({{.+}}i3{{.*}})