Skip to content

Commit 6b09e95

Browse files
authored
[flang][cuda] Add bind name for __fss interface (#152803)
1 parent 7e2cc72 commit 6b09e95

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

flang/module/cudadevice.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,11 +743,11 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
743743
end interface
744744

745745
interface __ffs
746-
attributes(device) integer function __ffs(i) bind(c)
746+
attributes(device) integer function __ffs(i) bind(c, name='__nv_ffs')
747747
!dir$ ignore_tkr (d) i
748748
integer, value :: i
749749
end function
750-
attributes(device) integer function __ffsll(i) bind(c)
750+
attributes(device) integer function __ffsll(i) bind(c, name='__nv_ffsll')
751751
!dir$ ignore_tkr (d) i
752752
integer(8), value :: i
753753
end function

flang/test/Lower/CUDA/cuda-device-proc.cuf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ attributes(global) subroutine devsub()
5353

5454
res = __popc(ai)
5555
res = __popc(al)
56+
res = __ffs(ai)
57+
res = __ffs(al)
5658
end
5759

5860
! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}
@@ -95,6 +97,8 @@ end
9597

9698
! CHECK: %{{.*}} = fir.call @__nv_popc(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
9799
! CHECK: %{{.*}} = fir.call @__nv_popcll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
100+
! CHECK: %{{.*}} = fir.call @__nv_ffs(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
101+
! CHECK: %{{.*}} = fir.call @__nv_ffsll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
98102

99103
subroutine host1()
100104
integer, device :: a(32)

0 commit comments

Comments
 (0)