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-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s 4 5 #include <cmath> 6 7 // 4 calls to modf(f), all translated to __nv_modf calls: 8 9 // CHECK-NOT: _Z.modf 10 // CHECK: call noundef double @__nv_modf(double 11 // CHECK-NOT: _Z.modf 12 // CHECK: call noundef float @__nv_modff(float 13 // CHECK-NOT: _Z.modf 14 // CHECK: call noundef double @__nv_modf(double 15 // CHECK-NOT: _Z.modf 16 // CHECK: call noundef float @__nv_modff(float 17 // CHECK-NOT: _Z.modf 18 19 template<typename T> test_modf(T x)20void test_modf(T x) 21 { 22 T dx; 23 int intx; 24 25 #pragma omp target map(from: intx, dx) 26 { 27 T ipart; 28 dx = std::modf(x, &ipart); 29 intx = static_cast<int>(ipart); 30 } 31 } 32 main()33int main() 34 { 35 36 #if !defined(C_ONLY) 37 test_modf<double>(1.0); 38 test_modf<float>(1.0); 39 #endif 40 41 #pragma omp target 42 { 43 double intpart, res; 44 res = modf(1.1, &intpart); 45 } 46 47 #pragma omp target 48 { 49 float intpart, res; 50 res = modff(1.1f, &intpart); 51 } 52 53 } 54