Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions flang/module/cudadevice.f90
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ attributes(device) real(8) function rsqrt(x) bind(c,name='__nv_rsqrt')
end function
end interface

interface saturate
attributes(device) real function __saturatef(r) bind(c, name='__nv_saturatef')
!dir$ ignore_tkr (d) r
real, value :: r
end function
end interface

interface __sad
attributes(device) integer function __sad(i,j,k) bind(c, name='__nv_sad')
!dir$ ignore_tkr (d) i, (d) j, (d) k
Expand Down
9 changes: 9 additions & 0 deletions flang/test/Lower/CUDA/cuda-libdevice.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ end subroutine
! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64

attributes(global) subroutine test_saturatef()
real :: res
real :: r
res = __saturatef(r)
end subroutine

! CHECK-LABEL: _QPtest_saturatef
! CHECK: %{{.*}} = fir.call @__nv_saturatef(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32

attributes(global) subroutine test_float2ll_rX()
integer(8) :: res
real :: r
Expand Down
Loading