Skip to content

Commit 0e4af72

Browse files
authored
[flang][cuda] Add interface for __fdividef (#153742)
1 parent 0e8c964 commit 0e4af72

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

flang/module/cudadevice.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,13 @@ attributes(device) subroutine sincospi(x, y, z) bind(c,name='__nv_sincospi')
399399
end function
400400
end interface
401401

402+
interface __fdividef
403+
attributes(device) real function __fdividef(r,d) bind(c, name='__nv_fast_fdividef')
404+
!dir$ ignore_tkr (d) r, (d) d
405+
real, value :: r,d
406+
end function
407+
end interface
408+
402409
interface __sinf
403410
attributes(device) real function __sinf(r) bind(c, name='__nv_sinf')
404411
!dir$ ignore_tkr (d) r

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,15 @@ end subroutine
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
247247

248+
attributes(global) subroutine test_fdividef()
249+
real :: res
250+
real :: r
251+
res = __fdividef(r, r)
252+
end subroutine
253+
254+
! CHECK-LABEL: _QPtest_fdividef
255+
! CHECK: %{{.*}} = fir.call @__nv_fast_fdividef(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32, f32) -> f32
256+
248257
attributes(global) subroutine test_double_as_longlong()
249258
integer(8) :: res
250259
real(8) :: r

0 commit comments

Comments
 (0)