[flang-commits] [flang] 2ae4e95 - [flang][cuda] Add bind name for __ddiv_XX interfaces (#153271)
via flang-commits
flang-commits at lists.llvm.org
Tue Aug 12 23:30:46 PDT 2025
Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-08-12T23:30:43-07:00
New Revision: 2ae4e95dda5d9aebe888acd5c5d618fb3b45c7c6
URL: https://github.com/llvm/llvm-project/commit/2ae4e95dda5d9aebe888acd5c5d618fb3b45c7c6
DIFF: https://github.com/llvm/llvm-project/commit/2ae4e95dda5d9aebe888acd5c5d618fb3b45c7c6.diff
LOG: [flang][cuda] Add bind name for __ddiv_XX interfaces (#153271)
Added:
Modified:
flang/module/cudadevice.f90
flang/test/Lower/CUDA/cuda-device-proc.cuf
Removed:
################################################################################
diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index f7b7d856ecb90..82571704032f0 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -710,28 +710,28 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
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
diff --git a/flang/test/Lower/CUDA/cuda-device-proc.cuf b/flang/test/Lower/CUDA/cuda-device-proc.cuf
index 6c56f8616c404..ae336445532b9 100644
--- a/flang/test/Lower/CUDA/cuda-device-proc.cuf
+++ b/flang/test/Lower/CUDA/cuda-device-proc.cuf
@@ -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
More information about the flang-commits
mailing list