[flang][cuda] Add bind(c) interfaces for __fadd_rd and __fadd_ru (#122535)

Function like `__fadd_rd ` and `__fadd_ru ` need to be converted to the
cuda equivalent.
This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2025-01-10 19:15:02 -08:00 committed by GitHub
parent 82aac16ddd
commit df808df8f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 0 deletions

View File

@ -71,4 +71,20 @@ implicit none
end interface
public :: threadfence_system
interface
attributes(device) function __fadd_rd(x, y) bind(c, name='__nv_fadd_rd')
real, intent(in) :: x, y
real :: __fadd_rd
end function
end interface
public :: __fadd_rd
interface
attributes(device) function __fadd_ru(x, y) bind(c, name='__nv_fadd_ru')
real, intent(in) :: x, y
real :: __fadd_ru
end function
end interface
public :: __fadd_ru
end module

View File

@ -0,0 +1,17 @@
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
module mod1
type int
real :: inf, sup
end type int
contains
attributes(global) subroutine fadd(c, a, b)
type (int) :: c, a, b
c%inf = __fadd_rd(a%inf, b%inf)
c%sup = __fadd_ru(a%sup, b%sup)
end subroutine
end
! CHECK-LABEL: func.func @_QMmod1Pfadd
! CHECK: fir.call @__nv_fadd_rd
! CHECK: fir.call @__nv_fadd_ru