|
2 | 2 | ; RUN: -scalable-vectorization=on -force-target-supports-scalable-vectors \
|
3 | 3 | ; RUN: -force-tail-folding-style=none -enable-csa-vectorization \
|
4 | 4 | ; RUN: -prefer-predicate-over-epilogue=predicate-else-scalar-epilogue \
|
5 |
| -; RUN: -disable-output 2>&1 < %s | FileCheck %s |
| 5 | +; RUN: -disable-output 2>&1 < %s | FileCheck %s --check-prefix=NO-EVL |
| 6 | +; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize \ |
| 7 | +; RUN: -scalable-vectorization=on -force-target-supports-scalable-vectors \ |
| 8 | +; RUN: -force-tail-folding-style=data-with-evl -enable-csa-vectorization \ |
| 9 | +; RUN: -prefer-predicate-over-epilogue=predicate-else-scalar-epilogue \ |
| 10 | +; RUN: -disable-output 2>&1 < %s | FileCheck %s --check-prefix=EVL |
| 11 | + |
6 | 12 |
|
7 | 13 | ; This function is generated from the following C/C++ program:
|
8 | 14 | ; int simple_csa_int_select(int N, int *data, int a) {
|
@@ -39,63 +45,142 @@ loop: ; preds = %loop.preheader, %loop
|
39 | 45 | br i1 %exitcond.not, label %exit, label %loop
|
40 | 46 | }
|
41 | 47 |
|
42 |
| -; CHECK: VPlan 'Initial VPlan for VF={vscale x 1},UF>=1' { |
43 |
| -; CHECK-NEXT: Live-in vp<%0> = VF * UF |
44 |
| -; CHECK-NEXT: Live-in vp<%1> = vector-trip-count |
45 |
| -; CHECK-NEXT: vp<%2> = original trip-count |
46 |
| -; CHECK-EMPTY: |
47 |
| -; CHECK-NEXT: ir-bb<loop.preheader>: |
48 |
| -; CHECK-NEXT: IR %wide.trip.count = zext i32 %N to i64 |
49 |
| -; CHECK-NEXT: EMIT vp<%2> = EXPAND SCEV (zext i32 %N to i64) |
50 |
| -; CHECK-NEXT: Successor(s): vector.ph |
51 |
| -; CHECK-EMPTY: |
52 |
| -; CHECK-NEXT: vector.ph: |
53 |
| -; CHECK-NEXT: Successor(s): vector loop |
54 |
| -; CHECK-EMPTY: |
55 |
| -; CHECK-NEXT: <x1> vector loop: { |
56 |
| -; CHECK-NEXT: vector.body: |
57 |
| -; CHECK-NEXT: EMIT vp<%3> = CANONICAL-INDUCTION ir<0>, vp<%index.next> |
58 |
| -; CHECK-NEXT: EMIT ir<%t.010> = csa-data-phi ir<poison>, ir<%spec.select> |
59 |
| -; CHECK-NEXT: EMIT vp<%csa.mask.phi> = csa-mask-phi ir<false> |
60 |
| -; CHECK-NEXT: vp<%4> = SCALAR-STEPS vp<%3>, ir<1> |
61 |
| -; CHECK-NEXT: CLONE ir<%arrayidx> = getelementptr inbounds ir<%data>, vp<%4> |
62 |
| -; CHECK-NEXT: vp<%5> = vector-pointer ir<%arrayidx> |
63 |
| -; CHECK-NEXT: WIDEN ir<%0> = load vp<%5> |
64 |
| -; CHECK-NEXT: WIDEN-CAST ir<%1> = sext ir<%0> to i64 |
65 |
| -; CHECK-NEXT: WIDEN ir<%cmp1> = icmp slt ir<%a>, ir<%1> |
66 |
| -; CHECK-NEXT: EMIT vp<%csa.cond.anyof> = any-of ir<%cmp1> |
67 |
| -; CHECK-NEXT: EMIT vp<%csa.mask.sel> = csa-mask-sel ir<%cmp1>, vp<%csa.mask.phi>, vp<%csa.cond.anyof> |
68 |
| -; CHECK-NEXT: EMIT ir<%spec.select> = csa-data-update ir<%t.010>, ir<%cmp1>, ir<%0>, ir<%t.010>, vp<%csa.mask.sel>, vp<%csa.cond.anyof> |
69 |
| -; CHECK-NEXT: EMIT vp<%index.next> = add nuw vp<%3>, vp<%0> |
70 |
| -; CHECK-NEXT: EMIT branch-on-count vp<%index.next>, vp<%1> |
71 |
| -; CHECK-NEXT: No successors |
72 |
| -; CHECK-NEXT: } |
73 |
| -; CHECK-NEXT: Successor(s): middle.block |
74 |
| -; CHECK-EMPTY: |
75 |
| -; CHECK-NEXT: middle.block: |
76 |
| -; CHECK-NEXT: EMIT vp<%7> = extract-from-end ir<%spec.select>, ir<1> |
77 |
| -; CHECK-NEXT: EMIT vp<%8> = CSA-EXTRACT-SCALAR ir<-1>, vp<%csa.mask.sel>, ir<%spec.select> |
78 |
| -; CHECK-NEXT: EMIT vp<%cmp.n> = icmp eq vp<%2>, vp<%1> |
79 |
| -; CHECK-NEXT: EMIT branch-on-cond vp<%cmp.n> |
80 |
| -; CHECK-NEXT: Successor(s): ir-bb<exit.loopexit>, scalar.ph |
81 |
| -; CHECK-EMPTY: |
82 |
| -; CHECK-NEXT: scalar.ph: |
83 |
| -; CHECK-NEXT: EMIT vp<%bc.resume.val> = resume-phi vp<%1>, ir<0> |
84 |
| -; CHECK-NEXT: Successor(s): ir-bb<loop> |
85 |
| -; CHECK-EMPTY: |
86 |
| -; CHECK-NEXT: ir-bb<loop>: |
87 |
| -; CHECK-NEXT: IR %iv = phi i64 [ 0, %loop.preheader ], [ %iv.next, %loop ] (extra operand: vp<%bc.resume.val> from scalar.ph) |
88 |
| -; CHECK-NEXT: IR %t.010 = phi i32 [ -1, %loop.preheader ], [ %spec.select, %loop ] |
89 |
| -; CHECK-NEXT: IR %arrayidx = getelementptr inbounds i32, ptr %data, i64 %iv |
90 |
| -; CHECK-NEXT: IR %0 = load i32, ptr %arrayidx, align 4 |
91 |
| -; CHECK-NEXT: IR %1 = sext i32 %0 to i64 |
92 |
| -; CHECK-NEXT: IR %cmp1 = icmp slt i64 %a, %1 |
93 |
| -; CHECK-NEXT: IR %spec.select = select i1 %cmp1, i32 %0, i32 %t.010 |
94 |
| -; CHECK-NEXT: IR %iv.next = add nuw nsw i64 %iv, 1 |
95 |
| -; CHECK-NEXT: IR %exitcond.not = icmp eq i64 %iv.next, %wide.trip.count |
96 |
| -; CHECK-NEXT: No successors |
97 |
| -; CHECK-EMPTY: |
98 |
| -; CHECK-NEXT: ir-bb<exit.loopexit>: |
99 |
| -; CHECK-NEXT: IR %spec.select.lcssa = phi i32 [ %spec.select, %loop ] (extra operand: vp<%7> from middle.block) |
100 |
| -; CHECK-NEXT: No successors |
101 |
| -; CHECK-NEXT: } |
| 48 | +; NO-EVL: VPlan 'Initial VPlan for VF={vscale x 1},UF>=1' { |
| 49 | +; NO-EVL-NEXT: Live-in vp<%0> = VF * UF |
| 50 | +; NO-EVL-NEXT: Live-in vp<%1> = vector-trip-count |
| 51 | +; NO-EVL-NEXT: vp<%2> = original trip-count |
| 52 | +; NO-EVL-EMPTY: |
| 53 | +; NO-EVL-NEXT: ir-bb<loop.preheader>: |
| 54 | +; NO-EVL-NEXT: IR %wide.trip.count = zext i32 %N to i64 |
| 55 | +; NO-EVL-NEXT: EMIT vp<%2> = EXPAND SCEV (zext i32 %N to i64) |
| 56 | +; NO-EVL-NEXT: Successor(s): vector.ph |
| 57 | +; NO-EVL-EMPTY: |
| 58 | +; NO-EVL-NEXT: vector.ph: |
| 59 | +; NO-EVL-NEXT: Successor(s): vector loop |
| 60 | +; NO-EVL-EMPTY: |
| 61 | +; NO-EVL-NEXT: <x1> vector loop: { |
| 62 | +; NO-EVL-NEXT: vector.body: |
| 63 | +; NO-EVL-NEXT: EMIT vp<%3> = CANONICAL-INDUCTION ir<0>, vp<%index.next> |
| 64 | +; NO-EVL-NEXT: EMIT ir<%t.010> = csa-data-phi ir<poison>, ir<%spec.select> |
| 65 | +; NO-EVL-NEXT: EMIT vp<%csa.mask.phi> = csa-mask-phi ir<false> |
| 66 | +; NO-EVL-NEXT: vp<%4> = SCALAR-STEPS vp<%3>, ir<1> |
| 67 | +; NO-EVL-NEXT: CLONE ir<%arrayidx> = getelementptr inbounds ir<%data>, vp<%4> |
| 68 | +; NO-EVL-NEXT: vp<%5> = vector-pointer ir<%arrayidx> |
| 69 | +; NO-EVL-NEXT: WIDEN ir<%0> = load vp<%5> |
| 70 | +; NO-EVL-NEXT: WIDEN-CAST ir<%1> = sext ir<%0> to i64 |
| 71 | +; NO-EVL-NEXT: WIDEN ir<%cmp1> = icmp slt ir<%a>, ir<%1> |
| 72 | +; NO-EVL-NEXT: EMIT vp<%csa.cond.anyof> = any-of ir<%cmp1> |
| 73 | +; NO-EVL-NEXT: EMIT vp<%csa.mask.sel> = csa-mask-sel ir<%cmp1>, vp<%csa.mask.phi>, vp<%csa.cond.anyof> |
| 74 | +; NO-EVL-NEXT: EMIT ir<%spec.select> = csa-data-update ir<%t.010>, ir<%cmp1>, ir<%0>, ir<%t.010>, vp<%csa.mask.sel>, vp<%csa.cond.anyof> |
| 75 | +; NO-EVL-NEXT: EMIT vp<%index.next> = add nuw vp<%3>, vp<%0> |
| 76 | +; NO-EVL-NEXT: EMIT branch-on-count vp<%index.next>, vp<%1> |
| 77 | +; NO-EVL-NEXT: No successors |
| 78 | +; NO-EVL-NEXT: } |
| 79 | +; NO-EVL-NEXT: Successor(s): middle.block |
| 80 | +; NO-EVL-EMPTY: |
| 81 | +; NO-EVL-NEXT: middle.block: |
| 82 | +; NO-EVL-NEXT: EMIT vp<%7> = extract-from-end ir<%spec.select>, ir<1> |
| 83 | +; NO-EVL-NEXT: EMIT vp<%8> = CSA-EXTRACT-SCALAR ir<-1>, vp<%csa.mask.sel>, ir<%spec.select> |
| 84 | +; NO-EVL-NEXT: EMIT vp<%cmp.n> = icmp eq vp<%2>, vp<%1> |
| 85 | +; NO-EVL-NEXT: EMIT branch-on-cond vp<%cmp.n> |
| 86 | +; NO-EVL-NEXT: Successor(s): ir-bb<exit.loopexit>, scalar.ph |
| 87 | +; NO-EVL-EMPTY: |
| 88 | +; NO-EVL-NEXT: scalar.ph: |
| 89 | +; NO-EVL-NEXT: EMIT vp<%bc.resume.val> = resume-phi vp<%1>, ir<0> |
| 90 | +; NO-EVL-NEXT: Successor(s): ir-bb<loop> |
| 91 | +; NO-EVL-EMPTY: |
| 92 | +; NO-EVL-NEXT: ir-bb<loop>: |
| 93 | +; NO-EVL-NEXT: IR %iv = phi i64 [ 0, %loop.preheader ], [ %iv.next, %loop ] (extra operand: vp<%bc.resume.val> from scalar.ph) |
| 94 | +; NO-EVL-NEXT: IR %t.010 = phi i32 [ -1, %loop.preheader ], [ %spec.select, %loop ] |
| 95 | +; NO-EVL-NEXT: IR %arrayidx = getelementptr inbounds i32, ptr %data, i64 %iv |
| 96 | +; NO-EVL-NEXT: IR %0 = load i32, ptr %arrayidx, align 4 |
| 97 | +; NO-EVL-NEXT: IR %1 = sext i32 %0 to i64 |
| 98 | +; NO-EVL-NEXT: IR %cmp1 = icmp slt i64 %a, %1 |
| 99 | +; NO-EVL-NEXT: IR %spec.select = select i1 %cmp1, i32 %0, i32 %t.010 |
| 100 | +; NO-EVL-NEXT: IR %iv.next = add nuw nsw i64 %iv, 1 |
| 101 | +; NO-EVL-NEXT: IR %exitcond.not = icmp eq i64 %iv.next, %wide.trip.count |
| 102 | +; NO-EVL-NEXT: No successors |
| 103 | +; NO-EVL-EMPTY: |
| 104 | +; NO-EVL-NEXT: ir-bb<exit.loopexit>: |
| 105 | +; NO-EVL-NEXT: IR %spec.select.lcssa = phi i32 [ %spec.select, %loop ] (extra operand: vp<%7> from middle.block) |
| 106 | +; NO-EVL-NEXT: No successors |
| 107 | +; NO-EVL-NEXT: } |
| 108 | + |
| 109 | +; EVL: VPlan 'Initial VPlan for VF={vscale x 1},UF>=1' { |
| 110 | +; EVL-NEXT: Live-in vp<%0> = VF |
| 111 | +; EVL-NEXT: Live-in vp<%1> = VF * UF |
| 112 | +; EVL-NEXT: Live-in vp<%2> = vector-trip-count |
| 113 | +; EVL-NEXT: Live-in vp<%3> = backedge-taken count |
| 114 | +; EVL-NEXT: vp<%4> = original trip-count |
| 115 | +; EVL-EMPTY: |
| 116 | +; EVL-NEXT: ir-bb<loop.preheader>: |
| 117 | +; EVL-NEXT: IR %wide.trip.count = zext i32 %N to i64 |
| 118 | +; EVL-NEXT: EMIT vp<%4> = EXPAND SCEV (zext i32 %N to i64) |
| 119 | +; EVL-NEXT: Successor(s): vector.ph |
| 120 | +; EVL-EMPTY: |
| 121 | +; EVL-NEXT: vector.ph: |
| 122 | +; EVL-NEXT: Successor(s): vector loop |
| 123 | +; EVL-EMPTY: |
| 124 | +; EVL-NEXT: <x1> vector loop: { |
| 125 | +; EVL-NEXT: vector.body: |
| 126 | +; EVL-NEXT: EMIT vp<%5> = CANONICAL-INDUCTION ir<0>, vp<%index.next> |
| 127 | +; EVL-NEXT: ir<%iv> = WIDEN-INDUCTION ir<0>, ir<1>, vp<%0> |
| 128 | +; EVL-NEXT: EMIT ir<%t.010> = csa-data-phi ir<poison>, ir<%spec.select> |
| 129 | +; EVL-NEXT: EMIT vp<%csa.mask.phi> = csa-mask-phi ir<false> |
| 130 | +; EVL-NEXT: EMIT vp<%6> = icmp ule ir<%iv>, vp<%3> |
| 131 | +; EVL-NEXT: WIDEN-GEP Inv[Var] ir<%arrayidx> = getelementptr inbounds ir<%data>, ir<%iv> |
| 132 | +; EVL-NEXT: Successor(s): pred.load |
| 133 | +; EVL-EMPTY: |
| 134 | +; EVL-NEXT: <xVFxUF> pred.load: { |
| 135 | +; EVL-NEXT: pred.load.entry: |
| 136 | +; EVL-NEXT: BRANCH-ON-MASK vp<%6> |
| 137 | +; EVL-NEXT: Successor(s): pred.load.if, pred.load.continue |
| 138 | +; EVL-EMPTY: |
| 139 | +; EVL-NEXT: pred.load.if: |
| 140 | +; EVL-NEXT: REPLICATE ir<%0> = load ir<%arrayidx> (S->V) |
| 141 | +; EVL-NEXT: Successor(s): pred.load.continue |
| 142 | +; EVL-EMPTY: |
| 143 | +; EVL-NEXT: pred.load.continue: |
| 144 | +; EVL-NEXT: PHI-PREDICATED-INSTRUCTION vp<%7> = ir<%0> |
| 145 | +; EVL-NEXT: No successors |
| 146 | +; EVL-NEXT: } |
| 147 | +; EVL-NEXT: Successor(s): loop.0 |
| 148 | +; EVL-EMPTY: |
| 149 | +; EVL-NEXT: loop.0: |
| 150 | +; EVL-NEXT: WIDEN-CAST ir<%1> = sext vp<%7> to i64 |
| 151 | +; EVL-NEXT: WIDEN ir<%cmp1> = icmp slt ir<%a>, ir<%1> |
| 152 | +; EVL-NEXT: EMIT vp<%csa.cond.anyof> = any-of ir<%cmp1> |
| 153 | +; EVL-NEXT: EMIT vp<%csa.mask.sel> = csa-mask-sel ir<%cmp1>, vp<%csa.mask.phi>, vp<%csa.cond.anyof> |
| 154 | +; EVL-NEXT: EMIT ir<%spec.select> = csa-data-update ir<%t.010>, ir<%cmp1>, vp<%7>, ir<%t.010>, vp<%csa.mask.sel>, vp<%csa.cond.anyof> |
| 155 | +; EVL-NEXT: EMIT vp<%index.next> = add vp<%5>, vp<%1> |
| 156 | +; EVL-NEXT: EMIT branch-on-count vp<%index.next>, vp<%2> |
| 157 | +; EVL-NEXT: No successors |
| 158 | +; EVL-NEXT: } |
| 159 | +; EVL-NEXT: Successor(s): middle.block |
| 160 | +; EVL-EMPTY: |
| 161 | +; EVL-NEXT: middle.block: |
| 162 | +; EVL-NEXT: EMIT vp<%9> = extract-from-end ir<%spec.select>, ir<1> |
| 163 | +; EVL-NEXT: EMIT vp<%10> = CSA-EXTRACT-SCALAR ir<-1>, vp<%csa.mask.sel>, ir<%spec.select> |
| 164 | +; EVL-NEXT: EMIT branch-on-cond ir<true> |
| 165 | +; EVL-NEXT: Successor(s): ir-bb<exit.loopexit>, scalar.ph |
| 166 | +; EVL-EMPTY: |
| 167 | +; EVL-NEXT: scalar.ph: |
| 168 | +; EVL-NEXT: EMIT vp<%bc.resume.val> = resume-phi vp<%2>, ir<0> |
| 169 | +; EVL-NEXT: Successor(s): ir-bb<loop> |
| 170 | +; EVL-EMPTY: |
| 171 | +; EVL-NEXT: ir-bb<loop>: |
| 172 | +; EVL-NEXT: IR %iv = phi i64 [ 0, %loop.preheader ], [ %iv.next, %loop ] (extra operand: vp<%bc.resume.val> from scalar.ph) |
| 173 | +; EVL-NEXT: IR %t.010 = phi i32 [ -1, %loop.preheader ], [ %spec.select, %loop ] |
| 174 | +; EVL-NEXT: IR %arrayidx = getelementptr inbounds i32, ptr %data, i64 %iv |
| 175 | +; EVL-NEXT: IR %0 = load i32, ptr %arrayidx, align 4 |
| 176 | +; EVL-NEXT: IR %1 = sext i32 %0 to i64 |
| 177 | +; EVL-NEXT: IR %cmp1 = icmp slt i64 %a, %1 |
| 178 | +; EVL-NEXT: IR %spec.select = select i1 %cmp1, i32 %0, i32 %t.010 |
| 179 | +; EVL-NEXT: IR %iv.next = add nuw nsw i64 %iv, 1 |
| 180 | +; EVL-NEXT: IR %exitcond.not = icmp eq i64 %iv.next, %wide.trip.count |
| 181 | +; EVL-NEXT: No successors |
| 182 | +; EVL-EMPTY: |
| 183 | +; EVL-NEXT: ir-bb<exit.loopexit>: |
| 184 | +; EVL-NEXT: IR %spec.select.lcssa = phi i32 [ %spec.select, %loop ] (extra operand: vp<%9> from middle.block) |
| 185 | +; EVL-NEXT: No successors |
| 186 | +; EVL-NEXT: } |
0 commit comments