brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.6 KiB · 2b25429 Raw
335 lines · plain
1! RUN: %flang_fc1 -flang-experimental-hlfir -emit-llvm %s -o - | FileCheck --check-prefixes="LLVMIR" %s2! REQUIRES: target=powerpc{{.*}}3 4! vec_max5 6! CHECK-LABEL: vec_max_testf327subroutine vec_max_testf32(x, y)8  vector(real(4)) :: vmax, x, y9  vmax = vec_max(x, y)10 11! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 1612! LLVMIR: %[[y:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 1613! LLVMIR: %[[vmax:.*]] = call contract <4 x float> @llvm.ppc.vsx.xvmaxsp(<4 x float> %[[x]], <4 x float> %[[y]])14! LLVMIR: store <4 x float> %[[vmax]], ptr %{{[0-9]}}, align 1615end subroutine vec_max_testf3216 17! CHECK-LABEL: vec_max_testf6418subroutine vec_max_testf64(x, y)19  vector(real(8)) :: vmax, x, y20  vmax = vec_max(x, y)21 22! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 1623! LLVMIR: %[[y:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 1624! LLVMIR: %[[vmax:.*]] = call contract <2 x double> @llvm.ppc.vsx.xvmaxdp(<2 x double> %[[x]], <2 x double> %[[y]])25! LLVMIR: store <2 x double> %[[vmax]], ptr %{{[0-9]}}, align 1626end subroutine vec_max_testf6427 28! CHECK-LABEL: vec_max_testi829subroutine vec_max_testi8(x, y)30  vector(integer(1)) :: vmax, x, y31  vmax = vec_max(x, y)32 33! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 1634! LLVMIR: %[[y:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 1635! LLVMIR: %[[vmax:.*]] = call <16 x i8> @llvm.ppc.altivec.vmaxsb(<16 x i8> %[[x]], <16 x i8> %[[y]])36! LLVMIR: store <16 x i8> %[[vmax]], ptr %{{[0-9]}}, align 1637end subroutine vec_max_testi838 39! CHECK-LABEL: vec_max_testi1640subroutine vec_max_testi16(x, y)41  vector(integer(2)) :: vmax, x, y42  vmax = vec_max(x, y)43 44! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 1645! LLVMIR: %[[y:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 1646! LLVMIR: %[[vmax:.*]] = call <8 x i16> @llvm.ppc.altivec.vmaxsh(<8 x i16> %[[x]], <8 x i16> %[[y]])47! LLVMIR: store <8 x i16> %[[vmax]], ptr %{{[0-9]}}, align 1648end subroutine vec_max_testi1649 50! CHECK-LABEL: vec_max_testi3251subroutine vec_max_testi32(x, y)52  vector(integer(4)) :: vmax, x, y53  vmax = vec_max(x, y)54 55! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 1656! LLVMIR: %[[y:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 1657! LLVMIR: %[[vmax:.*]] = call <4 x i32> @llvm.ppc.altivec.vmaxsw(<4 x i32> %[[x]], <4 x i32> %[[y]])58! LLVMIR: store <4 x i32> %[[vmax]], ptr %{{[0-9]}}, align 1659end subroutine vec_max_testi3260 61! CHECK-LABEL: vec_max_testi6462subroutine vec_max_testi64(x, y)63  vector(integer(8)) :: vmax, x, y64  vmax = vec_max(x, y)65 66! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 1667! LLVMIR: %[[y:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 1668! LLVMIR: %[[vmax:.*]] = call <2 x i64> @llvm.ppc.altivec.vmaxsd(<2 x i64> %[[x]], <2 x i64> %[[y]])69! LLVMIR: store <2 x i64> %[[vmax]], ptr %{{[0-9]}}, align 1670end subroutine vec_max_testi6471 72! CHECK-LABEL: vec_max_testui873subroutine vec_max_testui8(x, y)74  vector(unsigned(1)) :: vmax, x, y75  vmax = vec_max(x, y)76 77! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 1678! LLVMIR: %[[y:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 1679! LLVMIR: %[[vmax:.*]] = call <16 x i8> @llvm.ppc.altivec.vmaxub(<16 x i8> %[[x]], <16 x i8> %[[y]])80! LLVMIR: store <16 x i8> %[[vmax]], ptr %{{[0-9]}}, align 1681end subroutine vec_max_testui882 83! CHECK-LABEL: vec_max_testui1684subroutine vec_max_testui16(x, y)85  vector(unsigned(2)) :: vmax, x, y86  vmax = vec_max(x, y)87 88! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 1689! LLVMIR: %[[y:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 1690! LLVMIR: %[[vmax:.*]] = call <8 x i16> @llvm.ppc.altivec.vmaxuh(<8 x i16> %[[x]], <8 x i16> %[[y]])91! LLVMIR: store <8 x i16> %[[vmax]], ptr %{{[0-9]}}, align 1692end subroutine vec_max_testui1693 94! CHECK-LABEL: vec_max_testui3295subroutine vec_max_testui32(x, y)96  vector(unsigned(4)) :: vmax, x, y97  vmax = vec_max(x, y)98 99! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16100! LLVMIR: %[[y:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16101! LLVMIR: %[[vmax:.*]] = call <4 x i32> @llvm.ppc.altivec.vmaxuw(<4 x i32> %[[x]], <4 x i32> %[[y]])102! LLVMIR: store <4 x i32> %[[vmax]], ptr %{{[0-9]}}, align 16103end subroutine vec_max_testui32104 105! CHECK-LABEL: vec_max_testui64106subroutine vec_max_testui64(x, y)107  vector(unsigned(8)) :: vmax, x, y108  vmax = vec_max(x, y)109 110! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16111! LLVMIR: %[[y:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16112! LLVMIR: %[[vmax:.*]] = call <2 x i64> @llvm.ppc.altivec.vmaxud(<2 x i64> %[[x]], <2 x i64> %[[y]])113! LLVMIR: store <2 x i64> %[[vmax]], ptr %{{[0-9]}}, align 16114end subroutine vec_max_testui64115 116! vec_min117 118! CHECK-LABEL: vec_min_testf32119subroutine vec_min_testf32(x, y)120  vector(real(4)) :: vmin, x, y121  vmin = vec_min(x, y)122 123! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16124! LLVMIR: %[[y:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16125! LLVMIR: %[[vmin:.*]] = call contract <4 x float> @llvm.ppc.vsx.xvminsp(<4 x float> %[[x]], <4 x float> %[[y]])126! LLVMIR: store <4 x float> %[[vmin]], ptr %{{[0-9]}}, align 16127end subroutine vec_min_testf32128 129! CHECK-LABEL: vec_min_testf64130subroutine vec_min_testf64(x, y)131  vector(real(8)) :: vmin, x, y132  vmin = vec_min(x, y)133 134! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16135! LLVMIR: %[[y:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16136! LLVMIR: %[[vmin:.*]] = call contract <2 x double> @llvm.ppc.vsx.xvmindp(<2 x double> %[[x]], <2 x double> %[[y]])137! LLVMIR: store <2 x double> %[[vmin]], ptr %{{[0-9]}}, align 16138end subroutine vec_min_testf64139 140! CHECK-LABEL: vec_min_testi8141subroutine vec_min_testi8(x, y)142  vector(integer(1)) :: vmin, x, y143  vmin = vec_min(x, y)144 145! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16146! LLVMIR: %[[y:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16147! LLVMIR: %[[vmin:.*]] = call <16 x i8> @llvm.ppc.altivec.vminsb(<16 x i8> %[[x]], <16 x i8> %[[y]])148! LLVMIR: store <16 x i8> %[[vmin]], ptr %{{[0-9]}}, align 16149end subroutine vec_min_testi8150 151! CHECK-LABEL: vec_min_testi16152subroutine vec_min_testi16(x, y)153  vector(integer(2)) :: vmin, x, y154  vmin = vec_min(x, y)155 156! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16157! LLVMIR: %[[y:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16158! LLVMIR: %[[vmin:.*]] = call <8 x i16> @llvm.ppc.altivec.vminsh(<8 x i16> %[[x]], <8 x i16> %[[y]])159! LLVMIR: store <8 x i16> %[[vmin]], ptr %{{[0-9]}}, align 16160end subroutine vec_min_testi16161 162! CHECK-LABEL: vec_min_testi32163subroutine vec_min_testi32(x, y)164  vector(integer(4)) :: vmin, x, y165  vmin = vec_min(x, y)166 167! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16168! LLVMIR: %[[y:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16169! LLVMIR: %[[vmin:.*]] = call <4 x i32> @llvm.ppc.altivec.vminsw(<4 x i32> %[[x]], <4 x i32> %[[y]])170! LLVMIR: store <4 x i32> %[[vmin]], ptr %{{[0-9]}}, align 16171end subroutine vec_min_testi32172 173! CHECK-LABEL: vec_min_testi64174subroutine vec_min_testi64(x, y)175  vector(integer(8)) :: vmin, x, y176  vmin = vec_min(x, y)177 178! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16179! LLVMIR: %[[y:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16180! LLVMIR: %[[vmin:.*]] = call <2 x i64> @llvm.ppc.altivec.vminsd(<2 x i64> %[[x]], <2 x i64> %[[y]])181! LLVMIR: store <2 x i64> %[[vmin]], ptr %{{[0-9]}}, align 16182end subroutine vec_min_testi64183 184! CHECK-LABEL: vec_min_testui8185subroutine vec_min_testui8(x, y)186  vector(unsigned(1)) :: vmin, x, y187  vmin = vec_min(x, y)188 189! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16190! LLVMIR: %[[y:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16191! LLVMIR: %[[vmin:.*]] = call <16 x i8> @llvm.ppc.altivec.vminub(<16 x i8> %[[x]], <16 x i8> %[[y]])192! LLVMIR: store <16 x i8> %[[vmin]], ptr %{{[0-9]}}, align 16193end subroutine vec_min_testui8194 195! CHECK-LABEL: vec_min_testui16196subroutine vec_min_testui16(x, y)197  vector(unsigned(2)) :: vmin, x, y198  vmin = vec_min(x, y)199 200! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16201! LLVMIR: %[[y:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16202! LLVMIR: %[[vmin:.*]] = call <8 x i16> @llvm.ppc.altivec.vminuh(<8 x i16> %[[x]], <8 x i16> %[[y]])203! LLVMIR: store <8 x i16> %[[vmin]], ptr %{{[0-9]}}, align 16204end subroutine vec_min_testui16205 206! CHECK-LABEL: vec_min_testui32207subroutine vec_min_testui32(x, y)208  vector(unsigned(4)) :: vmin, x, y209  vmin = vec_min(x, y)210 211! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16212! LLVMIR: %[[y:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16213! LLVMIR: %[[vmin:.*]] = call <4 x i32> @llvm.ppc.altivec.vminuw(<4 x i32> %[[x]], <4 x i32> %[[y]])214! LLVMIR: store <4 x i32> %[[vmin]], ptr %{{[0-9]}}, align 16215end subroutine vec_min_testui32216 217! CHECK-LABEL: vec_min_testui64218subroutine vec_min_testui64(x, y)219  vector(unsigned(8)) :: vmin, x, y220  vmin = vec_min(x, y)221 222! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16223! LLVMIR: %[[y:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16224! LLVMIR: %[[vmin:.*]] = call <2 x i64> @llvm.ppc.altivec.vminud(<2 x i64> %[[x]], <2 x i64> %[[y]])225! LLVMIR: store <2 x i64> %[[vmin]], ptr %{{[0-9]}}, align 16226end subroutine vec_min_testui64227 228! vec_madd229 230! CHECK-LABEL: vec_madd_testf32231subroutine vec_madd_testf32(x, y, z)232  vector(real(4)) :: vmsum, x, y, z233  vmsum = vec_madd(x, y, z)234 235! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16236! LLVMIR: %[[y:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16237! LLVMIR: %[[z:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16238! LLVMIR: %[[vmsum:.*]] = call contract <4 x float> @llvm.fma.v4f32(<4 x float> %[[x]], <4 x float> %[[y]], <4 x float> %[[z]])239! LLVMIR: store <4 x float> %[[vmsum]], ptr %{{[0-9]}}, align 16240end subroutine vec_madd_testf32241 242! CHECK-LABEL: vec_madd_testf64243subroutine vec_madd_testf64(x, y, z)244  vector(real(8)) :: vmsum, x, y, z245  vmsum = vec_madd(x, y, z)246 247! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16248! LLVMIR: %[[y:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16249! LLVMIR: %[[z:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16250! LLVMIR: %[[vmsum:.*]] = call contract <2 x double> @llvm.fma.v2f64(<2 x double> %[[x]], <2 x double> %[[y]], <2 x double> %[[z]])251! LLVMIR: store <2 x double> %[[vmsum]], ptr %{{[0-9]}}, align 16252end subroutine vec_madd_testf64253 254! vec_nmsub255 256! CHECK-LABEL: vec_nmsub_testf32257subroutine vec_nmsub_testf32(x, y, z)258  vector(real(4)) :: vnmsub, x, y, z259  vnmsub = vec_nmsub(x, y, z)260 261! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16262! LLVMIR: %[[y:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16263! LLVMIR: %[[z:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16264! LLVMIR: %[[vnmsub:.*]] = call contract <4 x float> @llvm.ppc.fnmsub.v4f32(<4 x float> %[[x]], <4 x float> %[[y]], <4 x float> %[[z]])265! LLVMIR: store <4 x float> %[[vnmsub]], ptr %{{[0-9]}}, align 16266end subroutine vec_nmsub_testf32267 268! CHECK-LABEL: vec_nmsub_testf64269subroutine vec_nmsub_testf64(x, y, z)270  vector(real(8)) :: vnmsub, x, y, z271  vnmsub = vec_nmsub(x, y, z)272 273! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16274! LLVMIR: %[[y:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16275! LLVMIR: %[[z:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16276! LLVMIR: %[[vnmsub:.*]] = call contract <2 x double> @llvm.ppc.fnmsub.v2f64(<2 x double> %[[x]], <2 x double> %[[y]], <2 x double> %[[z]])277! LLVMIR: store <2 x double> %[[vnmsub]], ptr %{{[0-9]}}, align 16278end subroutine vec_nmsub_testf64279 280! vec_msub281 282! CHECK-LABEL: vec_msub_testf32283subroutine vec_msub_testf32(x, y, z)284  vector(real(4)) :: vmsub, x, y, z285  vmsub = vec_msub(x, y, z)286 287! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16288! LLVMIR: %[[y:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16289! LLVMIR: %[[z:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16290! LLVMIR: %[[nz:.*]] = fneg contract <4 x float> %[[z]]291! LLVMIR: %[[vmsub:.*]] = call contract <4 x float> @llvm.fma.v4f32(<4 x float> %[[x]], <4 x float> %[[y]], <4 x float> %[[nz]])292! LLVMIR: store <4 x float> %[[vmsub]], ptr %{{[0-9]}}, align 16293end subroutine vec_msub_testf32294 295! CHECK-LABEL: vec_msub_testf64296subroutine vec_msub_testf64(x, y, z)297  vector(real(8)) :: vmsub, x, y, z298  vmsub = vec_msub(x, y, z)299 300! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16301! LLVMIR: %[[y:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16302! LLVMIR: %[[z:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16303! LLVMIR: %[[nz:.*]] = fneg contract <2 x double> %[[z]]304! LLVMIR: %[[vmsub:.*]] = call contract <2 x double> @llvm.fma.v2f64(<2 x double> %[[x]], <2 x double> %[[y]], <2 x double> %[[nz]])305! LLVMIR: store <2 x double> %[[vmsub]], ptr %{{[0-9]}}, align 16306end subroutine vec_msub_testf64307 308! vec_nmadd309 310! CHECK-LABEL: vec_nmadd_testf32311subroutine vec_nmadd_testf32(x, y, z)312  vector(real(4)) :: vnmsum, x, y, z313  vnmsum = vec_nmadd(x, y, z)314 315! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16316! LLVMIR: %[[y:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16317! LLVMIR: %[[z:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16318! LLVMIR: %[[msum:.*]] = call contract <4 x float> @llvm.fma.v4f32(<4 x float> %[[x]], <4 x float> %[[y]], <4 x float> %[[z]])319! LLVMIR: %[[vnmsum:.*]] = fneg contract <4 x float> %[[msum]]320! LLVMIR: store <4 x float> %[[vnmsum]], ptr %{{[0-9]}}, align 16321end subroutine vec_nmadd_testf32322 323! CHECK-LABEL: vec_nmadd_testf64324subroutine vec_nmadd_testf64(x, y, z)325  vector(real(8)) :: vnmsum, x, y, z326  vnmsum = vec_nmadd(x, y, z)327 328! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16329! LLVMIR: %[[y:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16330! LLVMIR: %[[z:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16331! LLVMIR: %[[msum:.*]] = call contract <2 x double> @llvm.fma.v2f64(<2 x double> %[[x]], <2 x double> %[[y]], <2 x double> %[[z]])332! LLVMIR: %[[vnmsum:.*]] = fneg contract <2 x double> %[[msum]]333! LLVMIR: store <2 x double> %[[vnmsum]], ptr %{{[0-9]}}, align 16334end subroutine vec_nmadd_testf64335