Skip to content

Commit 0659044

Browse files
authored
[flang][cuda] Add bind names for __double2ull_rX interfaces (#153678)
1 parent 5836bae commit 0659044

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

flang/module/cudadevice.f90

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -653,29 +653,29 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
653653
end function
654654
end interface
655655

656-
interface __double2ull_rn
657-
attributes(device) integer(8) function __double2ull_rn(r) bind(c)
656+
interface __double2ull_rd
657+
attributes(device) integer(8) function __double2ull_rd(r) bind(c, name='__nv_double2ull_rd')
658658
!dir$ ignore_tkr (d) r
659659
double precision, value :: r
660660
end function
661661
end interface
662662

663-
interface __double2ull_rz
664-
attributes(device) integer(8) function __double2ull_rz(r) bind(c)
663+
interface __double2ull_rn
664+
attributes(device) integer(8) function __double2ull_rn(r) bind(c, name='__nv_double2ull_rn')
665665
!dir$ ignore_tkr (d) r
666666
double precision, value :: r
667667
end function
668668
end interface
669669

670670
interface __double2ull_ru
671-
attributes(device) integer(8) function __double2ull_ru(r) bind(c)
671+
attributes(device) integer(8) function __double2ull_ru(r) bind(c, name='__nv_double2ull_ru')
672672
!dir$ ignore_tkr (d) r
673673
double precision, value :: r
674674
end function
675675
end interface
676676

677-
interface __double2ull_rd
678-
attributes(device) integer(8) function __double2ull_rd(r) bind(c)
677+
interface __double2ull_rz
678+
attributes(device) integer(8) function __double2ull_rz(r) bind(c, name='__nv_double2ull_rz')
679679
!dir$ ignore_tkr (d) r
680680
double precision, value :: r
681681
end function

flang/test/Lower/CUDA/cuda-libdevice.cuf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,18 @@ end subroutine
115115
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
116116
! CHECK: %{{.*}} = fir.call @__nv_double2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
117117
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
118+
119+
attributes(global) subroutine test_double2ull_rX()
120+
integer(8) :: res
121+
double precision :: r
122+
res = __double2ull_rd(r)
123+
res = __double2ull_rn(r)
124+
res = __double2ull_ru(r)
125+
res = __double2ull_rz(r)
126+
end subroutine
127+
128+
! CHECK-LABEL: _QPtest_double2ull_rx
129+
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
130+
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
131+
! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
132+
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64

0 commit comments

Comments
 (0)