Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions flang/module/cudadevice.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,20 @@ attributes(device) subroutine threadfence_system()
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 changes: 17 additions & 0 deletions flang/test/Lower/CUDA/cuda-intrinsic.cuf
Original file line number Diff line number Diff line change
@@ -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