Skip to content

Conversation

@clementval
Copy link
Contributor

No description provided.

@clementval clementval requested a review from wangzpgi August 15, 2025 00:41
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Aug 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-flang-fir-hlfir

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/153720.diff

2 Files Affected:

  • (modified) flang/module/cudadevice.f90 (+1-1)
  • (modified) flang/test/Lower/CUDA/cuda-libdevice.cuf (+9)
diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index ffc3a3b170ca6..5d6fd2e27d911 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -703,7 +703,7 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
   end interface
 
   interface __int2double_rn
-    attributes(device) double precision function __int2double_rn(i) bind(c)
+    attributes(device) double precision function __int2double_rn(i) bind(c, name='__nv_int2double_rn')
       !dir$ ignore_tkr (d) i
       integer, value :: i
     end function
diff --git a/flang/test/Lower/CUDA/cuda-libdevice.cuf b/flang/test/Lower/CUDA/cuda-libdevice.cuf
index f9c5dcc5fc4c3..2dcb4ac4b4f42 100644
--- a/flang/test/Lower/CUDA/cuda-libdevice.cuf
+++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf
@@ -244,3 +244,12 @@ end subroutine
 ! CHECK: %{{.*}} = fir.call @__nv_float2uint_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32
 ! CHECK: %{{.*}} = fir.call @__nv_float2uint_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32
 ! CHECK: %{{.*}} = fir.call @__nv_float2uint_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32
+
+attributes(global) subroutine test_int2double_rn()
+  double precision :: res
+  integer :: r
+  res = __int2double_rn(r)
+end subroutine
+
+! CHECK-LABEL: _QPtest_int2double_rn
+! CHECK: %{{.*}} = fir.call @__nv_int2double_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f64

@clementval clementval merged commit 115f816 into llvm:main Aug 15, 2025
5 of 9 checks passed
@clementval clementval deleted the cuf__int2double_rn branch August 15, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:fir-hlfir flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants