[flang-commits] [flang] 8061cae - [flang][cuda] Add bind name for __float2half_rn and __half2float (#153298)
via flang-commits
flang-commits at lists.llvm.org
Wed Aug 13 14:12:31 PDT 2025
Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-08-13T21:12:27Z
New Revision: 8061cae756aecf0da689ba31e0e14bf2b37b5e7f
URL: https://github.com/llvm/llvm-project/commit/8061cae756aecf0da689ba31e0e14bf2b37b5e7f
DIFF: https://github.com/llvm/llvm-project/commit/8061cae756aecf0da689ba31e0e14bf2b37b5e7f.diff
LOG: [flang][cuda] Add bind name for __float2half_rn and __half2float (#153298)
Added:
Modified:
flang/test/Lower/CUDA/cuda-device-proc.cuf
Removed:
################################################################################
diff --git a/flang/test/Lower/CUDA/cuda-device-proc.cuf b/flang/test/Lower/CUDA/cuda-device-proc.cuf
index f9ec0c773fe80..7957e8b5b0be0 100644
--- a/flang/test/Lower/CUDA/cuda-device-proc.cuf
+++ b/flang/test/Lower/CUDA/cuda-device-proc.cuf
@@ -5,6 +5,7 @@
attributes(global) subroutine devsub()
implicit none
integer :: ret
+ real(2) :: r2
real(4) :: af
real(8) :: ad
integer(4) :: ai
@@ -83,6 +84,8 @@ attributes(global) subroutine devsub()
af = __powf(af, af)
ad = __dsqrt_rd(ad)
ad = __dsqrt_ru(ad)
+ r2 = __float2half_rn(af)
+ af = __half2float(r2)
end
! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}
@@ -153,6 +156,8 @@ end
! CHECK: %{{.*}} = fir.call @__nv_powf(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32, f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
+! CHECK: %{{.*}} = fir.call @__nv_float2half_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f16
+! CHECK: %{{.*}} = fir.call @__nv_half2float(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f16) -> f32
subroutine host1()
integer, device :: a(32)
More information about the flang-commits
mailing list