Skip to content

Commit 20a8299

Browse files
authored
[flang][cuda] Add interfaces for __expf and __exp10f (#153633)
1 parent db98ac4 commit 20a8299

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
@@ -1741,6 +1741,20 @@ attributes(device,host) logical function on_device() bind(c)
17411741
end function
17421742
end interface
17431743

1744+
interface __expf
1745+
attributes(device) real function __expf(r) bind(c, name='__nv_expf')
1746+
!dir$ ignore_tkr (d) r
1747+
real, value :: r
1748+
end function
1749+
end interface
1750+
1751+
interface __exp10f
1752+
attributes(device) real function __exp10f(r) bind(c, name='__nv_exp10f')
1753+
!dir$ ignore_tkr (d) r
1754+
real, value :: r
1755+
end function
1756+
end interface
1757+
17441758
contains
17451759

17461760
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
@@ -89,3 +89,14 @@ end subroutine
8989

9090
! CHECK-LABEL: _QPtest_tanf
9191
! CHECK: %{{.*}} = fir.call @__nv_tanf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
92+
93+
attributes(global) subroutine test_exp()
94+
real :: res
95+
real :: r
96+
res = __expf(r)
97+
res = __exp10f(r)
98+
end subroutine
99+
100+
! CHECK-LABEL: _QPtest_exp
101+
! CHECK: %{{.*}} = fir.call @__nv_expf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
102+
! CHECK: %{{.*}} = fir.call @__nv_exp10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32

0 commit comments

Comments
 (0)