[flang-commits] [flang] bad3df4 - [flang][cuda] Add bind names for __double2ll_rX interfaces (#153660)

via flang-commits flang-commits at lists.llvm.org
Thu Aug 14 13:34:28 PDT 2025


Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-08-14T13:34:25-07:00
New Revision: bad3df476457db2fd7dd36729c47fb1d2bddad3a

URL: https://github.com/llvm/llvm-project/commit/bad3df476457db2fd7dd36729c47fb1d2bddad3a
DIFF: https://github.com/llvm/llvm-project/commit/bad3df476457db2fd7dd36729c47fb1d2bddad3a.diff

LOG: [flang][cuda] Add bind names for __double2ll_rX interfaces (#153660)

Added: 
    

Modified: 
    flang/module/cudadevice.f90
    flang/test/Lower/CUDA/cuda-libdevice.cuf

Removed: 
    


################################################################################
diff  --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index 432125097e9d2..1e403b1ffdb91 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -625,29 +625,29 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
     end function
   end interface
 
-  interface __double2ll_rn
-    attributes(device) integer(8) function __double2ll_rn(r) bind(c)
+  interface __double2ll_rd
+    attributes(device) integer(8) function __double2ll_rd(r) bind(c, name='__nv_double2ll_rd')
       !dir$ ignore_tkr (d) r
       double precision, value :: r
     end function
   end interface
 
-  interface __double2ll_rz
-    attributes(device) integer(8) function __double2ll_rz(r) bind(c)
+  interface __double2ll_rn
+    attributes(device) integer(8) function __double2ll_rn(r) bind(c, name='__nv_double2ll_rn')
       !dir$ ignore_tkr (d) r
       double precision, value :: r
     end function
   end interface
 
   interface __double2ll_ru
-    attributes(device) integer(8) function __double2ll_ru(r) bind(c)
+    attributes(device) integer(8) function __double2ll_ru(r) bind(c, name='__nv_double2ll_ru')
       !dir$ ignore_tkr (d) r
       double precision, value :: r
     end function
   end interface
 
-  interface __double2ll_rd
-    attributes(device) integer(8) function __double2ll_rd(r) bind(c)
+  interface __double2ll_rz
+    attributes(device) integer(8) function __double2ll_rz(r) bind(c, name='__nv_double2ll_rz')
       !dir$ ignore_tkr (d) r
       double precision, value :: r
     end function

diff  --git a/flang/test/Lower/CUDA/cuda-libdevice.cuf b/flang/test/Lower/CUDA/cuda-libdevice.cuf
index 6b80fb2e74146..844bdb954924a 100644
--- a/flang/test/Lower/CUDA/cuda-libdevice.cuf
+++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf
@@ -100,3 +100,18 @@ end subroutine
 ! CHECK-LABEL: _QPtest_exp
 ! CHECK: %{{.*}} = fir.call @__nv_expf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
 ! CHECK: %{{.*}} = fir.call @__nv_exp10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
+
+attributes(global) subroutine test_double2ll_rX()
+  integer(8) :: res
+  double precision :: r
+  res = __double2ll_rd(r)
+  res = __double2ll_rn(r)
+  res = __double2ll_ru(r)
+  res = __double2ll_rz(r)
+end subroutine
+
+! CHECK-LABEL: _QPtest_double2ll_rx
+! CHECK: %{{.*}} = fir.call @__nv_double2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
+! CHECK: %{{.*}} = fir.call @__nv_double2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
+! CHECK: %{{.*}} = fir.call @__nv_double2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
+! CHECK: %{{.*}} = fir.call @__nv_double2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64


        


More information about the flang-commits mailing list