[flang-commits] [flang] [flang][cuda] Add interfaces for __float2ll_rX (PR #153702)
via flang-commits
flang-commits at lists.llvm.org
Thu Aug 14 15:20:08 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Valentin Clement (バレンタイン クレメン) (clementval)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/153702.diff
2 Files Affected:
- (modified) flang/module/cudadevice.f90 (+28)
- (modified) flang/test/Lower/CUDA/cuda-libdevice.cuf (+15)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/153702
More information about the flang-commits
mailing list