[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Headers / amdgcn-openmp-device-math-complex.cpp
blobd1a2cf31fabaeac608ded24a9377699d7afe5a12
1 // RUN: %clang_cc1 -verify -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-x86-host.bc
2 // RUN: %clang_cc1 -verify -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -aux-triple x86_64-unknown-unknown -o - | FileCheck %s
3 // expected-no-diagnostics
5 #include <cmath>
6 #include <complex>
8 // CHECK: define weak {{.*}} @__muldc3
9 // CHECK-DAG: call i32 @__ocml_isnan_f64(
10 // CHECK-DAG: call i32 @__ocml_isinf_f64(
12 // CHECK: define weak {{.*}} @__mulsc3
13 // CHECK-DAG: call i32 @__ocml_isnan_f32(
14 // CHECK-DAG: call i32 @__ocml_isinf_f32(
15 // CHECK-DAG: call float @__ocml_copysign_f32(
17 // CHECK: define weak {{.*}} @__divdc3
18 // CHECK-DAG: call i32 @__ocml_isnan_f64(
19 // CHECK-DAG: call i32 @__ocml_isinf_f64(
20 // CHECK-DAG: call i32 @__ocml_isfinite_f64(
21 // CHECK-DAG: call double @__ocml_copysign_f64(
22 // CHECK-DAG: call double @__ocml_scalbn_f64(
23 // CHECK-DAG: call double @__ocml_fabs_f64(
24 // CHECK-DAG: call double @__ocml_logb_f64(
26 // CHECK: define weak {{.*}} @__divsc3
27 // CHECK-DAG: call i32 @__ocml_isnan_f32(
28 // CHECK-DAG: call i32 @__ocml_isinf_f32(
29 // CHECK-DAG: call i32 @__ocml_isfinite_f32(
30 // CHECK-DAG: call float @__ocml_copysign_f32(
31 // CHECK-DAG: call float @__ocml_scalbn_f32(
32 // CHECK-DAG: call float @__ocml_fabs_f32(
33 // CHECK-DAG: call float @__ocml_logb_f32(
35 // We actually check that there are no declarations of non-OpenMP functions.
36 // That is, as long as we don't call an unkown function with a name that
37 // doesn't start with '__' we are good :)
39 // CHECK-NOT: declare.*@[^_]
41 void test_scmplx(std::complex<float> a) {
42 #pragma omp target
44 (void)(a * (a / a));
48 void test_dcmplx(std::complex<double> a) {
49 #pragma omp target
51 (void)(a * (a / a));
55 template <typename T>
56 std::complex<T> test_template_math_calls(std::complex<T> a) {
57 decltype(a) r = a;
58 #pragma omp target
60 r = std::sin(r);
61 r = std::cos(r);
62 r = std::exp(r);
63 r = std::atan(r);
64 r = std::acos(r);
66 return r;
69 std::complex<float> test_scall(std::complex<float> a) {
70 decltype(a) r;
71 #pragma omp target
73 r = std::sin(a);
75 return test_template_math_calls(r);
78 std::complex<double> test_dcall(std::complex<double> a) {
79 decltype(a) r;
80 #pragma omp target
82 r = std::exp(a);
84 return test_template_math_calls(r);