159 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 22; RUN: llc -mtriple aarch64-none-linux-gnu < %s | FileCheck %s3 4define void @foo(i32 noundef %limit, ptr %out, ptr %y) {5; CHECK-LABEL: foo:6; CHECK: // %bb.0: // %entry7; CHECK-NEXT: // kill: def $w0 killed $w0 def $x08; CHECK-NEXT: cmp w0, #19; CHECK-NEXT: b.lt .LBB0_1010; CHECK-NEXT: // %bb.1: // %for.cond1.preheader.us.preheader11; CHECK-NEXT: mov w10, w012; CHECK-NEXT: ubfiz x11, x0, #2, #3213; CHECK-NEXT: mov x8, xzr14; CHECK-NEXT: mov x9, xzr15; CHECK-NEXT: and x12, x10, #0xfffffff016; CHECK-NEXT: add x13, x1, #3217; CHECK-NEXT: b .LBB0_318; CHECK-NEXT: .LBB0_2: // %for.cond1.for.cond.cleanup3_crit_edge.us19; CHECK-NEXT: // in Loop: Header=BB0_3 Depth=120; CHECK-NEXT: add x9, x9, #121; CHECK-NEXT: add x13, x13, x1122; CHECK-NEXT: add x8, x8, x1023; CHECK-NEXT: cmp x9, x1024; CHECK-NEXT: b.eq .LBB0_1025; CHECK-NEXT: .LBB0_3: // %for.cond1.preheader.us26; CHECK-NEXT: // =>This Loop Header: Depth=127; CHECK-NEXT: // Child Loop BB0_6 Depth 228; CHECK-NEXT: // Child Loop BB0_9 Depth 229; CHECK-NEXT: ldrsh w14, [x2, x9, lsl #1]30; CHECK-NEXT: cmp w0, #1631; CHECK-NEXT: b.hs .LBB0_532; CHECK-NEXT: // %bb.4: // in Loop: Header=BB0_3 Depth=133; CHECK-NEXT: mov x17, xzr34; CHECK-NEXT: b .LBB0_835; CHECK-NEXT: .LBB0_5: // %vector.ph36; CHECK-NEXT: // in Loop: Header=BB0_3 Depth=137; CHECK-NEXT: dup v0.8h, w1438; CHECK-NEXT: add x15, x2, #1639; CHECK-NEXT: mov x16, x1340; CHECK-NEXT: and x17, x10, #0xfffffff041; CHECK-NEXT: .LBB0_6: // %vector.body42; CHECK-NEXT: // Parent Loop BB0_3 Depth=143; CHECK-NEXT: // => This Inner Loop Header: Depth=244; CHECK-NEXT: ldp q1, q4, [x15, #-16]45; CHECK-NEXT: subs x17, x17, #1646; CHECK-NEXT: ldp q3, q2, [x16, #-32]47; CHECK-NEXT: add x15, x15, #3248; CHECK-NEXT: ldp q6, q5, [x16]49; CHECK-NEXT: smlal2 v2.4s, v0.8h, v1.8h50; CHECK-NEXT: smlal v3.4s, v0.4h, v1.4h51; CHECK-NEXT: smlal2 v5.4s, v0.8h, v4.8h52; CHECK-NEXT: smlal v6.4s, v0.4h, v4.4h53; CHECK-NEXT: stp q3, q2, [x16, #-32]54; CHECK-NEXT: stp q6, q5, [x16], #6455; CHECK-NEXT: b.ne .LBB0_656; CHECK-NEXT: // %bb.7: // %middle.block57; CHECK-NEXT: // in Loop: Header=BB0_3 Depth=158; CHECK-NEXT: cmp x12, x1059; CHECK-NEXT: and x17, x10, #0xfffffff060; CHECK-NEXT: b.eq .LBB0_261; CHECK-NEXT: .LBB0_8: // %for.body4.us.preheader62; CHECK-NEXT: // in Loop: Header=BB0_3 Depth=163; CHECK-NEXT: add x15, x17, x864; CHECK-NEXT: add x16, x2, x17, lsl #165; CHECK-NEXT: sub x17, x10, x1766; CHECK-NEXT: add x15, x1, x15, lsl #267; CHECK-NEXT: .LBB0_9: // %for.body4.us68; CHECK-NEXT: // Parent Loop BB0_3 Depth=169; CHECK-NEXT: // => This Inner Loop Header: Depth=270; CHECK-NEXT: ldrsh w18, [x16], #271; CHECK-NEXT: ldr w3, [x15]72; CHECK-NEXT: subs x17, x17, #173; CHECK-NEXT: madd w18, w18, w14, w374; CHECK-NEXT: str w18, [x15], #475; CHECK-NEXT: b.ne .LBB0_976; CHECK-NEXT: b .LBB0_277; CHECK-NEXT: .LBB0_10: // %for.cond.cleanup78; CHECK-NEXT: ret79entry:80 %cmp26 = icmp sgt i32 %limit, 081 br i1 %cmp26, label %for.cond1.preheader.us.preheader, label %for.cond.cleanup82 83for.cond1.preheader.us.preheader: ; preds = %entry84 %0 = zext i32 %limit to i6485 %wide.trip.count34 = zext i32 %limit to i6486 %min.iters.check = icmp ult i32 %limit, 1687 %n.vec = and i64 %wide.trip.count34, 429496728088 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count3489 br label %for.cond1.preheader.us90 91for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us92 %indvars.iv30 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next31, %for.cond1.for.cond.cleanup3_crit_edge.us ]93 %arrayidx.us = getelementptr inbounds i16, ptr %y, i64 %indvars.iv3094 %1 = load i16, ptr %arrayidx.us, align 295 %conv.us = sext i16 %1 to i3296 %2 = mul nsw i64 %indvars.iv30, %097 br i1 %min.iters.check, label %for.body4.us.preheader, label %vector.ph98 99vector.ph: ; preds = %for.cond1.preheader.us100 %broadcast.splatinsert = insertelement <8 x i32> poison, i32 %conv.us, i64 0101 %broadcast.splat = shufflevector <8 x i32> %broadcast.splatinsert, <8 x i32> poison, <8 x i32> zeroinitializer102 %broadcast.splatinsert37 = insertelement <8 x i32> poison, i32 %conv.us, i64 0103 %broadcast.splat38 = shufflevector <8 x i32> %broadcast.splatinsert37, <8 x i32> poison, <8 x i32> zeroinitializer104 br label %vector.body105 106vector.body: ; preds = %vector.body, %vector.ph107 %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]108 %3 = getelementptr inbounds i16, ptr %y, i64 %index109 %wide.load = load <8 x i16>, ptr %3, align 2110 %4 = getelementptr inbounds i16, ptr %3, i64 8111 %wide.load36 = load <8 x i16>, ptr %4, align 2112 %5 = sext <8 x i16> %wide.load to <8 x i32>113 %6 = sext <8 x i16> %wide.load36 to <8 x i32>114 %7 = mul nsw <8 x i32> %broadcast.splat, %5115 %8 = mul nsw <8 x i32> %broadcast.splat38, %6116 %9 = add nuw nsw i64 %index, %2117 %10 = getelementptr inbounds i32, ptr %out, i64 %9118 %wide.load39 = load <8 x i32>, ptr %10, align 4119 %11 = getelementptr inbounds i32, ptr %10, i64 8120 %wide.load40 = load <8 x i32>, ptr %11, align 4121 %12 = add nsw <8 x i32> %7, %wide.load39122 %13 = add nsw <8 x i32> %8, %wide.load40123 store <8 x i32> %12, ptr %10, align 4124 store <8 x i32> %13, ptr %11, align 4125 %index.next = add nuw i64 %index, 16126 %14 = icmp eq i64 %index.next, %n.vec127 br i1 %14, label %middle.block, label %vector.body128 129middle.block: ; preds = %vector.body130 br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.preheader131 132for.body4.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block133 %indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]134 br label %for.body4.us135 136for.body4.us: ; preds = %for.body4.us.preheader, %for.body4.us137 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.us ], [ %indvars.iv.ph, %for.body4.us.preheader ]138 %arrayidx6.us = getelementptr inbounds i16, ptr %y, i64 %indvars.iv139 %15 = load i16, ptr %arrayidx6.us, align 2140 %conv7.us = sext i16 %15 to i32141 %mul.us = mul nsw i32 %conv7.us, %conv.us142 %16 = add nuw nsw i64 %indvars.iv, %2143 %arrayidx10.us = getelementptr inbounds i32, ptr %out, i64 %16144 %17 = load i32, ptr %arrayidx10.us, align 4145 %add11.us = add nsw i32 %mul.us, %17146 store i32 %add11.us, ptr %arrayidx10.us, align 4147 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1148 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count34149 br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us150 151for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us, %middle.block152 %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1153 %exitcond35.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count34154 br i1 %exitcond35.not, label %for.cond.cleanup, label %for.cond1.preheader.us155 156for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us, %entry157 ret void158}159