Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / amdgcn_device_function_call.cpp
blobe9cedc6fc77946dca6f833a1b2af6d16cc433391
1 // REQUIRES: amdgpu-registered-target
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.bc
4 // 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 %s
5 // RUN: llvm-dis < %t-ppc-host.bc | FileCheck %s -check-prefix=HOST
7 // device side declarations
8 #pragma omp declare target
9 extern "C" float cosf(float __x);
10 #pragma omp end declare target
12 // host side declaration
13 extern "C" float cosf(float __x);
15 void test_amdgcn_openmp_device(float __x) {
16 // the default case where predefined library functions are treated as
17 // builtins on the host
18 // HOST: call float @llvm.cos.f32(float
19 __x = cosf(__x);
21 #pragma omp target
23 // cosf should not be treated as builtin on device
24 // CHECK-NOT: call float @llvm.cos.f32(float
25 __x = cosf(__x);