1e62c693cSGheorghe-Teodor Bercea // Test calling of device math functions. 2e62c693cSGheorghe-Teodor Bercea ///==========================================================================/// 3e62c693cSGheorghe-Teodor Bercea 4e62c693cSGheorghe-Teodor Bercea // REQUIRES: nvptx-registered-target 5e62c693cSGheorghe-Teodor Bercea 6f85ae058SJohannes Doerfert // RUN: %clang_cc1 -internal-isystem %S/Inputs/include -x c++ -fopenmp -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc 763ca93c7SSergio Afonso // 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 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 -check-prefix CHECK-YES %s 8e62c693cSGheorghe-Teodor Bercea 994695718SGheorghe-Teodor Bercea #include <cstdlib> 10f85ae058SJohannes Doerfert #include <cmath> 11e62c693cSGheorghe-Teodor Bercea test_sqrt(double a1)12e62c693cSGheorghe-Teodor Berceavoid test_sqrt(double a1) { 13e62c693cSGheorghe-Teodor Bercea #pragma omp target 14e62c693cSGheorghe-Teodor Bercea { 15*2da4960fSNoah Goldstein // CHECK-YES: call noundef double @__nv_sqrt(double 16e62c693cSGheorghe-Teodor Bercea double l1 = sqrt(a1); 17*2da4960fSNoah Goldstein // CHECK-YES: call noundef double @__nv_pow(double 18e62c693cSGheorghe-Teodor Bercea double l2 = pow(a1, a1); 19*2da4960fSNoah Goldstein // CHECK-YES: call noundef double @__nv_modf(double 20e62c693cSGheorghe-Teodor Bercea double l3 = modf(a1 + 3.5, &a1); 21*2da4960fSNoah Goldstein // CHECK-YES: call noundef double @__nv_fabs(double 229392bd69SGheorghe-Teodor Bercea double l4 = fabs(a1); 23*2da4960fSNoah Goldstein // CHECK-YES: call noundef i32 @__nv_abs(i32 249392bd69SGheorghe-Teodor Bercea double l5 = abs((int)a1); 25e62c693cSGheorghe-Teodor Bercea } 26e62c693cSGheorghe-Teodor Bercea } 27