diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90 index d815b30923cfc..65c703df0a905 100644 --- a/flang/module/cudadevice.f90 +++ b/flang/module/cudadevice.f90 @@ -399,6 +399,13 @@ attributes(device) subroutine sincospi(x, y, z) bind(c,name='__nv_sincospi') end function end interface + interface __fdividef + attributes(device) real function __fdividef(r,d) bind(c, name='__nv_fast_fdividef') + !dir$ ignore_tkr (d) r, (d) d + real, value :: r,d + end function + end interface + interface __sinf attributes(device) real function __sinf(r) bind(c, name='__nv_sinf') !dir$ ignore_tkr (d) r diff --git a/flang/test/Lower/CUDA/cuda-libdevice.cuf b/flang/test/Lower/CUDA/cuda-libdevice.cuf index ae5fdd3b50678..7bb2ab065316a 100644 --- a/flang/test/Lower/CUDA/cuda-libdevice.cuf +++ b/flang/test/Lower/CUDA/cuda-libdevice.cuf @@ -245,6 +245,15 @@ end subroutine ! CHECK: %{{.*}} = fir.call @__nv_float2uint_ru(%{{.*}}) proc_attrs fastmath : (f32) -> i32 ! CHECK: %{{.*}} = fir.call @__nv_float2uint_rz(%{{.*}}) proc_attrs fastmath : (f32) -> i32 +attributes(global) subroutine test_fdividef() + real :: res + real :: r + res = __fdividef(r, r) +end subroutine + +! CHECK-LABEL: _QPtest_fdividef +! CHECK: %{{.*}} = fir.call @__nv_fast_fdividef(%{{.*}}, %{{.*}}) proc_attrs fastmath : (f32, f32) -> f32 + attributes(global) subroutine test_double_as_longlong() integer(8) :: res real(8) :: r