Skip to content

Commit 2775c79

Browse files
authored
[flang][cuda] Add interfaces for __float2ll_rX (#153702)
1 parent d56fa96 commit 2775c79

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

flang/module/cudadevice.f90

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

474+
interface __float2ll_rd
475+
attributes(device) integer(8) function __float2ll_rd(r) bind(c, name='__nv_float2ll_rd')
476+
!dir$ ignore_tkr (d) r
477+
real, value :: r
478+
end function
479+
end interface
480+
481+
interface __float2ll_rn
482+
attributes(device) integer(8) function __float2ll_rn(r) bind(c, name='__nv_float2ll_rn')
483+
!dir$ ignore_tkr (d) r
484+
real, value :: r
485+
end function
486+
end interface
487+
488+
interface __float2ll_ru
489+
attributes(device) integer(8) function __float2ll_ru(r) bind(c, name='__nv_float2ll_ru')
490+
!dir$ ignore_tkr (d) r
491+
real, value :: r
492+
end function
493+
end interface
494+
495+
interface __float2ll_rz
496+
attributes(device) integer(8) function __float2ll_rz(r) bind(c, name='__nv_float2ll_rz')
497+
!dir$ ignore_tkr (d) r
498+
real, value :: r
499+
end function
500+
end interface
501+
474502
interface __half2float
475503
attributes(device) real function __half2float(i) bind(c, name='__nv_half2float')
476504
!dir$ ignore_tkr (d) i

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ end subroutine
162162
! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
163163
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
164164

165+
attributes(global) subroutine test_float2ll_rX()
166+
integer(8) :: res
167+
real :: r
168+
res = __float2ll_rd(r)
169+
res = __float2ll_rn(r)
170+
res = __float2ll_ru(r)
171+
res = __float2ll_rz(r)
172+
end subroutine
173+
174+
! CHECK-LABEL: _QPtest_float2ll_rx
175+
! CHECK: %{{.*}} = fir.call @__nv_float2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
176+
! CHECK: %{{.*}} = fir.call @__nv_float2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
177+
! CHECK: %{{.*}} = fir.call @__nv_float2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
178+
! CHECK: %{{.*}} = fir.call @__nv_float2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
179+
165180
attributes(global) subroutine test_ll2float_rX()
166181
real :: res
167182
integer(8) :: i

0 commit comments

Comments
 (0)