[flang][cuda] Add interface for __saturatef (#153705)

This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2025-08-14 15:55:17 -07:00 committed by GitHub
parent a629119c75
commit 602f308d4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View File

@ -325,6 +325,13 @@ implicit none
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

View File

@ -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