187 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s3 4define void @arm_min_q31(ptr nocapture readonly %pSrc, i32 %blockSize, ptr nocapture %pResult, ptr nocapture %pIndex) {5; CHECK-LABEL: arm_min_q31:6; CHECK: @ %bb.0: @ %entry7; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr}8; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr}9; CHECK-NEXT: .pad #410; CHECK-NEXT: sub sp, #411; CHECK-NEXT: ldr.w r12, [r0]12; CHECK-NEXT: subs.w r9, r1, #113; CHECK-NEXT: beq .LBB0_314; CHECK-NEXT: @ %bb.1: @ %while.body.preheader15; CHECK-NEXT: and r6, r9, #316; CHECK-NEXT: subs r7, r1, #217; CHECK-NEXT: cmp r7, #318; CHECK-NEXT: bhs .LBB0_419; CHECK-NEXT: @ %bb.2:20; CHECK-NEXT: mov.w r10, #021; CHECK-NEXT: cbnz r6, .LBB0_722; CHECK-NEXT: b .LBB0_1023; CHECK-NEXT: .LBB0_3:24; CHECK-NEXT: mov.w r10, #025; CHECK-NEXT: b .LBB0_1026; CHECK-NEXT: .LBB0_4: @ %while.body.preheader.new27; CHECK-NEXT: bic r7, r9, #328; CHECK-NEXT: str r6, [sp] @ 4-byte Spill29; CHECK-NEXT: subs r7, #430; CHECK-NEXT: movs r6, #131; CHECK-NEXT: mov.w r10, #032; CHECK-NEXT: mov.w r8, #033; CHECK-NEXT: add.w lr, r6, r7, lsr #234; CHECK-NEXT: .LBB0_5: @ %while.body35; CHECK-NEXT: @ =>This Inner Loop Header: Depth=136; CHECK-NEXT: ldr r11, [r0, #16]!37; CHECK-NEXT: ldrd r5, r6, [r0, #-12]38; CHECK-NEXT: ldr r4, [r0, #-4]39; CHECK-NEXT: cmp r12, r540; CHECK-NEXT: csel r5, r5, r12, gt41; CHECK-NEXT: csinc r7, r10, r8, le42; CHECK-NEXT: cmp r5, r643; CHECK-NEXT: it gt44; CHECK-NEXT: addgt.w r7, r8, #245; CHECK-NEXT: csel r6, r6, r5, gt46; CHECK-NEXT: cmp r6, r447; CHECK-NEXT: it gt48; CHECK-NEXT: addgt.w r7, r8, #349; CHECK-NEXT: csel r6, r4, r6, gt50; CHECK-NEXT: add.w r8, r8, #451; CHECK-NEXT: cmp r6, r1152; CHECK-NEXT: csel r10, r8, r7, gt53; CHECK-NEXT: csel r12, r11, r6, gt54; CHECK-NEXT: le lr, .LBB0_555; CHECK-NEXT: @ %bb.6: @ %while.end.loopexit.unr-lcssa.loopexit56; CHECK-NEXT: ldr r6, [sp] @ 4-byte Reload57; CHECK-NEXT: sub.w r9, r9, r858; CHECK-NEXT: cbz r6, .LBB0_1059; CHECK-NEXT: .LBB0_7: @ %while.body.epil60; CHECK-NEXT: ldr r7, [r0, #4]61; CHECK-NEXT: sub.w r1, r1, r962; CHECK-NEXT: cmp r12, r763; CHECK-NEXT: csel r10, r1, r10, gt64; CHECK-NEXT: csel r12, r7, r12, gt65; CHECK-NEXT: cmp r6, #166; CHECK-NEXT: beq .LBB0_1067; CHECK-NEXT: @ %bb.8: @ %while.body.epil.168; CHECK-NEXT: ldr r7, [r0, #8]69; CHECK-NEXT: cmp r12, r770; CHECK-NEXT: csinc r10, r10, r1, le71; CHECK-NEXT: csel r12, r7, r12, gt72; CHECK-NEXT: cmp r6, #273; CHECK-NEXT: beq .LBB0_1074; CHECK-NEXT: @ %bb.9: @ %while.body.epil.275; CHECK-NEXT: ldr r0, [r0, #12]76; CHECK-NEXT: cmp r12, r077; CHECK-NEXT: it gt78; CHECK-NEXT: addgt.w r10, r1, #279; CHECK-NEXT: csel r12, r0, r12, gt80; CHECK-NEXT: .LBB0_10: @ %while.end81; CHECK-NEXT: str.w r12, [r2]82; CHECK-NEXT: str.w r10, [r3]83; CHECK-NEXT: add sp, #484; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc}85entry:86 %0 = load i32, ptr %pSrc, align 487 %blkCnt.015 = add i32 %blockSize, -188 %cmp.not17 = icmp eq i32 %blkCnt.015, 089 br i1 %cmp.not17, label %while.end, label %while.body.preheader90 91while.body.preheader: ; preds = %entry92 %1 = add i32 %blockSize, -293 %xtraiter = and i32 %blkCnt.015, 394 %2 = icmp ult i32 %1, 395 br i1 %2, label %while.end.loopexit.unr-lcssa, label %while.body.preheader.new96 97while.body.preheader.new: ; preds = %while.body.preheader98 %unroll_iter = and i32 %blkCnt.015, -499 br label %while.body100 101while.body: ; preds = %while.body, %while.body.preheader.new102 %pSrc.addr.021.pn = phi ptr [ %pSrc, %while.body.preheader.new ], [ %pSrc.addr.021.3, %while.body ]103 %blkCnt.020 = phi i32 [ %blkCnt.015, %while.body.preheader.new ], [ %blkCnt.0.3, %while.body ]104 %outIndex.019 = phi i32 [ 0, %while.body.preheader.new ], [ %spec.select14.3, %while.body ]105 %out.018 = phi i32 [ %0, %while.body.preheader.new ], [ %spec.select.3, %while.body ]106 %niter = phi i32 [ %unroll_iter, %while.body.preheader.new ], [ %niter.nsub.3, %while.body ]107 %pSrc.addr.021 = getelementptr inbounds i32, ptr %pSrc.addr.021.pn, i32 1108 %3 = load i32, ptr %pSrc.addr.021, align 4109 %cmp2 = icmp sgt i32 %out.018, %3110 %sub3 = sub i32 %blockSize, %blkCnt.020111 %spec.select = select i1 %cmp2, i32 %3, i32 %out.018112 %spec.select14 = select i1 %cmp2, i32 %sub3, i32 %outIndex.019113 %blkCnt.0 = add i32 %blkCnt.020, -1114 %pSrc.addr.021.1 = getelementptr inbounds i32, ptr %pSrc.addr.021.pn, i32 2115 %4 = load i32, ptr %pSrc.addr.021.1, align 4116 %cmp2.1 = icmp sgt i32 %spec.select, %4117 %sub3.1 = sub i32 %blockSize, %blkCnt.0118 %spec.select.1 = select i1 %cmp2.1, i32 %4, i32 %spec.select119 %spec.select14.1 = select i1 %cmp2.1, i32 %sub3.1, i32 %spec.select14120 %blkCnt.0.1 = add i32 %blkCnt.020, -2121 %pSrc.addr.021.2 = getelementptr inbounds i32, ptr %pSrc.addr.021.pn, i32 3122 %5 = load i32, ptr %pSrc.addr.021.2, align 4123 %cmp2.2 = icmp sgt i32 %spec.select.1, %5124 %sub3.2 = sub i32 %blockSize, %blkCnt.0.1125 %spec.select.2 = select i1 %cmp2.2, i32 %5, i32 %spec.select.1126 %spec.select14.2 = select i1 %cmp2.2, i32 %sub3.2, i32 %spec.select14.1127 %blkCnt.0.2 = add i32 %blkCnt.020, -3128 %pSrc.addr.021.3 = getelementptr inbounds i32, ptr %pSrc.addr.021.pn, i32 4129 %6 = load i32, ptr %pSrc.addr.021.3, align 4130 %cmp2.3 = icmp sgt i32 %spec.select.2, %6131 %sub3.3 = sub i32 %blockSize, %blkCnt.0.2132 %spec.select.3 = select i1 %cmp2.3, i32 %6, i32 %spec.select.2133 %spec.select14.3 = select i1 %cmp2.3, i32 %sub3.3, i32 %spec.select14.2134 %blkCnt.0.3 = add i32 %blkCnt.020, -4135 %niter.nsub.3 = add i32 %niter, -4136 %niter.ncmp.3 = icmp eq i32 %niter.nsub.3, 0137 br i1 %niter.ncmp.3, label %while.end.loopexit.unr-lcssa, label %while.body138 139while.end.loopexit.unr-lcssa: ; preds = %while.body, %while.body.preheader140 %spec.select.lcssa.ph = phi i32 [ undef, %while.body.preheader ], [ %spec.select.3, %while.body ]141 %spec.select14.lcssa.ph = phi i32 [ undef, %while.body.preheader ], [ %spec.select14.3, %while.body ]142 %pSrc.addr.021.pn.unr = phi ptr [ %pSrc, %while.body.preheader ], [ %pSrc.addr.021.3, %while.body ]143 %blkCnt.020.unr = phi i32 [ %blkCnt.015, %while.body.preheader ], [ %blkCnt.0.3, %while.body ]144 %outIndex.019.unr = phi i32 [ 0, %while.body.preheader ], [ %spec.select14.3, %while.body ]145 %out.018.unr = phi i32 [ %0, %while.body.preheader ], [ %spec.select.3, %while.body ]146 %lcmp.mod.not = icmp eq i32 %xtraiter, 0147 br i1 %lcmp.mod.not, label %while.end, label %while.body.epil148 149while.body.epil: ; preds = %while.end.loopexit.unr-lcssa150 %pSrc.addr.021.epil = getelementptr inbounds i32, ptr %pSrc.addr.021.pn.unr, i32 1151 %7 = load i32, ptr %pSrc.addr.021.epil, align 4152 %cmp2.epil = icmp sgt i32 %out.018.unr, %7153 %sub3.epil = sub i32 %blockSize, %blkCnt.020.unr154 %spec.select.epil = select i1 %cmp2.epil, i32 %7, i32 %out.018.unr155 %spec.select14.epil = select i1 %cmp2.epil, i32 %sub3.epil, i32 %outIndex.019.unr156 %epil.iter.cmp.not = icmp eq i32 %xtraiter, 1157 br i1 %epil.iter.cmp.not, label %while.end, label %while.body.epil.1158 159while.end: ; preds = %while.end.loopexit.unr-lcssa, %while.body.epil.2, %while.body.epil.1, %while.body.epil, %entry160 %out.0.lcssa = phi i32 [ %0, %entry ], [ %spec.select.lcssa.ph, %while.end.loopexit.unr-lcssa ], [ %spec.select.epil, %while.body.epil ], [ %spec.select.epil.1, %while.body.epil.1 ], [ %spec.select.epil.2, %while.body.epil.2 ]161 %outIndex.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select14.lcssa.ph, %while.end.loopexit.unr-lcssa ], [ %spec.select14.epil, %while.body.epil ], [ %spec.select14.epil.1, %while.body.epil.1 ], [ %spec.select14.epil.2, %while.body.epil.2 ]162 store i32 %out.0.lcssa, ptr %pResult, align 4163 store i32 %outIndex.0.lcssa, ptr %pIndex, align 4164 ret void165 166while.body.epil.1: ; preds = %while.body.epil167 %blkCnt.0.epil = add i32 %blkCnt.020.unr, -1168 %pSrc.addr.021.epil.1 = getelementptr inbounds i32, ptr %pSrc.addr.021.pn.unr, i32 2169 %8 = load i32, ptr %pSrc.addr.021.epil.1, align 4170 %cmp2.epil.1 = icmp sgt i32 %spec.select.epil, %8171 %sub3.epil.1 = sub i32 %blockSize, %blkCnt.0.epil172 %spec.select.epil.1 = select i1 %cmp2.epil.1, i32 %8, i32 %spec.select.epil173 %spec.select14.epil.1 = select i1 %cmp2.epil.1, i32 %sub3.epil.1, i32 %spec.select14.epil174 %epil.iter.cmp.1.not = icmp eq i32 %xtraiter, 2175 br i1 %epil.iter.cmp.1.not, label %while.end, label %while.body.epil.2176 177while.body.epil.2: ; preds = %while.body.epil.1178 %blkCnt.0.epil.1 = add i32 %blkCnt.020.unr, -2179 %pSrc.addr.021.epil.2 = getelementptr inbounds i32, ptr %pSrc.addr.021.pn.unr, i32 3180 %9 = load i32, ptr %pSrc.addr.021.epil.2, align 4181 %cmp2.epil.2 = icmp sgt i32 %spec.select.epil.1, %9182 %sub3.epil.2 = sub i32 %blockSize, %blkCnt.0.epil.1183 %spec.select.epil.2 = select i1 %cmp2.epil.2, i32 %9, i32 %spec.select.epil.1184 %spec.select14.epil.2 = select i1 %cmp2.epil.2, i32 %sub3.epil.2, i32 %spec.select14.epil.1185 br label %while.end186}187