Index: libomptarget/deviceRTLs/nvptx/CMakeLists.txt =================================================================== --- libomptarget/deviceRTLs/nvptx/CMakeLists.txt +++ libomptarget/deviceRTLs/nvptx/CMakeLists.txt @@ -53,6 +53,7 @@ src/reduction.cu src/sync.cu src/task.cu + src/math.cu ) set(omp_data_objects src/omp_data.cu) Index: libomptarget/deviceRTLs/nvptx/src/interface.h =================================================================== --- libomptarget/deviceRTLs/nvptx/src/interface.h +++ libomptarget/deviceRTLs/nvptx/src/interface.h @@ -567,4 +567,14 @@ EXTERN void __kmpc_restore_team_static_memory(int16_t isSPMDExecutionMode, int16_t is_shared); +// POW +EXTERN float __kmpc_powf(float a, float b); +EXTERN double __kmpc_pow(double, double); +EXTERN long double __kmpc_powl(long double a, long double b); + +// SIN +EXTERN float __kmpc_sinf(float); +EXTERN double __kmpc_sin(double); +EXTERN long double __kmpc_sinl(long double); + #endif Index: libomptarget/deviceRTLs/nvptx/src/math.cu =================================================================== --- /dev/null +++ libomptarget/deviceRTLs/nvptx/src/math.cu @@ -0,0 +1,29 @@ +//===------------ math.cu - NVPTX OpenMP math constructs --------- CUDA -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains the implementation of math function not already handled. +// Function in this file will end up as part of the .bc library of the +// device and will call libdevice functions. +// +//===----------------------------------------------------------------------===// + +#include "omptarget-nvptx.h" + +EXTERN float __kmpc_powf(float a, float b) { return powf(a, b); } +EXTERN double __kmpc_pow(double a, double b) { return pow(a, b); } +// no powl defined for the GPU device so use pow. +EXTERN long double __kmpc_powl(long double a, long double b) { + return pow((double) a, (double) b); +} + +EXTERN float __kmpc_sinf(float a) { return sinf(a); } +EXTERN double __kmpc_sin(double a) { return sin(a); } +// no sinl defined for the GPU device so use pow. +EXTERN long double __kmpc_sinl(long double a) { + return sin((double) a); +} \ No newline at end of file