brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.5 KiB · d243c49 Raw
336 lines · plain
1! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s2 3! Test CUDA Fortran procedures available in cudadevice module4 5attributes(global) subroutine test_sad()6  integer :: res7  integer :: i, j, k8  res = __sad(i, j, k)9end subroutine10 11! CHECK-LABEL: _QPtest_sad12! CHECK: %{{.*}} = fir.call @__nv_sad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32, i32) -> i3213 14attributes(global) subroutine test_usad()15  integer :: res16  integer :: i, j, k17  res = __usad(i, j, k)18end subroutine19 20! CHECK-LABEL: _QPtest_usad21! CHECK: %{{.*}} = fir.call @__nv_usad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32, i32) -> i3222 23attributes(global) subroutine test_dsqrt_rX()24  double precision :: res25  double precision :: p26  res = __dsqrt_rd(p)27  res = __dsqrt_rn(p)28  res = __dsqrt_ru(p)29  res = __dsqrt_rz(p)30end subroutine31 32! CHECK-LABEL: _QPtest_dsqrt_rx33! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f6434! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f6435! CHECK: %{{.*}} = fir.call @__nv_dsqrt_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f6436! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f6437 38attributes(global) subroutine test_uint2float_rX()39  real :: res40  integer :: i41  res = __uint2float_rd(i)42  res = __uint2float_rn(i)43  res = __uint2float_ru(i)44  res = __uint2float_rz(i)45end subroutine46 47! CHECK-LABEL: _QPtest_uint2float_rx48! CHECK: %{{.*}} = fir.call @__nv_uint2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f3249! CHECK: %{{.*}} = fir.call @__nv_uint2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f3250! CHECK: %{{.*}} = fir.call @__nv_uint2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f3251! CHECK: %{{.*}} = fir.call @__nv_uint2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f3252 53attributes(global) subroutine test_uint2double_rn()54  double precision :: res55  integer :: i56  res = __uint2double_rn(i)57end subroutine58 59! CHECK-LABEL: _QPtest_uint2double_rn60! CHECK: %{{.*}} = fir.call @__nv_uint2double_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f6461 62attributes(global) subroutine test_ull2dloat_rX()63  real :: res64  integer(8) :: i65  res = __ull2float_rd(i)66  res = __ull2float_rn(i)67  res = __ull2float_ru(i)68  res = __ull2float_rz(i)69end subroutine70 71! CHECK-LABEL: _QPtest_ull2dloat_rx72! CHECK: %{{.*}} = fir.call @__nv_ull2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f3273! CHECK: %{{.*}} = fir.call @__nv_ull2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f3274! CHECK: %{{.*}} = fir.call @__nv_ull2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f3275! CHECK: %{{.*}} = fir.call @__nv_ull2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f3276 77attributes(global) subroutine test_log()78  real :: res79  real :: r80  res = __logf(r)81  res = __log2f(r)82  res = __log10f(r)83end subroutine84 85! CHECK-LABEL: _QPtest_log86! CHECK: %{{.*}} = fir.call @__nv_fast_logf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f3287! CHECK: %{{.*}} = fir.call @__nv_fast_log2f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f3288! CHECK: %{{.*}} = fir.call @__nv_fast_log10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f3289 90attributes(global) subroutine test_sincosf()91  real :: r, s, c92  call __sincosf(r, s, c)93end subroutine94 95! CHECK-LABEL: _QPtest_sincosf96! CHECK: fir.call @__nv_fast_sincosf(%{{.*}}, %{{.*}}#0, %{{.*}}#0) proc_attrs<bind_c> fastmath<contract> : (f32, !fir.ref<f32>, !fir.ref<f32>) -> () 97 98attributes(global) subroutine test_sinf()99  real :: res100  real :: r101  res = __sinf(r)102end subroutine103 104! CHECK-LABEL: _QPtest_sinf105! CHECK: %{{.*}} = fir.call @__nv_fast_sinf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32106 107attributes(global) subroutine test_tanf()108  real :: res109  real :: r110  res = __tanf(r)111end subroutine112 113! CHECK-LABEL: _QPtest_tanf114! CHECK: %{{.*}} = fir.call @__nv_fast_tanf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32115 116attributes(global) subroutine test_exp()117  real :: res118  real :: r119  res = __expf(r)120  res = __exp10f(r)121end subroutine122 123! CHECK-LABEL: _QPtest_exp124! CHECK: %{{.*}} = fir.call @__nv_fast_expf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32125! CHECK: %{{.*}} = fir.call @__nv_fast_exp10f(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32126 127attributes(global) subroutine test_double2ll_rX()128  integer(8) :: res129  double precision :: r130  res = __double2ll_rd(r)131  res = __double2ll_rn(r)132  res = __double2ll_ru(r)133  res = __double2ll_rz(r)134end subroutine135 136! CHECK-LABEL: _QPtest_double2ll_rx137! CHECK: %{{.*}} = fir.call @__nv_double2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64138! CHECK: %{{.*}} = fir.call @__nv_double2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64139! CHECK: %{{.*}} = fir.call @__nv_double2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64140! CHECK: %{{.*}} = fir.call @__nv_double2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64141 142attributes(global) subroutine test_drcp_rX()143  double precision :: res144  double precision :: r145  res = __drcp_rd(r)146  res = __drcp_rn(r)147  res = __drcp_ru(r)148  res = __drcp_rz(r)149end subroutine150 151! CHECK-LABEL: _QPtest_drcp_rx152! CHECK: %{{.*}} = fir.call @__nv_drcp_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64153! CHECK: %{{.*}} = fir.call @__nv_drcp_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64154! CHECK: %{{.*}} = fir.call @__nv_drcp_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64155! CHECK: %{{.*}} = fir.call @__nv_drcp_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64156 157attributes(global) subroutine test_double2ull_rX()158  integer(8) :: res159  double precision :: r160  res = __double2ull_rd(r)161  res = __double2ull_rn(r)162  res = __double2ull_ru(r)163  res = __double2ull_rz(r)164end subroutine165 166! CHECK-LABEL: _QPtest_double2ull_rx167! CHECK: %{{.*}} = fir.call @__nv_double2ull_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64168! CHECK: %{{.*}} = fir.call @__nv_double2ull_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64169! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64170! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64171 172attributes(global) subroutine test_saturatef()173  real :: res174  real :: r175  res = __saturatef(r)176end subroutine177 178! CHECK-LABEL: _QPtest_saturatef179! CHECK: %{{.*}} = fir.call @__nv_saturatef(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32180 181attributes(global) subroutine test_float2ll_rX()182  integer(8) :: res183  real :: r184  res = __float2ll_rd(r)185  res = __float2ll_rn(r)186  res = __float2ll_ru(r)187  res = __float2ll_rz(r)188end subroutine189 190! CHECK-LABEL: _QPtest_float2ll_rx191! CHECK: %{{.*}} = fir.call @__nv_float2ll_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64192! CHECK: %{{.*}} = fir.call @__nv_float2ll_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64193! CHECK: %{{.*}} = fir.call @__nv_float2ll_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64194! CHECK: %{{.*}} = fir.call @__nv_float2ll_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i64195 196attributes(global) subroutine test_ll2float_rX()197  real :: res198  integer(8) :: i199  res = __ll2float_rd(i)200  res = __ll2float_rn(i)201  res = __ll2float_ru(i)202  res = __ll2float_rz(i)203end subroutine204 205! CHECK-LABEL: _QPtest_ll2float_rx206! CHECK: %{{.*}} = fir.call @__nv_ll2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32207! CHECK: %{{.*}} = fir.call @__nv_ll2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32208! CHECK: %{{.*}} = fir.call @__nv_ll2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32209! CHECK: %{{.*}} = fir.call @__nv_ll2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f32210 211attributes(global) subroutine test_int2float_rX()212  real :: res213  integer :: i214  res = __int2float_rd(i)215  res = __int2float_rn(i)216  res = __int2float_ru(i)217  res = __int2float_rz(i)218end subroutine219 220! CHECK-LABEL: _QPtest_int2float_rx221! CHECK: %{{.*}} = fir.call @__nv_int2float_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32222! CHECK: %{{.*}} = fir.call @__nv_int2float_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32223! CHECK: %{{.*}} = fir.call @__nv_int2float_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32224! CHECK: %{{.*}} = fir.call @__nv_int2float_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32225 226attributes(global) subroutine test_float2int_rX()227  integer :: res228  real :: r229  res = __float2int_rd(r)230  res = __float2int_rn(r)231  res = __float2int_ru(r)232  res = __float2int_rz(r)233end subroutine234 235! CHECK-LABEL: _QPtest_float2int_rx236! CHECK: %{{.*}} = fir.call @__nv_float2int_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32    237! CHECK: %{{.*}} = fir.call @__nv_float2int_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32238! CHECK: %{{.*}} = fir.call @__nv_float2int_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32239! CHECK: %{{.*}} = fir.call @__nv_float2int_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32240 241attributes(global) subroutine test_float2uint_rX()242  integer :: res243  real :: r244  res = __float2uint_rd(r)245  res = __float2uint_rn(r)246  res = __float2uint_ru(r)247  res = __float2uint_rz(r)248end subroutine249 250! CHECK-LABEL: _QPtest_float2uint_rx251! CHECK: %{{.*}} = fir.call @__nv_float2uint_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32252! CHECK: %{{.*}} = fir.call @__nv_float2uint_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32253! CHECK: %{{.*}} = fir.call @__nv_float2uint_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32254! CHECK: %{{.*}} = fir.call @__nv_float2uint_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32255 256attributes(global) subroutine test_int2double_rn()257  double precision :: res258  integer :: r259  res = __int2double_rn(r)260end subroutine261 262! CHECK-LABEL: _QPtest_int2double_rn263! CHECK: %{{.*}} = fir.call @__nv_int2double_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f64264 265attributes(global) subroutine test_fdividef()266  real :: res267  real :: r268  res = __fdividef(r, r)269end subroutine270 271! CHECK-LABEL: _QPtest_fdividef272! CHECK: %{{.*}} = fir.call @__nv_fast_fdividef(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32, f32) -> f32273 274attributes(global) subroutine test_double_as_longlong()275  integer(8) :: res276  real(8) :: r277  res = double_as_longlong(r)278end subroutine279 280! CHECK-LABEL: _QPtest_double_as_longlong281! CHECK: %{{.*}} = fir.call @__nv_double_as_longlong(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64282 283attributes(global) subroutine test_longlong_as_double()284  integer(8) :: i285  real(8) :: res286  res = longlong_as_double(i)287end subroutine288 289! CHECK-LABEL: _QPtest_longlong_as_double290! CHECK: %{{.*}} = fir.call @__nv_longlong_as_double(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f64291 292attributes(global) subroutine test_int_as_float()293  integer :: i294  real :: res295  res = int_as_float(i)296end subroutine297 298! CHECK-LABEL: _QPtest_int_as_float299! CHECK: %{{.*}} = fir.call @__nv_int_as_float(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> f32300 301attributes(global) subroutine test_float_as_int()302  integer :: res303  real :: r304  res = float_as_int(r)305end subroutine306 307! CHECK-LABEL: _QPtest_float_as_int308! CHECK: %{{.*}} = fir.call @__nv_float_as_int(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> i32309 310attributes(global) subroutine test_double2loint()311  integer :: res312  double precision :: r313  res = __double2loint(r)314end subroutine315 316! CHECK-LABEL: _QPtest_double2loint317! CHECK: %{{.*}} = fir.call @__nv_double2loint(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i32318 319attributes(global) subroutine test_double2hiint()320  integer :: res321  double precision :: r322  res = __double2hiint(r)323end subroutine324  325! CHECK-LABEL: _QPtest_double2hiint326! CHECK: %{{.*}} = fir.call @__nv_double2hiint(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i32327 328attributes(global) subroutine test_hiloint2double()329  double precision :: res330  integer :: i, j331  res = __hiloint2double(i, j)332end subroutine333 334! CHECK-LABEL: _QPtest_hiloint2double335! CHECK: %{{.*}} = fir.call @__nv_hiloint2double(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> f64336