Skip to content

Commit efce767

Browse files
authored
[flang][cuda] Add interfaces for __ull2float_rX functions (#153613)
1 parent ada1911 commit efce767

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

flang/module/cudadevice.f90

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,34 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
709709
end function
710710
end interface
711711

712+
interface __ull2float_rd
713+
attributes(device) real function __ull2float_rd(i) bind(c, name='__nv_ull2float_rd')
714+
!dir$ ignore_tkr (d) i
715+
integer(8), value :: i
716+
end function
717+
end interface
718+
719+
interface __ull2float_rn
720+
attributes(device) real function __ull2float_rn(i) bind(c, name='__nv_ull2float_rn')
721+
!dir$ ignore_tkr (d) i
722+
integer(8), value :: i
723+
end function
724+
end interface
725+
726+
interface __ull2float_ru
727+
attributes(device) real function __ull2float_ru(i) bind(c, name='__nv_ull2float_ru')
728+
!dir$ ignore_tkr (d) i
729+
integer(8), value :: i
730+
end function
731+
end interface
732+
733+
interface __ull2float_rz
734+
attributes(device) real function __ull2float_rz(i) bind(c, name='__nv_ull2float_rz')
735+
!dir$ ignore_tkr (d) i
736+
integer(8), value :: i
737+
end function
738+
end interface
739+
712740
interface __mul24
713741
attributes(device) integer function __mul24(i,j) bind(c, name='__nv_mul24')
714742
!dir$ ignore_tkr (d) i, (d) j

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ end subroutine
2020
! CHECK-LABEL: _QPtest_usad
2121
! CHECK: %{{.*}} = fir.call @__nv_usad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32, i32) -> i32
2222

23+
attributes(global) subroutine test_ull2dloat_rX()
24+
real :: res
25+
integer(8) :: i
26+
res = __ull2float_rd(i)
27+
res = __ull2float_rn(i)
28+
res = __ull2float_ru(i)
29+
res = __ull2float_rz(i)
30+
end subroutine
31+
32+
! CHECK-LABEL: _QPtest_ull2dloat_rx
33+
! CHECK: %{{.*}} = fir.call @__nv_ull2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
34+
! CHECK: %{{.*}} = fir.call @__nv_ull2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
35+
! CHECK: %{{.*}} = fir.call @__nv_ull2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
36+
! CHECK: %{{.*}} = fir.call @__nv_ull2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
37+
2338
attributes(global) subroutine test_log()
2439
real :: res
2540
real :: r
@@ -50,4 +65,3 @@ end subroutine
5065

5166
! CHECK-LABEL: _QPtest_tanf
5267
! CHECK: %{{.*}} = fir.call @__nv_tanf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
53-

0 commit comments

Comments
 (0)