diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90 index 4f3625a8b07af..fd23bcbc37ffc 100644 --- a/flang/module/cudadevice.f90 +++ b/flang/module/cudadevice.f90 @@ -392,6 +392,20 @@ attributes(device) subroutine sincospi(x, y, z) bind(c,name='__nv_sincospi') end function end interface + interface __sinf + attributes(device) real function __sinf(r) bind(c, name='__nv_sinf') + !dir$ ignore_tkr (d) r + real, value :: r + end function + end interface + + interface __tanf + attributes(device) real function __tanf(r) bind(c, name='__nv_tanf') + !dir$ ignore_tkr (d) r + real, value :: r + end function + end interface + interface attributes(device) real(4) function cospif(x) bind(c,name='__nv_cospif') real(4), value :: x diff --git a/flang/test/Lower/CUDA/cuda-libdevice.cuf b/flang/test/Lower/CUDA/cuda-libdevice.cuf index 10e4c2757d825..a91e503a65561 100644 --- a/flang/test/Lower/CUDA/cuda-libdevice.cuf +++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf @@ -19,3 +19,21 @@ end subroutine ! CHECK-LABEL: _QPtest_usad ! CHECK: %{{.*}} = fir.call @__nv_usad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs fastmath : (i32, i32, i32) -> i32 + +attributes(global) subroutine test_sinf() + real :: res + real :: r + res = __sinf(r) +end subroutine + +! CHECK-LABEL: _QPtest_sinf +! CHECK: %{{.*}} = fir.call @__nv_sinf(%{{.*}}) proc_attrs fastmath : (f32) -> f32 + +attributes(global) subroutine test_tanf() + real :: res + real :: r + res = __tanf(r) +end subroutine + +! CHECK-LABEL: _QPtest_tanf +! CHECK: %{{.*}} = fir.call @__nv_tanf(%{{.*}}) proc_attrs fastmath : (f32) -> f32