Skip to content

Commit 6961139

Browse files
authored
[flang][cuda] Add interfaces for __sinf and __tanf (#153609)
1 parent 28d5bc5 commit 6961139

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

flang/module/cudadevice.f90

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,20 @@ attributes(device) subroutine sincospi(x, y, z) bind(c,name='__nv_sincospi')
392392
end function
393393
end interface
394394

395+
interface __sinf
396+
attributes(device) real function __sinf(r) bind(c, name='__nv_sinf')
397+
!dir$ ignore_tkr (d) r
398+
real, value :: r
399+
end function
400+
end interface
401+
402+
interface __tanf
403+
attributes(device) real function __tanf(r) bind(c, name='__nv_tanf')
404+
!dir$ ignore_tkr (d) r
405+
real, value :: r
406+
end function
407+
end interface
408+
395409
interface
396410
attributes(device) real(4) function cospif(x) bind(c,name='__nv_cospif')
397411
real(4), value :: x

flang/test/Lower/CUDA/cuda-libdevice.cuf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,21 @@ end subroutine
1919

2020
! CHECK-LABEL: _QPtest_usad
2121
! CHECK: %{{.*}} = fir.call @__nv_usad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32, i32) -> i32
22+
23+
attributes(global) subroutine test_sinf()
24+
real :: res
25+
real :: r
26+
res = __sinf(r)
27+
end subroutine
28+
29+
! CHECK-LABEL: _QPtest_sinf
30+
! CHECK: %{{.*}} = fir.call @__nv_sinf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
31+
32+
attributes(global) subroutine test_tanf()
33+
real :: res
34+
real :: r
35+
res = __tanf(r)
36+
end subroutine
37+
38+
! CHECK-LABEL: _QPtest_tanf
39+
! CHECK: %{{.*}} = fir.call @__nv_tanf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32

0 commit comments

Comments
 (0)