diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90 index 259812d0eed1d..3e86dac5f5641 100644 --- a/flang/module/cudadevice.f90 +++ b/flang/module/cudadevice.f90 @@ -779,6 +779,34 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi') end function end interface + interface __drcp_rd + attributes(device) double precision function __drcp_rd(x) bind(c, name='__nv_drcp_rd') + !dir$ ignore_tkr (d) x + double precision, value :: x + end function + end interface + + interface __drcp_rn + attributes(device) double precision function __drcp_rn(x) bind(c, name='__nv_drcp_rn') + !dir$ ignore_tkr (d) x + double precision, value :: x + end function + end interface + + interface __drcp_ru + attributes(device) double precision function __drcp_ru(x) bind(c, name='__nv_drcp_ru') + !dir$ ignore_tkr (d) x + double precision, value :: x + end function + end interface + + interface __drcp_rz + attributes(device) double precision function __drcp_rz(x) bind(c, name='__nv_drcp_rz') + !dir$ ignore_tkr (d) x + double precision, value :: x + end function + end interface + interface __dsqrt_rd attributes(device) double precision function __dsqrt_rd(x) bind(c, name='__nv_dsqrt_rd') !dir$ ignore_tkr (d) x diff --git a/flang/test/Lower/CUDA/cuda-libdevice.cuf b/flang/test/Lower/CUDA/cuda-libdevice.cuf index 52cf9c391c8de..374d9f30ff008 100644 --- a/flang/test/Lower/CUDA/cuda-libdevice.cuf +++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf @@ -116,6 +116,22 @@ end subroutine ! CHECK: %{{.*}} = fir.call @__nv_double2ll_ru(%{{.*}}) proc_attrs fastmath : (f64) -> i64 ! CHECK: %{{.*}} = fir.call @__nv_double2ll_rz(%{{.*}}) proc_attrs fastmath : (f64) -> i64 + +attributes(global) subroutine test_drcp_rX() + double precision :: res + double precision :: r + res = __drcp_rd(r) + res = __drcp_rn(r) + res = __drcp_ru(r) + res = __drcp_rz(r) +end subroutine + +! CHECK-LABEL: _QPtest_drcp_rx +! CHECK: %{{.*}} = fir.call @__nv_drcp_rd(%{{.*}}) proc_attrs fastmath : (f64) -> f64 +! CHECK: %{{.*}} = fir.call @__nv_drcp_rn(%{{.*}}) proc_attrs fastmath : (f64) -> f64 +! CHECK: %{{.*}} = fir.call @__nv_drcp_ru(%{{.*}}) proc_attrs fastmath : (f64) -> f64 +! CHECK: %{{.*}} = fir.call @__nv_drcp_rz(%{{.*}}) proc_attrs fastmath : (f64) -> f64 + attributes(global) subroutine test_double2ull_rX() integer(8) :: res double precision :: r @@ -130,3 +146,4 @@ end subroutine ! CHECK: %{{.*}} = fir.call @__nv_double2ull_rn(%{{.*}}) proc_attrs fastmath : (f64) -> i64 ! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs fastmath : (f64) -> i64 ! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs fastmath : (f64) -> i64 +