[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Headers / nvptx_device_math_sin_cos.cpp
blobdbb2e71ec352b5d976fea901f73366313efc1b40
1 // REQUIRES: nvptx-registered-target
2 // RUN: %clang_cc1 -internal-isystem %S/Inputs/include -fopenmp -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
3 // RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -triple nvptx64-nvidia-cuda -aux-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
5 #include <cmath>
7 // 6 calls to sin/cos(f), all translated to __nv_sin/__nv_cos calls:
9 // CHECK-NOT: _Z.sin
10 // CHECK-NOT: _Z.cos
11 // CHECK: call double @__nv_sin(double
12 // CHECK-NOT: _Z.sin
13 // CHECK-NOT: _Z.cos
14 // CHECK: call float @__nv_sinf(float
15 // CHECK-NOT: _Z.sin
16 // CHECK-NOT: _Z.cos
17 // CHECK: call double @__nv_sin(double
18 // CHECK-NOT: _Z.sin
19 // CHECK-NOT: _Z.cos
20 // CHECK: call double @__nv_cos(double
21 // CHECK-NOT: _Z.sin
22 // CHECK-NOT: _Z.cos
23 // CHECK: call float @__nv_sinf(float
24 // CHECK-NOT: _Z.sin
25 // CHECK-NOT: _Z.cos
26 // CHECK: call float @__nv_cosf(float
27 // CHECK-NOT: _Z.sin
28 // CHECK-NOT: _Z.cos
30 template<typename T>
31 void test_sin_cos(T x)
33 T res_sin, res_cos;
35 #pragma omp target map(from: res_sin, res_cos)
37 res_sin = std::sin(x);
38 res_cos = std::cos(x);
42 int main()
45 #if !defined(C_ONLY)
46 test_sin_cos<double>(0.0);
47 test_sin_cos<float>(0.0);
48 #endif
50 #pragma omp target
52 double res;
53 res = sin(1.0);
56 #pragma omp target
58 float res;
59 res = sinf(1.0f);
62 return 0;