Lines Matching full:by

1 // RUN: mlir-opt %s -test-loop-unrolling='unroll-factor=2' | FileCheck %s --check-prefix UNROLL-BY-2
2 // RUN: mlir-opt %s -test-loop-unrolling='unroll-factor=3' | FileCheck %s --check-prefix UNROLL-BY-3
3 …-test-loop-unrolling='unroll-factor=2 loop-depth=0' | FileCheck %s --check-prefix UNROLL-OUTER-BY-2
4 …-test-loop-unrolling='unroll-factor=2 loop-depth=1' | FileCheck %s --check-prefix UNROLL-INNER-BY-2
15 // UNROLL-BY-2-LABEL: func @dynamic_loop_unroll
16 // UNROLL-BY-2-SAME: %[[LB:.*0]]: index,
17 // UNROLL-BY-2-SAME: %[[UB:.*1]]: index,
18 // UNROLL-BY-2-SAME: %[[STEP:.*2]]: index,
19 // UNROLL-BY-2-SAME: %[[MEM:.*3]]: memref<?xf32>
21 // UNROLL-BY-2-DAG: %[[V0:.*]] = subi %[[UB]], %[[LB]] : index
22 // UNROLL-BY-2-DAG: %[[C1:.*]] = constant 1 : index
23 // UNROLL-BY-2-DAG: %[[V1:.*]] = subi %[[STEP]], %[[C1]] : index
24 // UNROLL-BY-2-DAG: %[[V2:.*]] = addi %[[V0]], %[[V1]] : index
26 // UNROLL-BY-2-DAG: %[[V3:.*]] = divi_signed %[[V2]], %[[STEP]] : index
28 // UNROLL-BY-2-DAG: %[[C2:.*]] = constant 2 : index
29 // UNROLL-BY-2-DAG: %[[V4:.*]] = remi_signed %[[V3]], %[[C2]] : index
30 // UNROLL-BY-2-DAG: %[[V5:.*]] = subi %[[V3]], %[[V4]] : index
31 // UNROLL-BY-2-DAG: %[[V6:.*]] = muli %[[V5]], %[[STEP]] : index
33 // UNROLL-BY-2-DAG: %[[V7:.*]] = addi %[[LB]], %[[V6]] : index
35 // UNROLL-BY-2-DAG: %[[V8:.*]] = muli %[[STEP]], %[[C2]] : index
36 // UNROLL-BY-2: scf.for %[[IV:.*]] = %[[LB]] to %[[V7]] step %[[V8]] {
37 // UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
38 // UNROLL-BY-2-NEXT: %[[C1_IV:.*]] = constant 1 : index
39 // UNROLL-BY-2-NEXT: %[[V9:.*]] = muli %[[STEP]], %[[C1_IV]] : index
40 // UNROLL-BY-2-NEXT: %[[V10:.*]] = addi %[[IV]], %[[V9]] : index
41 // UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[V10]]] : memref<?xf32>
42 // UNROLL-BY-2-NEXT: }
43 // UNROLL-BY-2-NEXT: scf.for %[[IV:.*]] = %[[V7]] to %[[UB]] step %[[STEP]] {
44 // UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
45 // UNROLL-BY-2-NEXT: }
46 // UNROLL-BY-2-NEXT: return
48 // UNROLL-BY-3-LABEL: func @dynamic_loop_unroll
49 // UNROLL-BY-3-SAME: %[[LB:.*0]]: index,
50 // UNROLL-BY-3-SAME: %[[UB:.*1]]: index,
51 // UNROLL-BY-3-SAME: %[[STEP:.*2]]: index,
52 // UNROLL-BY-3-SAME: %[[MEM:.*3]]: memref<?xf32>
54 // UNROLL-BY-3-DAG: %[[V0:.*]] = subi %[[UB]], %[[LB]] : index
55 // UNROLL-BY-3-DAG: %[[C1:.*]] = constant 1 : index
56 // UNROLL-BY-3-DAG: %[[V1:.*]] = subi %[[STEP]], %[[C1]] : index
57 // UNROLL-BY-3-DAG: %[[V2:.*]] = addi %[[V0]], %[[V1]] : index
59 // UNROLL-BY-3-DAG: %[[V3:.*]] = divi_signed %[[V2]], %[[STEP]] : index
61 // UNROLL-BY-3-DAG: %[[C3:.*]] = constant 3 : index
62 // UNROLL-BY-3-DAG: %[[V4:.*]] = remi_signed %[[V3]], %[[C3]] : index
63 // UNROLL-BY-3-DAG: %[[V5:.*]] = subi %[[V3]], %[[V4]] : index
64 // UNROLL-BY-3-DAG: %[[V6:.*]] = muli %[[V5]], %[[STEP]] : index
66 // UNROLL-BY-3-DAG: %[[V7:.*]] = addi %[[LB]], %[[V6]] : index
68 // UNROLL-BY-3-DAG: %[[V8:.*]] = muli %[[STEP]], %[[C3]] : index
69 // UNROLL-BY-3: scf.for %[[IV:.*]] = %[[LB]] to %[[V7]] step %[[V8]] {
70 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
71 // UNROLL-BY-3-NEXT: %[[C1_IV:.*]] = constant 1 : index
72 // UNROLL-BY-3-NEXT: %[[V9:.*]] = muli %[[STEP]], %[[C1_IV]] : index
73 // UNROLL-BY-3-NEXT: %[[V10:.*]] = addi %[[IV]], %[[V9]] : index
74 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V10]]] : memref<?xf32>
75 // UNROLL-BY-3-NEXT: %[[C2_IV:.*]] = constant 2 : index
76 // UNROLL-BY-3-NEXT: %[[V11:.*]] = muli %[[STEP]], %[[C2_IV]] : index
77 // UNROLL-BY-3-NEXT: %[[V12:.*]] = addi %[[IV]], %[[V11]] : index
78 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V12]]] : memref<?xf32>
79 // UNROLL-BY-3-NEXT: }
80 // UNROLL-BY-3-NEXT: scf.for %[[IV:.*]] = %[[V7]] to %[[UB]] step %[[STEP]] {
81 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
82 // UNROLL-BY-3-NEXT: }
83 // UNROLL-BY-3-NEXT: return
96 // UNROLL-OUTER-BY-2-LABEL: func @dynamic_loop_unroll_outer_by_2
97 // UNROLL-OUTER-BY-2-SAME: %[[LB0:.*0]]: index,
98 // UNROLL-OUTER-BY-2-SAME: %[[UB0:.*1]]: index,
99 // UNROLL-OUTER-BY-2-SAME: %[[STEP0:.*2]]: index,
100 // UNROLL-OUTER-BY-2-SAME: %[[LB1:.*3]]: index,
101 // UNROLL-OUTER-BY-2-SAME: %[[UB1:.*4]]: index,
102 // UNROLL-OUTER-BY-2-SAME: %[[STEP1:.*5]]: index,
103 // UNROLL-OUTER-BY-2-SAME: %[[MEM:.*6]]: memref<?xf32>
105 // UNROLL-OUTER-BY-2: scf.for %[[IV0:.*]] = %[[LB0]] to %{{.*}} step %{{.*}} {
106 // UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
107 // UNROLL-OUTER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
108 // UNROLL-OUTER-BY-2-NEXT: }
109 // UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
110 // UNROLL-OUTER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
111 // UNROLL-OUTER-BY-2-NEXT: }
112 // UNROLL-OUTER-BY-2-NEXT: }
113 // UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV0:.*]] = %{{.*}} to %[[UB0]] step %[[STEP0]] {
114 // UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
115 // UNROLL-OUTER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
116 // UNROLL-OUTER-BY-2-NEXT: }
117 // UNROLL-OUTER-BY-2-NEXT: }
118 // UNROLL-OUTER-BY-2-NEXT: return
131 // UNROLL-INNER-BY-2-LABEL: func @dynamic_loop_unroll_inner_by_2
132 // UNROLL-INNER-BY-2-SAME: %[[LB0:.*0]]: index,
133 // UNROLL-INNER-BY-2-SAME: %[[UB0:.*1]]: index,
134 // UNROLL-INNER-BY-2-SAME: %[[STEP0:.*2]]: index,
135 // UNROLL-INNER-BY-2-SAME: %[[LB1:.*3]]: index,
136 // UNROLL-INNER-BY-2-SAME: %[[UB1:.*4]]: index,
137 // UNROLL-INNER-BY-2-SAME: %[[STEP1:.*5]]: index,
138 // UNROLL-INNER-BY-2-SAME: %[[MEM:.*6]]: memref<?xf32>
140 // UNROLL-INNER-BY-2: scf.for %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
141 // UNROLL-INNER-BY-2: scf.for %[[IV1:.*]] = %[[LB1]] to %{{.*}} step %{{.*}} {
142 // UNROLL-INNER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
143 // UNROLL-INNER-BY-2-NEXT: %[[C1_IV:.*]] = constant 1 : index
144 // UNROLL-INNER-BY-2-NEXT: %[[V0:.*]] = muli %[[STEP1]], %[[C1_IV]] : index
145 // UNROLL-INNER-BY-2-NEXT: %[[V1:.*]] = addi %[[IV1]], %[[V0]] : index
146 // UNROLL-INNER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
147 // UNROLL-INNER-BY-2-NEXT: }
148 // UNROLL-INNER-BY-2-NEXT: scf.for %[[IV1:.*]] = %{{.*}} to %[[UB1]] step %[[STEP1]] {
149 // UNROLL-INNER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
150 // UNROLL-INNER-BY-2-NEXT: }
151 // UNROLL-INNER-BY-2-NEXT: }
152 // UNROLL-INNER-BY-2-NEXT: return
166 // UNROLL-BY-2-LABEL: func @static_loop_unroll_by_2
167 // UNROLL-BY-2-SAME: %[[MEM:.*0]]: memref<?xf32>
169 // UNROLL-BY-2-DAG: %[[C0:.*]] = constant 0 : index
170 // UNROLL-BY-2-DAG: %[[C1:.*]] = constant 1 : index
171 // UNROLL-BY-2-DAG: %[[C20:.*]] = constant 20 : index
172 // UNROLL-BY-2-DAG: %[[C2:.*]] = constant 2 : index
173 // UNROLL-BY-2: scf.for %[[IV:.*]] = %[[C0]] to %[[C20]] step %[[C2]] {
174 // UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
175 // UNROLL-BY-2-NEXT: %[[C1_IV:.*]] = constant 1 : index
176 // UNROLL-BY-2-NEXT: %[[V0:.*]] = muli %[[C1]], %[[C1_IV]] : index
177 // UNROLL-BY-2-NEXT: %[[V1:.*]] = addi %[[IV]], %[[V0]] : index
178 // UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
179 // UNROLL-BY-2-NEXT: }
180 // UNROLL-BY-2-NEXT: return
195 // UNROLL-BY-3-LABEL: func @static_loop_unroll_by_3
196 // UNROLL-BY-3-SAME: %[[MEM:.*0]]: memref<?xf32>
198 // UNROLL-BY-3-DAG: %[[C0:.*]] = constant 0 : index
199 // UNROLL-BY-3-DAG: %[[C1:.*]] = constant 1 : index
200 // UNROLL-BY-3-DAG: %[[C20:.*]] = constant 20 : index
201 // UNROLL-BY-3-DAG: %[[C18:.*]] = constant 18 : index
202 // UNROLL-BY-3-DAG: %[[C3:.*]] = constant 3 : index
203 // UNROLL-BY-3: scf.for %[[IV:.*]] = %[[C0]] to %[[C18]] step %[[C3]] {
204 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
205 // UNROLL-BY-3-NEXT: %[[C1_IV:.*]] = constant 1 : index
206 // UNROLL-BY-3-NEXT: %[[V0:.*]] = muli %[[C1]], %[[C1_IV]] : index
207 // UNROLL-BY-3-NEXT: %[[V1:.*]] = addi %[[IV]], %[[V0]] : index
208 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
209 // UNROLL-BY-3-NEXT: %[[C2_IV:.*]] = constant 2 : index
210 // UNROLL-BY-3-NEXT: %[[V2:.*]] = muli %[[C1]], %[[C2_IV]] : index
211 // UNROLL-BY-3-NEXT: %[[V3:.*]] = addi %[[IV]], %[[V2]] : index
212 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V3]]] : memref<?xf32>
213 // UNROLL-BY-3-NEXT: }
214 // UNROLL-BY-3-NEXT: scf.for %[[IV:.*]] = %[[C18]] to %[[C20]] step %[[C1]] {
215 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
216 // UNROLL-BY-3-NEXT: }
217 // UNROLL-BY-3-NEXT: return
231 // UNROLL-BY-3-LABEL: func @static_loop_unroll_by_3_promote_epilogue
232 // UNROLL-BY-3-SAME: %[[MEM:.*0]]: memref<?xf32>
234 // UNROLL-BY-3-DAG: %[[C0:.*]] = constant 0 : index
235 // UNROLL-BY-3-DAG: %[[C1:.*]] = constant 1 : index
236 // UNROLL-BY-3-DAG: %[[C10:.*]] = constant 10 : index
237 // UNROLL-BY-3-DAG: %[[C9:.*]] = constant 9 : index
238 // UNROLL-BY-3-DAG: %[[C3:.*]] = constant 3 : index
239 // UNROLL-BY-3: scf.for %[[IV:.*]] = %[[C0]] to %[[C9]] step %[[C3]] {
240 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
241 // UNROLL-BY-3-NEXT: %[[C1_IV:.*]] = constant 1 : index
242 // UNROLL-BY-3-NEXT: %[[V0:.*]] = muli %[[C1]], %[[C1_IV]] : index
243 // UNROLL-BY-3-NEXT: %[[V1:.*]] = addi %[[IV]], %[[V0]] : index
244 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
245 // UNROLL-BY-3-NEXT: %[[C2_IV:.*]] = constant 2 : index
246 // UNROLL-BY-3-NEXT: %[[V2:.*]] = muli %[[C1]], %[[C2_IV]] : index
247 // UNROLL-BY-3-NEXT: %[[V3:.*]] = addi %[[IV]], %[[V2]] : index
248 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V3]]] : memref<?xf32>
249 // UNROLL-BY-3-NEXT: }
250 // UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[C9]]] : memref<?xf32>
251 // UNROLL-BY-3-NEXT: return