Skip to content

Commit 09505b1

Browse files
authored
[flang][cuda] Add missing interface for __cosf (#153306)
`__cosf` is mentioned to be supported here: https://docs.nvidia.com/hpc-sdk/compilers/cuda-fortran-prog-guide/index.html#fortran-device-modules Add the missing interface with a bind c name linking it to `__nv_cosf`
1 parent 04eb5e0 commit 09505b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ attributes(global) subroutine devsub()
5959
res = __brev(ai)
6060
resl = __brev(al)
6161
res = __clz(ai)
62-
res = __clz(al)
62+
res = __clz(al)
63+
af = __cosf(af)
6364
ai = __mul24(ai, ai)
6465
ai = __umul24(ai, ai)
6566
end
@@ -110,11 +111,10 @@ end
110111
! CHECK: %{{.*}} = fir.call @__nv_brevll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i64
111112
! CHECK: %{{.*}} = fir.call @__nv_clz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
112113
! CHECK: %{{.*}} = fir.call @__nv_clzll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
113-
114+
! CHECK: %{{.*}} = fir.call @__nv_cosf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
114115
! CHECK: %{{.*}} = fir.call @__nv_mul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
115116
! CHECK: %{{.*}} = fir.call @__nv_umul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
116117

117-
118118
subroutine host1()
119119
integer, device :: a(32)
120120
integer, device :: ret

0 commit comments

Comments
 (0)