Skip to content

Commit 12400a9

Browse files
authored
[flang][cuda] Add bind name for __brev interface (#152806)
1 parent 3a68286 commit 12400a9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

flang/module/cudadevice.f90

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

767767
interface __brev
768-
attributes(device) integer function __brev(i) bind(c)
768+
attributes(device) integer function __brev(i) bind(c, name='__nv_brev')
769769
!dir$ ignore_tkr (d) i
770770
integer, value :: i
771771
end function
772-
attributes(device) integer(8) function __brevll(i) bind(c)
772+
attributes(device) integer(8) function __brevll(i) bind(c, name ='__nv_brevll')
773773
!dir$ ignore_tkr (d) i
774774
integer(8), value :: i
775775
end function

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ attributes(global) subroutine devsub()
1212
integer(8) :: time
1313
integer :: smalltime
1414
integer(4) :: res
15+
integer(8) :: resl
1516

1617
call syncthreads()
1718
call syncwarp(1)
@@ -55,6 +56,8 @@ attributes(global) subroutine devsub()
5556
res = __popc(al)
5657
res = __ffs(ai)
5758
res = __ffs(al)
59+
res = __brev(ai)
60+
resl = __brev(al)
5861
end
5962

6063
! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}
@@ -99,6 +102,8 @@ end
99102
! CHECK: %{{.*}} = fir.call @__nv_popcll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
100103
! CHECK: %{{.*}} = fir.call @__nv_ffs(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
101104
! CHECK: %{{.*}} = fir.call @__nv_ffsll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
105+
! CHECK: %{{.*}} = fir.call @__nv_brev(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
106+
! CHECK: %{{.*}} = fir.call @__nv_brevll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i64
102107

103108
subroutine host1()
104109
integer, device :: a(32)

0 commit comments

Comments
 (0)