28 lines · cpp
1// REQUIRES: amdgpu-registered-target2 3// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host.bc4// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s5// RUN: llvm-dis < %t-ppc-host.bc | FileCheck %s -check-prefix=HOST6 7// device side declarations8#pragma omp declare target9extern "C" float cosf(float __x);10#pragma omp end declare target11 12// host side declaration13extern "C" float cosf(float __x);14 15void test_amdgcn_openmp_device(float __x) {16 // the default case where predefined library functions are treated as17 // builtins on the host18 // HOST: call float @llvm.cos.f32(float19 __x = cosf(__x);20 21#pragma omp target22 {23 // cosf should not be treated as builtin on device24 // CHECK-NOT: call float @llvm.cos.f32(float25 __x = cosf(__x);26 }27}28