Skip to content

Commit 2e6b876

Browse files
committed
[flang][cuda] Add interfaces for __expf and __exp10f
1 parent dc0becc commit 2e6b876

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

flang/module/cudadevice.f90

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,20 @@ attributes(device,host) logical function on_device() bind(c)
17131713
end function
17141714
end interface
17151715

1716+
interface __expf
1717+
attributes(device) real function __expf(r) bind(c, name='__nv_expf')
1718+
!dir$ ignore_tkr (d) r
1719+
real, value :: r
1720+
end function
1721+
end interface
1722+
1723+
interface __exp10f
1724+
attributes(device) real function __exp10f(r) bind(c, name='__nv_exp10f')
1725+
!dir$ ignore_tkr (d) r
1726+
real, value :: r
1727+
end function
1728+
end interface
1729+
17161730
contains
17171731

17181732
attributes(device) subroutine syncthreads()

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,14 @@ end subroutine
6565

6666
! CHECK-LABEL: _QPtest_tanf
6767
! CHECK: %{{.*}} = fir.call @__nv_tanf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
68+
69+
attributes(global) subroutine test_exp()
70+
real :: res
71+
real :: r
72+
res = __expf(r)
73+
res = __exp10f(r)
74+
end subroutine
75+
76+
! CHECK-LABEL: _QPtest_exp
77+
! CHECK: %{{.*}} = fir.call @__nv_expf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
78+
! CHECK: %{{.*}} = fir.call @__nv_exp10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32

0 commit comments

Comments
 (0)