brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.8 KiB · 62694a7 Raw
190 lines · plain
1! RUN: %flang_fc1 -emit-fir -O0 %s -o - | FileCheck %s --check-prefixes=CHECK%if target=x86_64{{.*}} %{,CHECK-KIND10%}%if flang-supports-f128-math %{,CHECK-KIND16%}2 3! DOT_PROD4! CHECK-LABEL: dot_prod_int_default5subroutine dot_prod_int_default (x, y, z)6  integer, dimension(1:) :: x,y7  integer, dimension(1:) :: z8  ! CHECK: %[[x1:.*]] = fir.declare{{.*}}x"9  ! CHECK: %[[x:.*]] = fir.rebox %[[x1]]{{.*}}10  ! CHECK: %[[y1:.*]] = fir.declare{{.*}}y"11  ! CHECK: %[[y:.*]] = fir.rebox %[[y1]]{{.*}}12  ! CHECK: %[[z1:.*]] = fir.declare{{.*}}z"13  ! CHECK: %[[z:.*]] = fir.rebox %[[z1]]{{.*}}14  ! CHECK-DAG: %[[x_conv:.*]] = fir.convert %[[x]] : (!fir.box<!fir.array<?xi32>>) -> !fir.box<none>15  ! CHECK-DAG: %[[y_conv:.*]] = fir.convert %[[y]] : (!fir.box<!fir.array<?xi32>>) -> !fir.box<none>16  ! CHECK-DAG: %[[res:.*]] = fir.call @_FortranADotProductInteger4(%[[x_conv]], %[[y_conv]], %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> i3217  z = dot_product(x,y)18end subroutine19 20! CHECK-LABEL: dot_prod_int_kind_121subroutine dot_prod_int_kind_1 (x, y, z)22  integer(kind=1), dimension(1:) :: x,y23  integer(kind=1), dimension(1:) :: z24  ! CHECK: fir.call @_FortranADotProductInteger1(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> i825  z = dot_product(x,y)26end subroutine27 28! CHECK-LABEL: dot_prod_int_kind_229subroutine dot_prod_int_kind_2 (x, y, z)30  integer(kind=2), dimension(1:) :: x,y31  integer(kind=2), dimension(1:) :: z32  ! CHECK: fir.call @_FortranADotProductInteger2(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> i1633  z = dot_product(x,y)34end subroutine35 36! CHECK-LABEL: dot_prod_int_kind_437subroutine dot_prod_int_kind_4 (x, y, z)38  integer(kind=4), dimension(1:) :: x,y39  integer(kind=4), dimension(1:) :: z40  ! CHECK: fir.call @_FortranADotProductInteger4(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> i3241  z = dot_product(x,y)42end subroutine43 44! CHECK-LABEL: dot_prod_int_kind_845subroutine dot_prod_int_kind_8 (x, y, z)46  integer(kind=8), dimension(1:) :: x,y47  integer(kind=8), dimension(1:) :: z48  ! CHECK: fir.call @_FortranADotProductInteger8(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> i6449  z = dot_product(x,y)50end subroutine51 52! CHECK-LABEL: dot_prod_int_kind_1653subroutine dot_prod_int_kind_16 (x, y, z)54  integer(kind=16), dimension(1:) :: x,y55  integer(kind=16), dimension(1:) :: z56  ! CHECK: fir.call @_FortranADotProductInteger16(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> i12857  z = dot_product(x,y)58end subroutine59 60! CHECK-LABEL: dot_prod_real_kind_default61subroutine dot_prod_real_kind_default (x, y, z)62  real, dimension(1:) :: x,y63  real, dimension(1:) :: z64  ! CHECK: fir.call @_FortranADotProductReal4(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> f3265  z = dot_product(x,y)66end subroutine67 68! CHECK-LABEL: dot_prod_real_kind_469subroutine dot_prod_real_kind_4 (x, y, z)70  real(kind=4), dimension(1:) :: x,y71  real(kind=4), dimension(1:) :: z72  ! CHECK: fir.call @_FortranADotProductReal4(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> f3273  z = dot_product(x,y)74end subroutine75 76! CHECK-LABEL: dot_prod_real_kind_877subroutine dot_prod_real_kind_8 (x, y, z)78  real(kind=8), dimension(1:) :: x,y79  real(kind=8), dimension(1:) :: z80  ! CHECK: fir.call @_FortranADotProductReal8(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> f6481  z = dot_product(x,y)82end subroutine83 84! CHECK-KIND10-LABEL: dot_prod_real_kind_1085subroutine dot_prod_real_kind_10 (x, y, z)86  integer, parameter :: kind10 = merge(10, 4, selected_real_kind(p=18).eq.10)87  real(kind=kind10), dimension(1:) :: x,y88  real(kind=kind10), dimension(1:) :: z89  ! CHECK-KIND10: fir.call @_FortranADotProductReal10(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> f8090  z = dot_product(x,y)91end subroutine92 93! CHECK-KIND16-LABEL: dot_prod_real_kind_1694subroutine dot_prod_real_kind_16 (x, y, z)95  integer, parameter :: kind16 = merge(16, 4, selected_real_kind(p=33).eq.16)96  real(kind=kind16), dimension(1:) :: x,y97  real(kind=kind16), dimension(1:) :: z98  ! CHECK-KIND16: fir.call @_FortranADotProductReal16(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> f12899  z = dot_product(x,y)100end subroutine101 102! CHECK-LABEL: dot_prod_double_default103subroutine dot_prod_double_default (x, y, z)104  double precision, dimension(1:) :: x,y105  double precision, dimension(1:) :: z106  ! CHECK: fir.call @_FortranADotProductReal8(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> f64107  z = dot_product(x,y)108end subroutine109 110! CHECK-LABEL: dot_prod_complex_default111subroutine dot_prod_complex_default (x, y, z)112  complex, dimension(1:) :: x,y113  complex, dimension(1:) :: z114  ! CHECK: %[[res:.*]] = fir.alloca complex<f32>115  ! CHECK: fir.call @_FortranACppDotProductComplex4(%[[res]], %{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.ref<complex<f32>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()116  z = dot_product(x,y)117end subroutine118 119! CHECK-LABEL: dot_prod_complex_kind_4120subroutine dot_prod_complex_kind_4 (x, y, z)121  complex(kind=4), dimension(1:) :: x,y122  complex(kind=4), dimension(1:) :: z123  ! CHECK: %[[res:.*]] = fir.alloca complex<f32>124  ! CHECK: fir.call @_FortranACppDotProductComplex4(%[[res]], %{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.ref<complex<f32>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()125  z = dot_product(x,y)126end subroutine127 128! CHECK-LABEL: dot_prod_complex_kind_8129subroutine dot_prod_complex_kind_8 (x, y, z)130  complex(kind=8), dimension(1:) :: x,y131  complex(kind=8), dimension(1:) :: z132  ! CHECK: %[[res:.*]] = fir.alloca complex<f64>133  ! CHECK: fir.call @_FortranACppDotProductComplex8(%[[res]], %{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.ref<complex<f64>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()134  z = dot_product(x,y)135end subroutine136 137! CHECK-KIND10-LABEL: dot_prod_complex_kind_10138subroutine dot_prod_complex_kind_10 (x, y, z)139  integer, parameter :: kind10 = merge(10, 4, selected_real_kind(p=18).eq.10)140  complex(kind=kind10), dimension(1:) :: x,y141  complex(kind=kind10), dimension(1:) :: z142  ! CHECK-KIND10: %[[res:.*]] = fir.alloca complex<f80>143  ! CHECK-KIND10: fir.call @_FortranACppDotProductComplex10(%[[res]], %{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.ref<complex<f80>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()144  z = dot_product(x,y)145end subroutine146 147! CHECK-KIND16-LABEL: dot_prod_complex_kind_16148subroutine dot_prod_complex_kind_16 (x, y, z)149  integer, parameter :: kind16 = merge(16, 4, selected_real_kind(p=33).eq.16)150  complex(kind=kind16), dimension(1:) :: x,y151  complex(kind=kind16), dimension(1:) :: z152  ! CHECK-KIND16: %[[res:.*]] = fir.alloca complex<f128>153  ! CHECK-KIND16: fir.call @_FortranACppDotProductComplex16(%[[res]], %{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.ref<complex<f128>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()154  z = dot_product(x,y)155end subroutine156 157! CHECK-LABEL: dot_prod_logical158subroutine dot_prod_logical (x, y, z)159  logical, dimension(1:) :: x,y160  logical, dimension(1:) :: z161  ! CHECK: fir.call @_FortranADotProductLogical(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> i1162  z = dot_product(x,y)163end subroutine164 165! CHECK-LABEL: dot_product_mixed_int_real166subroutine dot_product_mixed_int_real(x, y, z)167  integer, dimension(1:) :: x168  real, dimension(1:) :: y, z169  ! CHECK: fir.call @_FortranADotProductReal4(%{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> f32170  z = dot_product(x,y)171end subroutine172 173! CHECK-LABEL: dot_product_mixed_int_complex174subroutine dot_product_mixed_int_complex(x, y, z)175  integer, dimension(1:) :: x176  complex, dimension(1:) :: y, z177  ! CHECK: %[[res:.*]] = fir.alloca complex<f32>178  ! CHECK: fir.call @_FortranACppDotProductComplex4(%[[res]], %{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.ref<complex<f32>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()179  z = dot_product(x,y)180end subroutine181 182! CHECK-LABEL: dot_product_mixed_real_complex183subroutine dot_product_mixed_real_complex(x, y, z)184  real, dimension(1:) :: x185  complex, dimension(1:) :: y, z186  ! CHECK: %[[res:.*]] = fir.alloca complex<f32>187  ! CHECK: fir.call @_FortranACppDotProductComplex4(%[[res]], %{{.*}}, %{{.*}}, %{{[0-9]+}}, %{{.*}}) {{.*}}: (!fir.ref<complex<f32>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()188  z = dot_product(x,y)189end subroutine190