[flang][cuda] Add bind name for __ddiv_XX interfaces (#153271)

This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2025-08-12 23:30:43 -07:00 committed by GitHub
parent 60170f92a3
commit 2ae4e95dda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 4 deletions

View File

@ -710,28 +710,28 @@ implicit none
end interface
interface __ddiv_rn
attributes(device) double precision function __ddiv_rn(x,y) bind(c)
attributes(device) double precision function __ddiv_rn(x,y) bind(c, name='__nv_ddiv_rn')
!dir$ ignore_tkr (d) x, (d) y
double precision, value :: x, y
end function
end interface
interface __ddiv_rz
attributes(device) double precision function __ddiv_rz(x,y) bind(c)
attributes(device) double precision function __ddiv_rz(x,y) bind(c, name='__nv_ddiv_rz')
!dir$ ignore_tkr (d) x, (d) y
double precision, value :: x, y
end function
end interface
interface __ddiv_ru
attributes(device) double precision function __ddiv_ru(x,y) bind(c)
attributes(device) double precision function __ddiv_ru(x,y) bind(c, name='__nv_ddiv_ru')
!dir$ ignore_tkr (d) x, (d) y
double precision, value :: x, y
end function
end interface
interface __ddiv_rd
attributes(device) double precision function __ddiv_rd(x,y) bind(c)
attributes(device) double precision function __ddiv_rd(x,y) bind(c, name='__nv_ddiv_rd')
!dir$ ignore_tkr (d) x, (d) y
double precision, value :: x, y
end function

View File

@ -61,9 +61,14 @@ attributes(global) subroutine devsub()
res = __clz(ai)
res = __clz(al)
af = __cosf(af)
ad = __ddiv_rn(ad, ad)
ad = __ddiv_rz(ad, ad)
ad = __ddiv_ru(ad, ad)
ad = __ddiv_rd(ad, 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>}
@ -113,6 +118,10 @@ end
! CHECK: %{{.*}} = fir.call @__nv_clz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
! CHECK: %{{.*}} = fir.call @__nv_clzll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
! CHECK: %{{.*}} = fir.call @__nv_cosf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_ddiv_rn(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64, f64) -> f64
! 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_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