diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90 index dc72fc52c7345..ca637a9c2242b 100644 --- a/flang/module/cudadevice.f90 +++ b/flang/module/cudadevice.f90 @@ -743,11 +743,11 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi') end interface interface __ffs - attributes(device) integer function __ffs(i) bind(c) + attributes(device) integer function __ffs(i) bind(c, name='__nv_ffs') !dir$ ignore_tkr (d) i integer, value :: i end function - attributes(device) integer function __ffsll(i) bind(c) + attributes(device) integer function __ffsll(i) bind(c, name='__nv_ffsll') !dir$ ignore_tkr (d) i integer(8), value :: i end function diff --git a/flang/test/Lower/CUDA/cuda-device-proc.cuf b/flang/test/Lower/CUDA/cuda-device-proc.cuf index a8cc5034a9348..8b3bf98579782 100644 --- a/flang/test/Lower/CUDA/cuda-device-proc.cuf +++ b/flang/test/Lower/CUDA/cuda-device-proc.cuf @@ -53,6 +53,8 @@ attributes(global) subroutine devsub() res = __popc(ai) res = __popc(al) + res = __ffs(ai) + res = __ffs(al) end ! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc} @@ -95,6 +97,8 @@ end ! CHECK: %{{.*}} = fir.call @__nv_popc(%{{.*}}) proc_attrs fastmath : (i32) -> i32 ! CHECK: %{{.*}} = fir.call @__nv_popcll(%{{.*}}) proc_attrs fastmath : (i64) -> i32 +! CHECK: %{{.*}} = fir.call @__nv_ffs(%{{.*}}) proc_attrs fastmath : (i32) -> i32 +! CHECK: %{{.*}} = fir.call @__nv_ffsll(%{{.*}}) proc_attrs fastmath : (i64) -> i32 subroutine host1() integer, device :: a(32)