[flang-commits] [flang] 2775c79 - [flang][cuda] Add interfaces for __float2ll_rX (#153702)

via flang-commits flang-commits at lists.llvm.org
Thu Aug 14 15:44:55 PDT 2025


Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-08-14T15:44:52-07:00
New Revision: 2775c79c4fd06b4654a664c5182d9eb86f3e72c1

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

LOG: [flang][cuda] Add interfaces for __float2ll_rX (#153702)

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 ac97a5d27dbd2..b5a92c63f19ed 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 c381485ec1761..68fd443d39f57 100644
--- a/flang/test/Lower/CUDA/cuda-libdevice.cuf
+++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf
@@ -162,6 +162,21 @@ end subroutine
 ! 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
+
 attributes(global) subroutine test_ll2float_rX()
   real :: res
   integer(8) :: i


        


More information about the flang-commits mailing list