aboutsummaryrefslogtreecommitdiff
path: root/test/OpenMP/openmp_offload_codegen.cpp
blob: f89bccf3b5527e4aa65a87bcf665a19ee265e36b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Test device for mapping codegen.
///==========================================================================///

// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -S -emit-llvm %s -o - 2>&1 \
// RUN:   | FileCheck -check-prefix=CK1 %s

// 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
// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1-DEVICE

// expected-no-diagnostics

#ifdef CK1

void target_maps_parallel_integer(int a){
  int ParamToKernel = a;
#pragma omp target map(tofrom: ParamToKernel)
  {
    ParamToKernel += 1;
  }
}

// CK1-DEVICE: {{.*}}void @__omp_offloading_{{.*}}(i32* dereferenceable(4){{.*}}

// CK1: {{.*}}void {{.*}}target_maps_parallel_integer{{.*}} {

// CK1: [[GEPOBP:%.+]] = getelementptr inbounds {{.*}}
// CK1: [[GEPOBPBIT:%.+]] = bitcast i8** [[GEPOBP]]
// CK1: store i32* %ParamToKernel, i32** [[GEPOBPBIT]]
// CK1: [[GEPOP:%.+]] = getelementptr inbounds {{.*}}
// CK1: [[GEPOPBIT:%.+]] = bitcast i8** [[GEPOP]]
// CK1: store i32* %ParamToKernel, i32** [[GEPOPBIT]]
// CK1: [[GEPOBPARG:%.+]] = getelementptr inbounds {{.*}}
// CK1: [[GEPOPARG:%.+]] = getelementptr inbounds {{.*}}
// CK1: call {{.*}}tgt_target({{.*}}i8** [[GEPOBPARG]], i8** [[GEPOPARG]]

#endif