From 98752ef893eba2bfda99ba99cc07026f00c8273f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Thu, 6 Feb 2025 13:12:41 -0800 Subject: [PATCH] [flang][cuda] Add interface for sinpi, cospi and sincospi (#126123) Add interface for `sinpi`, `cospi` and `sincospi` and also expose `sincosf` --- flang/module/cudadevice.f90 | 56 ++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90 index 1fe99b30b1db..47526bccd98f 100644 --- a/flang/module/cudadevice.f90 +++ b/flang/module/cudadevice.f90 @@ -384,34 +384,82 @@ implicit none 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')