2018-07-25 11:01:16 +08:00
|
|
|
// RUN: %S/../../mlir-opt %s -o - -unroll-innermost-loops | FileCheck %s
|
|
|
|
|
2018-08-02 13:36:12 +08:00
|
|
|
// CHECK-LABEL: mlfunc @loops1() {
|
|
|
|
mlfunc @loops1() {
|
|
|
|
// CHECK: %c0_i32 = constant 0 : i32
|
|
|
|
// CHECK-NEXT: %c1_i32 = constant 1 : i32
|
|
|
|
// CHECK-NEXT: %c2_i32 = constant 2 : i32
|
|
|
|
// CHECK-NEXT: %c3_i32 = constant 3 : i32
|
|
|
|
// CHECK-NEXT: for %i0 = 1 to 100 step 2 {
|
2018-07-25 11:01:16 +08:00
|
|
|
for %i = 1 to 100 step 2 {
|
2018-08-02 13:36:12 +08:00
|
|
|
// CHECK: %c1_i32_0 = constant 1 : i32
|
|
|
|
// CHECK-NEXT: %c1_i32_1 = constant 1 : i32
|
|
|
|
// CHECK-NEXT: %c1_i32_2 = constant 1 : i32
|
|
|
|
// CHECK-NEXT: %c1_i32_3 = constant 1 : i32
|
2018-07-25 11:01:16 +08:00
|
|
|
for %j = 1 to 4 {
|
2018-08-02 13:36:12 +08:00
|
|
|
%x = constant 1 : i32
|
2018-07-25 11:01:16 +08:00
|
|
|
}
|
|
|
|
} // CHECK: }
|
|
|
|
return // CHECK: return
|
|
|
|
} // CHECK }
|
2018-08-02 13:36:12 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: mlfunc @loops2() {
|
|
|
|
mlfunc @loops2() {
|
|
|
|
// CHECK: %c0_i32 = constant 0 : i32
|
|
|
|
// CHECK-NEXT: %c1_i32 = constant 1 : i32
|
|
|
|
// CHECK-NEXT: %c2_i32 = constant 2 : i32
|
|
|
|
// CHECK-NEXT: %c3_i32 = constant 3 : i32
|
|
|
|
// CHECK-NEXT: %c0_i32_0 = constant 0 : i32
|
|
|
|
// CHECK-NEXT: %c1_i32_1 = constant 1 : i32
|
|
|
|
// CHECK-NEXT: %c2_i32_2 = constant 2 : i32
|
|
|
|
// CHECK-NEXT: %c3_i32_3 = constant 3 : i32
|
|
|
|
// CHECK-NEXT: for %i0 = 1 to 100 step 2 {
|
|
|
|
for %i = 1 to 100 step 2 {
|
|
|
|
// CHECK: %0 = affine_apply (d0) -> (d0 + 1)(%c0_i32_0)
|
|
|
|
// CHECK-NEXT: %1 = affine_apply (d0) -> (d0 + 1)(%c1_i32_1)
|
|
|
|
// CHECK-NEXT: %2 = affine_apply (d0) -> (d0 + 1)(%c2_i32_2)
|
|
|
|
// CHECK-NEXT: %3 = affine_apply (d0) -> (d0 + 1)(%c3_i32_3)
|
|
|
|
for %j = 1 to 4 {
|
|
|
|
%x = "affine_apply" (%j) { map: (d0) -> (d0 + 1) } :
|
|
|
|
(affineint) -> (affineint)
|
|
|
|
}
|
|
|
|
} // CHECK: }
|
|
|
|
|
|
|
|
// CHECK: %c99 = constant 99 : affineint
|
|
|
|
%k = "constant"(){value: 99} : () -> affineint
|
|
|
|
// CHECK: for %i1 = 1 to 100 step 2 {
|
|
|
|
for %m = 1 to 100 step 2 {
|
|
|
|
// CHECK: %4 = affine_apply (d0) -> (d0 + 1)(%c0_i32)
|
|
|
|
// CHECK-NEXT: %5 = affine_apply (d0)[s0] -> (d0 + s0 + 1)(%c0_i32)[%c99]
|
|
|
|
// CHECK-NEXT: %6 = affine_apply (d0) -> (d0 + 1)(%c1_i32)
|
|
|
|
// CHECK-NEXT: %7 = affine_apply (d0)[s0] -> (d0 + s0 + 1)(%c1_i32)[%c99]
|
|
|
|
// CHECK-NEXT: %8 = affine_apply (d0) -> (d0 + 1)(%c2_i32)
|
|
|
|
// CHECK-NEXT: %9 = affine_apply (d0)[s0] -> (d0 + s0 + 1)(%c2_i32)[%c99]
|
|
|
|
// CHECK-NEXT: %10 = affine_apply (d0) -> (d0 + 1)(%c3_i32)
|
|
|
|
// CHECK-NEXT: %11 = affine_apply (d0)[s0] -> (d0 + s0 + 1)(%c3_i32)[%c99]
|
|
|
|
for %n = 1 to 4 {
|
|
|
|
%y = "affine_apply" (%n) { map: (d0) -> (d0 + 1) } :
|
|
|
|
(affineint) -> (affineint)
|
|
|
|
%z = "affine_apply" (%n, %k) { map: (d0) [s0] -> (d0 + s0 + 1) } :
|
|
|
|
(affineint, affineint) -> (affineint)
|
|
|
|
} // CHECK }
|
|
|
|
} // CHECK }
|
|
|
|
return // CHECK: return
|
|
|
|
} // CHECK }
|