Skip to content

Commit 583499a

Browse files
authored
[flang][cuda] Add missing bind name for __hiloint2double, __double2loint and __double2hiint (#153713)
1 parent dfa1335 commit 583499a

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

flang/module/cudadevice.f90

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

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

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

670670
interface __hiloint2double
671-
attributes(device) double precision function __hiloint2double(i, j) bind(c)
671+
attributes(device) double precision function __hiloint2double(i, j) bind(c, name='__nv_hiloint2double')
672672
!dir$ ignore_tkr (d) i, (d) j
673673
integer, value :: i, j
674674
end function

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,30 @@ end subroutine
244244
! CHECK: %{{.*}} = fir.call @__nv_float2uint_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32
245245
! CHECK: %{{.*}} = fir.call @__nv_float2uint_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32
246246
! CHECK: %{{.*}} = fir.call @__nv_float2uint_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32
247+
248+
attributes(global) subroutine test_double2loint()
249+
integer :: res
250+
double precision :: r
251+
res = __double2loint(r)
252+
end subroutine
253+
254+
! CHECK-LABEL: _QPtest_double2loint
255+
! CHECK: %{{.*}} = fir.call @__nv_double2loint(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i32
256+
257+
attributes(global) subroutine test_double2hiint()
258+
integer :: res
259+
double precision :: r
260+
res = __double2hiint(r)
261+
end subroutine
262+
263+
! CHECK-LABEL: _QPtest_double2hiint
264+
! CHECK: %{{.*}} = fir.call @__nv_double2hiint(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i32
265+
266+
attributes(global) subroutine test_hiloint2double()
267+
double precision :: res
268+
integer :: i, j
269+
res = __hiloint2double(i, j)
270+
end subroutine
271+
272+
! CHECK-LABEL: _QPtest_hiloint2double
273+
! CHECK: %{{.*}} = fir.call @__nv_hiloint2double(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> f64

0 commit comments

Comments
 (0)