[flang-commits] [flang] [flang][cuda] Add interfaces for __float2ll_rX (PR #153702)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Thu Aug 14 15:44:48 PDT 2025
https://github.com/clementval updated https://github.com/llvm/llvm-project/pull/153702
>From c95dfbf4bdca31520670a555fa07dbbd31b3d730 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Thu, 14 Aug 2025 15:19:07 -0700
Subject: [PATCH] [flang][cuda] Add interfaces for __float2ll_rX
---
flang/module/cudadevice.f90 | 28 ++++++++++++++++++++++++
flang/test/Lower/CUDA/cuda-libdevice.cuf | 15 +++++++++++++
2 files changed, 43 insertions(+)
diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index a8b1d19a4c1ff..7d18985aca743 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -471,6 +471,34 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
end function
end interface
+ interface __float2ll_rd
+ attributes(device) integer(8) function __float2ll_rd(r) bind(c, name='__nv_float2ll_rd')
+ !dir$ ignore_tkr (d) r
+ real, value :: r
+ end function
+ end interface
+
+ interface __float2ll_rn
+ attributes(device) integer(8) function __float2ll_rn(r) bind(c, name='__nv_float2ll_rn')
+ !dir$ ignore_tkr (d) r
+ real, value :: r
+ end function
+ end interface
+
+ interface __float2ll_ru
+ attributes(device) integer(8) function __float2ll_ru(r) bind(c, name='__nv_float2ll_ru')
+ !dir$ ignore_tkr (d) r
+ real, value :: r
+ end function
+ end interface
+
+ interface __float2ll_rz
+ attributes(device) integer(8) function __float2ll_rz(r) bind(c, name='__nv_float2ll_rz')
+ !dir$ ignore_tkr (d) r
+ real, value :: r
+ end function
+ end interface
+
interface __half2float
attributes(device) real function __half2float(i) bind(c, name='__nv_half2float')
!dir$ ignore_tkr (d) i
diff --git a/flang/test/Lower/CUDA/cuda-libdevice.cuf b/flang/test/Lower/CUDA/cuda-libdevice.cuf
index 447e09cad747b..072c664fae458 100644
--- a/flang/test/Lower/CUDA/cuda-libdevice.cuf
+++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf
@@ -161,3 +161,18 @@ end subroutine
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
+
+attributes(global) subroutine test_float2ll_rX()
+ integer(8) :: res
+ real :: r
+ res = __float2ll_rd(r)
+ res = __float2ll_rn(r)
+ res = __float2ll_ru(r)
+ res = __float2ll_rz(r)
+end subroutine
+
+! CHECK-LABEL: _QPtest_float2ll_rx
+! CHECK: %{{.*}} = fir.call @__nv_float2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
+! CHECK: %{{.*}} = fir.call @__nv_float2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
+! CHECK: %{{.*}} = fir.call @__nv_float2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
+! CHECK: %{{.*}} = fir.call @__nv_float2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64
More information about the flang-commits
mailing list