blob: 844bdb954924a1bccb64b6f722fbff76f3e6a99e [file]
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
! Test CUDA Fortran procedures available in cudadevice module
attributes(global) subroutine test_sad()
integer :: res
integer :: i, j, k
res = __sad(i, j, k)
end subroutine
! CHECK-LABEL: _QPtest_sad
! CHECK: %{{.*}} = fir.call @__nv_sad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32, i32) -> i32
attributes(global) subroutine test_usad()
integer :: res
integer :: i, j, k
res = __usad(i, j, k)
end subroutine
! CHECK-LABEL: _QPtest_usad
! CHECK: %{{.*}} = fir.call @__nv_usad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32, i32) -> i32
attributes(global) subroutine test_uint2float_rX()
real :: res
integer :: i
res = __uint2float_rd(i)
res = __uint2float_rn(i)
res = __uint2float_ru(i)
res = __uint2float_rz(i)
end subroutine
! CHECK-LABEL: _QPtest_uint2float_rx
! CHECK: %{{.*}} = fir.call @__nv_uint2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_uint2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_uint2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_uint2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32
attributes(global) subroutine test_uint2double_rn()
double precision :: res
integer :: i
res = __uint2double_rn(i)
end subroutine
! CHECK-LABEL: _QPtest_uint2double_rn
! CHECK: %{{.*}} = fir.call @__nv_uint2double_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f64
attributes(global) subroutine test_ull2dloat_rX()
real :: res
integer(8) :: i
res = __ull2float_rd(i)
res = __ull2float_rn(i)
res = __ull2float_ru(i)
res = __ull2float_rz(i)
end subroutine
! CHECK-LABEL: _QPtest_ull2dloat_rx
! CHECK: %{{.*}} = fir.call @__nv_ull2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
! CHECK: %{{.*}} = fir.call @__nv_ull2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
! CHECK: %{{.*}} = fir.call @__nv_ull2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
! CHECK: %{{.*}} = fir.call @__nv_ull2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32
attributes(global) subroutine test_log()
real :: res
real :: r
res = __logf(r)
res = __log2f(r)
res = __log10f(r)
end subroutine
! CHECK-LABEL: _QPtest_log
! CHECK: %{{.*}} = fir.call @__nv_logf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_log2f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_log10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
attributes(global) subroutine test_sinf()
real :: res
real :: r
res = __sinf(r)
end subroutine
! CHECK-LABEL: _QPtest_sinf
! CHECK: %{{.*}} = fir.call @__nv_sinf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
attributes(global) subroutine test_tanf()
real :: res
real :: r
res = __tanf(r)
end subroutine
! CHECK-LABEL: _QPtest_tanf
! CHECK: %{{.*}} = fir.call @__nv_tanf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
attributes(global) subroutine test_exp()
real :: res
real :: r
res = __expf(r)
res = __exp10f(r)
end subroutine
! CHECK-LABEL: _QPtest_exp
! CHECK: %{{.*}} = fir.call @__nv_expf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_exp10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
attributes(global) subroutine test_double2ll_rX()
integer(8) :: res
double precision :: r
res = __double2ll_rd(r)
res = __double2ll_rn(r)
res = __double2ll_ru(r)
res = __double2ll_rz(r)
end subroutine
! CHECK-LABEL: _QPtest_double2ll_rx
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64