[flang][cuda] Add bind name for __double2float_XX interfaces (#153275)

This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2025-08-13 10:49:32 -07:00 committed by GitHub
parent 1f04b15c56
commit 6ae6c4fa4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -507,28 +507,28 @@ implicit none
end interface
interface __double2float_rn
attributes(device) real function __double2float_rn(r) bind(c)
attributes(device) real function __double2float_rn(r) bind(c, name='__nv_double2float_rn')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface
interface __double2float_rz
attributes(device) real function __double2float_rz(r) bind(c)
attributes(device) real function __double2float_rz(r) bind(c, name='__nv_double2float_rz')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface
interface __double2float_ru
attributes(device) real function __double2float_ru(r) bind(c)
attributes(device) real function __double2float_ru(r) bind(c, name='__nv_double2float_ru')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface
interface __double2float_rd
attributes(device) real function __double2float_rd(r) bind(c)
attributes(device) real function __double2float_rd(r) bind(c, name='__nv_double2float_rd')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function

View File

@ -65,10 +65,13 @@ attributes(global) subroutine devsub()
ad = __ddiv_rz(ad, ad)
ad = __ddiv_ru(ad, ad)
ad = __ddiv_rd(ad, ad)
af = __double2float_rn(ad)
af = __double2float_rz(ad)
af = __double2float_ru(ad)
af = __double2float_rd(ad)
ai = __mul24(ai, ai)
ai = __umul24(ai, ai)
af = __powf(af, af)
end
! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}
@ -122,6 +125,10 @@ end
! CHECK: %{{.*}} = fir.call @__nv_ddiv_rz(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64, f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_ddiv_ru(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64, f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_ddiv_rd(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64, f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_double2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f32
! CHECK: %{{.*}} = fir.call @__nv_double2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f32
! CHECK: %{{.*}} = fir.call @__nv_double2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f32
! CHECK: %{{.*}} = fir.call @__nv_double2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f32
! CHECK: %{{.*}} = fir.call @__nv_mul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
! CHECK: %{{.*}} = fir.call @__nv_umul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
! CHECK: %{{.*}} = fir.call @__nv_powf(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32, f32) -> f32