Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions flang/module/cudadevice.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions flang/test/Lower/CUDA/cuda-libdevice.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ end subroutine
! CHECK: %{{.*}} = fir.call @__nv_double2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (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<bind_c> fastmath<contract> : (f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_drcp_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_drcp_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_drcp_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64

attributes(global) subroutine test_double2ull_rX()
integer(8) :: res
double precision :: r
Expand All @@ -130,3 +146,4 @@ end subroutine
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64