Skip to content

Commit 8061cae

Browse files
authored
[flang][cuda] Add bind name for __float2half_rn and __half2float (#153298)
1 parent da422da commit 8061cae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

flang/test/Lower/CUDA/cuda-device-proc.cuf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
attributes(global) subroutine devsub()
66
implicit none
77
integer :: ret
8+
real(2) :: r2
89
real(4) :: af
910
real(8) :: ad
1011
integer(4) :: ai
@@ -83,6 +84,8 @@ attributes(global) subroutine devsub()
8384
af = __powf(af, af)
8485
ad = __dsqrt_rd(ad)
8586
ad = __dsqrt_ru(ad)
87+
r2 = __float2half_rn(af)
88+
af = __half2float(r2)
8689
end
8790

8891
! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}
@@ -153,6 +156,8 @@ end
153156
! CHECK: %{{.*}} = fir.call @__nv_powf(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32, f32) -> f32
154157
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
155158
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
159+
! CHECK: %{{.*}} = fir.call @__nv_float2half_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f16
160+
! CHECK: %{{.*}} = fir.call @__nv_half2float(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f16) -> f32
156161

157162
subroutine host1()
158163
integer, device :: a(32)

0 commit comments

Comments
 (0)