Lines Matching full:index
4 // CHECK: %[[c3:.*]] = arith.constant 3 : index
6 func.func @add_min_max(%a: index, %b: index) -> index {
7 %c1 = arith.constant 1 : index
8 %c2 = arith.constant 2 : index
9 %0 = arith.minsi %a, %c1 : index
10 %1 = arith.maxsi %0, %c1 : index
11 %2 = arith.minui %b, %c2 : index
12 %3 = arith.maxui %2, %c2 : index
13 %4 = arith.addi %1, %3 : index
14 func.return %4 : index
52 func.func @multiply_negatives(%a : index, %b : index) -> i1 {
53 %c2 = arith.constant 2 : index
54 %c3 = arith.constant 3 : index
55 %c_1 = arith.constant -1 : index
56 %c_2 = arith.constant -2 : index
57 %c_4 = arith.constant -4 : index
58 %c_12 = arith.constant -12 : index
59 %0 = arith.maxsi %a, %c2 : index
60 %1 = arith.minsi %0, %c3 : index
61 %2 = arith.minsi %b, %c_1 : index
62 %3 = arith.maxsi %2, %c_4 : index
63 %4 = arith.muli %1, %3 : index
64 %5 = arith.cmpi slt, %4, %c_12 : index
65 %6 = arith.cmpi slt, %c_1, %4 : index
91 %c0 = arith.constant 0 : index
92 %c1 = arith.constant 1 : index
93 %c4 = arith.constant 4 : index
94 %c16 = arith.constant 16 : index
95 %0 = scf.for %arg0 = %c0 to %c4 step %c1 iter_args(%arg1 = %c0) -> index {
96 %10 = arith.addi %arg0, %arg1 : index
97 scf.yield %10 : index
99 %1 = arith.cmpi ule, %0, %c16 : index
107 %c0 = arith.constant 0 : index
108 %c1 = arith.constant 1 : index
109 %c4 = arith.constant 4 : index
112 %10 = arith.cmpi ule, %arg0, %c4 : index
123 func.func @while_false(%arg0 : index) -> index {
124 %c0 = arith.constant 0 : index
125 %c1 = arith.constant 1 : index
126 %c2 = arith.constant 2 : index
127 %0 = arith.divui %arg0, %c2 : index
128 %1 = scf.while (%arg1 = %0) : (index) -> index {
129 %2 = arith.cmpi slt, %arg1, %c0 : index
130 scf.condition(%2) %arg1 : index
132 ^bb0(%arg2 : index):
133 scf.yield %c2 : index
135 func.return %1 : index
141 func.func @div_bounds_positive(%arg0 : index) -> i1 {
142 %c0 = arith.constant 0 : index
143 %c2 = arith.constant 2 : index
144 %c4 = arith.constant 4 : index
145 %0 = arith.maxsi %arg0, %c2 : index
146 %1 = arith.divsi %c4, %0 : index
147 %2 = arith.divui %c4, %0 : index
149 %3 = arith.cmpi sge, %1, %c0 : index
150 %4 = arith.cmpi sle, %1, %c2 : index
151 %5 = arith.cmpi sge, %2, %c0 : index
152 %6 = arith.cmpi sle, %1, %c2 : index
163 func.func @div_bounds_negative(%arg0 : index) -> i1 {
164 %c0 = arith.constant 0 : index
165 %c_2 = arith.constant -2 : index
166 %c4 = arith.constant 4 : index
167 %0 = arith.minsi %arg0, %c_2 : index
168 %1 = arith.divsi %c4, %0 : index
169 %2 = arith.divui %c4, %0 : index
171 %3 = arith.cmpi sle, %1, %c0 : index
172 %4 = arith.cmpi sge, %1, %c_2 : index
173 %5 = arith.cmpi eq, %2, %c0 : index
183 func.func @div_zero_undefined(%arg0 : index) -> i1 {
184 %c0 = arith.constant 0 : index
185 %c1 = arith.constant 1 : index
186 %c4 = arith.constant 4 : index
187 %0 = arith.andi %arg0, %c1 : index
188 %1 = arith.divui %c4, %0 : index
189 %2 = arith.cmpi ule, %1, %c4 : index
196 func.func @div_refine_min(%arg0 : index) -> i1 {
197 %c0 = arith.constant 1 : index
198 %c1 = arith.constant 2 : index
199 %c4 = arith.constant 4 : index
200 %0 = arith.andi %arg0, %c1 : index
201 %1 = arith.divui %c4, %0 : index
202 %2 = arith.cmpi uge, %1, %c0 : index
209 func.func @ceil_divui(%arg0 : index) -> i1 {
210 %c0 = arith.constant 0 : index
211 %c1 = arith.constant 1 : index
212 %c3 = arith.constant 3 : index
213 %c4 = arith.constant 4 : index
215 %0 = arith.minui %arg0, %c3 : index
216 %1 = arith.maxui %0, %c1 : index
217 %2 = arith.ceildivui %1, %c4 : index
218 %3 = arith.cmpi eq, %2, %c1 : index
220 %4 = arith.maxui %0, %c0 : index
221 %5 = arith.ceildivui %4, %c4 : index
222 %6 = arith.cmpi eq, %5, %c1 : index
230 func.func @ceil_divsi(%arg0 : index) -> i1 {
231 %c0 = arith.constant 0 : index
232 %c1 = arith.constant 1 : index
233 %c3 = arith.constant 3 : index
234 %c4 = arith.constant 4 : index
235 %c-4 = arith.constant -4 : index
237 %0 = arith.minsi %arg0, %c3 : index
238 %1 = arith.maxsi %0, %c1 : index
239 %2 = arith.ceildivsi %1, %c4 : index
240 %3 = arith.cmpi eq, %2, %c1 : index
241 %4 = arith.ceildivsi %1, %c-4 : index
242 %5 = arith.cmpi eq, %4, %c0 : index
245 %7 = arith.maxsi %0, %c0 : index
246 %8 = arith.ceildivsi %7, %c4 : index
247 %9 = arith.cmpi eq, %8, %c1 : index
254 // CHECK-SAME: (%[[arg:.*]]: index)
255 // CHECK: %[[c64:.*]] = arith.constant 64 : index
256 // CHECK: %[[ret:.*]] = arith.ceildivsi %[[arg]], %[[c64]] : index
258 func.func @ceil_divsi_full_range(%6: index) -> index {
259 %c64 = arith.constant 64 : index
260 %55 = arith.ceildivsi %6, %c64 : index
261 return %55 : index
280 func.func @floor_divsi(%arg0 : index) -> i1 {
281 %c4 = arith.constant 4 : index
282 %c-1 = arith.constant -1 : index
283 %c-3 = arith.constant -3 : index
284 %c-4 = arith.constant -4 : index
286 %0 = arith.minsi %arg0, %c-1 : index
287 %1 = arith.maxsi %0, %c-4 : index
288 %2 = arith.floordivsi %1, %c4 : index
289 %3 = arith.cmpi eq, %2, %c-1 : index
296 func.func @remui_base(%arg0 : index, %arg1 : index ) -> i1 {
297 %c2 = arith.constant 2 : index
298 %c4 = arith.constant 4 : index
300 %0 = arith.minui %arg1, %c4 : index
301 %1 = arith.maxui %0, %c2 : index
302 %2 = arith.remui %arg0, %1 : index
303 %3 = arith.cmpi ult, %2, %c4 : index
310 func.func @remui_base_maybe_zero(%arg0 : index, %arg1 : index ) -> i1 {
311 %c4 = arith.constant 4 : index
312 %c5 = arith.constant 5 : index
314 %0 = arith.minui %arg1, %c4 : index
315 %1 = arith.remui %arg0, %0 : index
316 %2 = arith.cmpi ult, %1, %c5 : index
323 func.func @remsi_base(%arg0 : index, %arg1 : index ) -> i1 {
324 %c0 = arith.constant 0 : index
325 %c2 = arith.constant 2 : index
326 %c4 = arith.constant 4 : index
327 %c-4 = arith.constant -4 : index
330 %0 = arith.minsi %arg1, %c4 : index
331 %1 = arith.maxsi %0, %c2 : index
332 %2 = arith.remsi %arg0, %1 : index
333 %3 = arith.cmpi sgt, %2, %c-4 : index
334 %4 = arith.cmpi slt, %2, %c4 : index
335 %5 = arith.cmpi sge, %2, %c0 : index
344 func.func @remsi_positive(%arg0 : index, %arg1 : index ) -> i1 {
345 %c0 = arith.constant 0 : index
346 %c2 = arith.constant 2 : index
347 %c4 = arith.constant 4 : index
350 %0 = arith.minsi %arg1, %c4 : index
351 %1 = arith.maxsi %0, %c2 : index
352 %2 = arith.maxsi %arg0, %c0 : index
353 %3 = arith.remsi %2, %1 : index
354 %4 = arith.cmpi sge, %3, %c0 : index
355 %5 = arith.cmpi slt, %3, %c4 : index
363 func.func @remui_restricted(%arg0 : index) -> i1 {
364 %c2 = arith.constant 2 : index
365 %c3 = arith.constant 3 : index
366 %c4 = arith.constant 4 : index
368 %0 = arith.minui %arg0, %c3 : index
369 %1 = arith.maxui %0, %c2 : index
370 %2 = arith.remui %1, %c4 : index
371 %3 = arith.cmpi ule, %2, %c3 : index
372 %4 = arith.cmpi uge, %2, %c2 : index
380 func.func @remsi_restricted(%arg0 : index) -> i1 {
381 %c2 = arith.constant 2 : index
382 %c3 = arith.constant 3 : index
383 %c-4 = arith.constant -4 : index
385 %0 = arith.minsi %arg0, %c3 : index
386 %1 = arith.maxsi %0, %c2 : index
387 %2 = arith.remsi %1, %c-4 : index
388 %3 = arith.cmpi ule, %2, %c3 : index
389 %4 = arith.cmpi uge, %2, %c2 : index
397 func.func @remui_restricted_fails(%arg0 : index) -> i1 {
398 %c2 = arith.constant 2 : index
399 %c3 = arith.constant 3 : index
400 %c4 = arith.constant 4 : index
401 %c5 = arith.constant 5 : index
403 %0 = arith.minui %arg0, %c5 : index
404 %1 = arith.maxui %0, %c3 : index
405 %2 = arith.remui %1, %c4 : index
406 %3 = arith.cmpi ne, %2, %c2 : index
413 func.func @remsi_restricted_fails(%arg0 : index) -> i1 {
414 %c2 = arith.constant 2 : index
415 %c3 = arith.constant 3 : index
416 %c5 = arith.constant 5 : index
417 %c-4 = arith.constant -4 : index
419 %0 = arith.minsi %arg0, %c5 : index
420 %1 = arith.maxsi %0, %c3 : index
421 %2 = arith.remsi %1, %c-4 : index
422 %3 = arith.cmpi ne, %2, %c2 : index
429 func.func @andi(%arg0 : index) -> i1 {
430 %c2 = arith.constant 2 : index
431 %c5 = arith.constant 5 : index
432 %c7 = arith.constant 7 : index
434 %0 = arith.minsi %arg0, %c5 : index
435 %1 = arith.maxsi %0, %c2 : index
436 %2 = arith.andi %1, %c7 : index
437 %3 = arith.cmpi ugt, %2, %c5 : index
438 %4 = arith.cmpi ule, %2, %c7 : index
446 func.func @andi_doesnt_make_nonnegative(%arg0 : index) -> i1 {
447 %c0 = arith.constant 0 : index
448 %c1 = arith.constant 1 : index
449 %0 = arith.addi %arg0, %c1 : index
450 %1 = arith.andi %arg0, %0 : index
451 %2 = arith.cmpi sge, %1, %c0 : index
557 func.func @index_cast(%arg0 : index) -> i1 {
559 %0 = arith.index_cast %arg0 : index to i32
560 %1 = arith.index_cast %0 : i32 to index
561 %2 = arith.index_cast %ci32_smin : i64 to index
562 %3 = arith.cmpi sge, %1, %2 : index
631 func.func @no_aggressive_eq(%arg0 : index) -> i1 {
632 %c1 = arith.constant 1 : index
633 %0 = arith.andi %arg0, %c1 : index
634 %1 = arith.minui %arg0, %c1 : index
635 %2 = arith.cmpi eq, %0, %1 : index
643 func.func @select_union(%arg0 : index, %arg1 : i1) -> i1 {
644 %c64 = arith.constant 64 : index
645 %c100 = arith.constant 100 : index
646 %c128 = arith.constant 128 : index
647 %c192 = arith.constant 192 : index
648 %0 = arith.remui %arg0, %c64 : index
649 %1 = arith.addi %0, %c128 : index
650 %2 = arith.select %arg1, %0, %1 : index
651 %3 = arith.cmpi slt, %2, %c192 : index
652 %4 = arith.cmpi ne, %c100, %2 : index
660 func.func @if_union(%arg0 : index, %arg1 : i1) -> i1 {
661 %c4 = arith.constant 4 : index
662 %c16 = arith.constant 16 : index
663 %c-1 = arith.constant -1 : index
664 %c-4 = arith.constant -4 : index
665 %0 = arith.minui %arg0, %c4 : index
666 %1 = scf.if %arg1 -> index {
667 %10 = arith.muli %0, %0 : index
668 scf.yield %10 : index
670 %20 = arith.muli %0, %c-1 : index
671 scf.yield %20 : index
673 %2 = arith.cmpi sle, %1, %c16 : index
674 %3 = arith.cmpi sge, %1, %c-4 : index
682 func.func @branch_union(%arg0 : index, %arg1 : i1) -> i1 {
683 %c4 = arith.constant 4 : index
684 %c16 = arith.constant 16 : index
685 %c-1 = arith.constant -1 : index
686 %c-4 = arith.constant -4 : index
687 %0 = arith.minui %arg0, %c4 : index
690 %1 = arith.muli %0, %0 : index
691 cf.br ^bb3(%1 : index)
693 %2 = arith.muli %0, %c-1 : index
694 cf.br ^bb3(%2 : index)
695 ^bb3(%3 : index) :
696 %4 = arith.cmpi sle, %3, %c16 : index
697 %5 = arith.cmpi sge, %3, %c-4 : index
707 func.func @loop_bound_not_inferred_with_branch(%arg0 : index, %arg1 : i1) -> i1 {
708 %c0 = arith.constant 0 : index
709 %c1 = arith.constant 1 : index
710 %c4 = arith.constant 4 : index
711 %0 = arith.minui %arg0, %c4 : index
712 cf.br ^bb2(%c0 : index)
713 ^bb1(%1 : index) :
714 %2 = arith.addi %1, %c1 : index
715 cf.br ^bb2(%2 : index)
716 ^bb2(%3 : index):
717 %4 = arith.cmpi ult, %3, %c4 : index
718 cf.cond_br %4, ^bb1(%3 : index), ^bb3(%3 : index)
719 ^bb3(%5 : index) :
720 %6 = arith.cmpi sge, %5, %c0 : index
721 %7 = arith.cmpi slt, %5, %c4 : index
731 func.func @truncation_spillover(%arg0 : memref<?xi32>) -> index {
732 %c0 = arith.constant 0 : index
733 %c1 = arith.constant 1 : index
734 %c2 = arith.constant 2 : index
735 %c49 = arith.constant 49 : index
736 %0 = scf.for %arg1 = %c0 to %c2 step %c1 iter_args(%arg2 = %c0) -> index {
737 %1 = arith.divsi %arg2, %c49 : index
738 %2 = arith.index_cast %1 : index to i32
740 %3 = arith.addi %arg2, %arg1 : index
741 scf.yield %3 : index
743 func.return %0 : index
829 %c1 = arith.constant 1 : index
830 %c0 = arith.constant 0 : index
987 // CHECK: test.reflect_bounds {smax = 2 : index, smin = 1 : index, umax = 2 : index, umin = 1 : index}
988 func.func @test_cmpf_propagates(%a: f32, %b: f32) -> index {
989 %c1 = arith.constant 1 : index
990 %c2 = arith.constant 2 : index
993 %1 = arith.select %0, %c1, %c2 : index
994 %2 = test.reflect_bounds %1 : index
995 func.return %2 : index
1000 %idx1 = arith.constant 1 : index
1002 %138 = index.floordivs %arg0, %arg0
1009 %idx1 = arith.constant 1 : index
1010 %idxm1 = arith.constant -1 : index
1012 %138 = index.floordivs %arg0, %arg0