Skip to content

Commit

Permalink
[flang][cuda] Add interface for sinpi, cospi and sincospi (#126123)
Browse files Browse the repository at this point in the history
Add interface for `sinpi`, `cospi` and `sincospi` and also expose
`sincosf`
  • Loading branch information
clementval authored Feb 6, 2025
1 parent 1d319df commit 98752ef
Showing 1 changed file with 52 additions and 4 deletions.
56 changes: 52 additions & 4 deletions flang/module/cudadevice.f90
Original file line number Diff line number Diff line change
Expand Up @@ -384,34 +384,82 @@ attributes(device) integer(4) function signbit(x) bind(c,name='__nv_signbitd')
end function
end interface
public :: signbit
interface sincos

interface
attributes(device) subroutine sincosf(x, y, z) bind(c,name='__nv_sincosf')
real(4), value :: x
real(4), device :: y
real(4), device :: z
end subroutine
end interface
public :: sincosf
interface
attributes(device) subroutine sincos(x, y, z) bind(c,name='__nv_sincos')
real(8), value :: x
real(8), device :: y
real(8), device :: z
end subroutine
end interface
interface sincos
procedure :: sincosf
procedure :: sincos
end interface
public :: sincos
interface sincospi

interface
attributes(device) subroutine sincospif(x, y, z) bind(c,name='__nv_sincospif')
real(4), value :: x
real(4), device :: y
real(4), device :: z
end subroutine
end interface
public :: sincospif
interface
attributes(device) subroutine sincospi(x, y, z) bind(c,name='__nv_sincospi')
real(8), value :: x
real(8), device :: y
real(8), device :: z
end subroutine
end interface
interface sincospi
procedure :: sincospif
procedure :: sincospi
end interface
public :: sincospi

interface
attributes(device) real(4) function cospif(x) bind(c,name='__nv_cospif')
real(4), value :: x
end function
end interface
public :: cospif
interface
attributes(device) real(8) function cospi(x) bind(c,name='__nv_cospi')
real(8), value :: x
end function
end interface
interface cospi
procedure :: cospif
procedure :: cospi
end interface
public :: cospi

interface
attributes(device) real(4) function sinpif(x) bind(c,name='__nv_sinpif')
real(4), value :: x
end function
end interface
public :: sinpif
interface
attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
real(8), value :: x
end function
end interface
interface sinpi
procedure :: sinpif
procedure :: sinpi
end interface
public :: sinpi

interface mulhi
attributes(device) integer function __mulhi(i,j) bind(c,name='__nv_mulhi')
Expand Down

0 comments on commit 98752ef

Please sign in to comment.