Skip to content

[flang][cuda] Add bind names for __double2ll_rX interfaces #153660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2025
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
14 changes: 7 additions & 7 deletions flang/module/cudadevice.f90
Original file line number Diff line number Diff line change
Expand Up @@ -625,29 +625,29 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
end function
end interface

interface __double2ll_rn
attributes(device) integer(8) function __double2ll_rn(r) bind(c)
interface __double2ll_rd
attributes(device) integer(8) function __double2ll_rd(r) bind(c, name='__nv_double2ll_rd')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface

interface __double2ll_rz
attributes(device) integer(8) function __double2ll_rz(r) bind(c)
interface __double2ll_rn
attributes(device) integer(8) function __double2ll_rn(r) bind(c, name='__nv_double2ll_rn')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface

interface __double2ll_ru
attributes(device) integer(8) function __double2ll_ru(r) bind(c)
attributes(device) integer(8) function __double2ll_ru(r) bind(c, name='__nv_double2ll_ru')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface

interface __double2ll_rd
attributes(device) integer(8) function __double2ll_rd(r) bind(c)
interface __double2ll_rz
attributes(device) integer(8) function __double2ll_rz(r) bind(c, name='__nv_double2ll_rz')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
Expand Down
15 changes: 15 additions & 0 deletions flang/test/Lower/CUDA/cuda-libdevice.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,18 @@ end subroutine
! CHECK-LABEL: _QPtest_exp
! CHECK: %{{.*}} = fir.call @__nv_expf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_exp10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32

attributes(global) subroutine test_double2ll_rX()
integer(8) :: res
double precision :: r
res = __double2ll_rd(r)
res = __double2ll_rn(r)
res = __double2ll_ru(r)
res = __double2ll_rz(r)
end subroutine

! CHECK-LABEL: _QPtest_double2ll_rx
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! 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