mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 08:06:40 +00:00
[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:
parent
82aac16ddd
commit
df808df8f7
@ -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
|
||||
|
17
flang/test/Lower/CUDA/cuda-intrinsic.cuf
Normal file
17
flang/test/Lower/CUDA/cuda-intrinsic.cuf
Normal 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
|
Loading…
x
Reference in New Issue
Block a user