[flang-commits] [flang] 583499a - [flang][cuda] Add missing bind name for __hiloint2double, __double2loint and __double2hiint (#153713)
via flang-commits
flang-commits at lists.llvm.org
Fri Aug 15 09:33:02 PDT 2025
Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-08-15T09:32:59-07:00
New Revision: 583499a8cf1df76a5439958ffc95d9c04808bcfc
URL: https://github.com/llvm/llvm-project/commit/583499a8cf1df76a5439958ffc95d9c04808bcfc
DIFF: https://github.com/llvm/llvm-project/commit/583499a8cf1df76a5439958ffc95d9c04808bcfc.diff
LOG: [flang][cuda] Add missing bind name for __hiloint2double, __double2loint and __double2hiint (#153713)
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 ffc3a3b170ca6..e6e818bdd5249 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -654,21 +654,21 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
end interface
interface __double2loint
- attributes(device) integer function __double2loint(r) bind(c)
+ attributes(device) integer function __double2loint(r) bind(c, name='__nv_double2loint')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface
interface __double2hiint
- attributes(device) integer function __double2hiint(r) bind(c)
+ attributes(device) integer function __double2hiint(r) bind(c, name='__nv_double2hiint')
!dir$ ignore_tkr (d) r
double precision, value :: r
end function
end interface
interface __hiloint2double
- attributes(device) double precision function __hiloint2double(i, j) bind(c)
+ attributes(device) double precision function __hiloint2double(i, j) bind(c, name='__nv_hiloint2double')
!dir$ ignore_tkr (d) i, (d) j
integer, value :: i, j
end function
diff --git a/flang/test/Lower/CUDA/cuda-libdevice.cuf b/flang/test/Lower/CUDA/cuda-libdevice.cuf
index f9c5dcc5fc4c3..ecc05e79b1cd7 100644
--- a/flang/test/Lower/CUDA/cuda-libdevice.cuf
+++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf
@@ -244,3 +244,30 @@ 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_double2loint()
+ integer :: res
+ double precision :: r
+ res = __double2loint(r)
+end subroutine
+
+! CHECK-LABEL: _QPtest_double2loint
+! CHECK: %{{.*}} = fir.call @__nv_double2loint(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i32
+
+attributes(global) subroutine test_double2hiint()
+ integer :: res
+ double precision :: r
+ res = __double2hiint(r)
+end subroutine
+
+! CHECK-LABEL: _QPtest_double2hiint
+! CHECK: %{{.*}} = fir.call @__nv_double2hiint(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i32
+
+attributes(global) subroutine test_hiloint2double()
+ double precision :: res
+ integer :: i, j
+ res = __hiloint2double(i, j)
+end subroutine
+
+! CHECK-LABEL: _QPtest_hiloint2double
+! CHECK: %{{.*}} = fir.call @__nv_hiloint2double(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> f64
More information about the flang-commits
mailing list