[clang][lex] NFCI: Use DirectoryEntryRef in ModuleMap::inferFrameworkModule()
[llvm-project.git] / clang / test / Headers / amdgcn_openmp_device_math.c
blob1f3eac82c038a638b4844e17af3c80c1ed19acf8
1 // RUN: %clang_cc1 -internal-isystem %S/Inputs/include -x c -fopenmp -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-host.bc
2 // RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/../../lib/Headers/openmp_wrappers -internal-isystem %S/Inputs/include -x c -fopenmp -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s --check-prefixes=CHECK-C,CHECK
3 // RUN: %clang_cc1 -internal-isystem %S/Inputs/include -x c++ -fopenmp -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-host.bc
4 // RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/../../lib/Headers/openmp_wrappers -internal-isystem %S/Inputs/include -x c++ -fopenmp -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s --check-prefixes=CHECK-CPP,CHECK
6 #ifdef __cplusplus
7 #include <cmath>
8 #else
9 #include <math.h>
10 #endif
12 void test_math_f64(double x) {
13 // CHECK-LABEL: define {{.*}}test_math_f64
14 #pragma omp target
16 // CHECK: call double @__ocml_sin_f64
17 double l1 = sin(x);
18 // CHECK: call double @__ocml_cos_f64
19 double l2 = cos(x);
20 // CHECK: call double @llvm.fabs.f64
21 double l3 = fabs(x);
25 void test_math_f32(float x) {
26 // CHECK-LABEL: define {{.*}}test_math_f32
27 #pragma omp target
29 // CHECK-C: call double @__ocml_sin_f64
30 // CHECK-CPP: call float @__ocml_sin_f32
31 float l1 = sin(x);
32 // CHECK-C: call double @__ocml_cos_f64
33 // CHECK-CPP: call float @__ocml_cos_f32
34 float l2 = cos(x);
35 // CHECK-C: call double @llvm.fabs.f64
36 // CHECK-CPP: call float @llvm.fabs.f32
37 float l3 = fabs(x);
40 void test_math_f32_suffix(float x) {
41 // CHECK-LABEL: define {{.*}}test_math_f32_suffix
42 #pragma omp target
44 // CHECK: call float @__ocml_sin_f32
45 float l1 = sinf(x);
46 // CHECK: call float @__ocml_cos_f32
47 float l2 = cosf(x);
48 // CHECK: call float @llvm.fabs.f32
49 float l3 = fabsf(x);