[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / openmp_offload_codegen.cpp
blobf509bf79fe7e33dcb7cd702cce5a0f168d9da12d
1 // Test device for mapping codegen.
2 ///==========================================================================///
4 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -o - 2>&1 | FileCheck -check-prefix=CK1 %s
6 // RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -o - 2>&1 | FileCheck --check-prefix SIMD-ONLY0 %s
7 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
10 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1-DEVICE
12 // RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
13 // RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck --check-prefix SIMD-ONLY1 %s
14 // SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
16 // expected-no-diagnostics
18 #ifdef CK1
20 void target_maps_parallel_integer(int a){
21 int ParamToKernel = a;
22 #pragma omp target map(tofrom: ParamToKernel)
24 ParamToKernel += 1;
28 // CK1-DEVICE: {{.*}}void @__omp_offloading_{{.*}}(ptr {{[^,]+}}, ptr noundef nonnull align 4 dereferenceable(4){{.*}}
30 // CK1: {{.*}}void {{.*}}target_maps_parallel_integer{{.*}} {
32 // CK1: [[GEPOBP:%.+]] = getelementptr inbounds {{.*}}
33 // CK1: store ptr %ParamToKernel, ptr [[GEPOBP]]
34 // CK1: [[GEPOP:%.+]] = getelementptr inbounds {{.*}}
35 // CK1: store ptr %ParamToKernel, ptr [[GEPOP]]
36 // CK1: [[GEPOBPARG:%.+]] = getelementptr inbounds {{.*}} %.offload_baseptrs, i32 0, i32 0
37 // CK1: [[GEPOPARG:%.+]] = getelementptr inbounds {{.*}} %.offload_ptrs, i32 0, i32 0
38 // CK1: [[ARGBP:%.+]] = getelementptr inbounds nuw %struct.__tgt_kernel_arguments, ptr %kernel_args, i32 0, i32 2
39 // CK1: store ptr [[GEPOBPARG]], ptr [[ARGBP]], align 8
40 // CK1: [[ARGP:%.+]] = getelementptr inbounds nuw %struct.__tgt_kernel_arguments, ptr %kernel_args, i32 0, i32 3
41 // CK1: store ptr [[GEPOPARG]], ptr [[ARGP]], align 8
42 // CK1: call {{.*}}tgt_target_kernel({{.*}})
44 #endif