Skip to content

Commit bad3df4

Browse files
authored
[flang][cuda] Add bind names for __double2ll_rX interfaces (#153660)
1 parent 52c9489 commit bad3df4

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
@@ -625,29 +625,29 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
625625
end function
626626
end interface
627627

628-
interface __double2ll_rn
629-
attributes(device) integer(8) function __double2ll_rn(r) bind(c)
628+
interface __double2ll_rd
629+
attributes(device) integer(8) function __double2ll_rd(r) bind(c, name='__nv_double2ll_rd')
630630
!dir$ ignore_tkr (d) r
631631
double precision, value :: r
632632
end function
633633
end interface
634634

635-
interface __double2ll_rz
636-
attributes(device) integer(8) function __double2ll_rz(r) bind(c)
635+
interface __double2ll_rn
636+
attributes(device) integer(8) function __double2ll_rn(r) bind(c, name='__nv_double2ll_rn')
637637
!dir$ ignore_tkr (d) r
638638
double precision, value :: r
639639
end function
640640
end interface
641641

642642
interface __double2ll_ru
643-
attributes(device) integer(8) function __double2ll_ru(r) bind(c)
643+
attributes(device) integer(8) function __double2ll_ru(r) bind(c, name='__nv_double2ll_ru')
644644
!dir$ ignore_tkr (d) r
645645
double precision, value :: r
646646
end function
647647
end interface
648648

649-
interface __double2ll_rd
650-
attributes(device) integer(8) function __double2ll_rd(r) bind(c)
649+
interface __double2ll_rz
650+
attributes(device) integer(8) function __double2ll_rz(r) bind(c, name='__nv_double2ll_rz')
651651
!dir$ ignore_tkr (d) r
652652
double precision, value :: r
653653
end function

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,18 @@ end subroutine
100100
! CHECK-LABEL: _QPtest_exp
101101
! CHECK: %{{.*}} = fir.call @__nv_expf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
102102
! CHECK: %{{.*}} = fir.call @__nv_exp10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
103+
104+
attributes(global) subroutine test_double2ll_rX()
105+
integer(8) :: res
106+
double precision :: r
107+
res = __double2ll_rd(r)
108+
res = __double2ll_rn(r)
109+
res = __double2ll_ru(r)
110+
res = __double2ll_rz(r)
111+
end subroutine
112+
113+
! CHECK-LABEL: _QPtest_double2ll_rx
114+
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
115+
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
116+
! CHECK: %{{.*}} = fir.call @__nv_double2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
117+
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64

0 commit comments

Comments
 (0)