1// RUN: mlir-opt %s -affine-super-vectorizer-test -normalize-maps | FileCheck %s 2 3// CHECK-DAG: #[[$ZERO:[a-zA-Z0-9]+]] = affine_map<() -> (0)> 4// CHECK-DAG: #[[$ID1:[a-zA-Z0-9]+]] = affine_map<(d0) -> (d0)> 5// CHECK-DAG: #[[$D0TIMES2:[a-zA-Z0-9]+]] = affine_map<(d0) -> (d0 * 2)> 6// CHECK-DAG: #[[$D0PLUSD1:[a-zA-Z0-9]+]] = affine_map<(d0, d1) -> (d0 + d1)> 7// CHECK-DAG: #[[$MINSD0PLUSD1:[a-zA-Z0-9]+]] = affine_map<(d0, d1) -> (-d0 + d1)> 8// CHECK-DAG: #[[$D0MINUSD1:[a-zA-Z0-9]+]] = affine_map<(d0, d1) -> (d0 - d1)> 9 10// CHECK-LABEL: func @simple() 11func @simple() { 12 affine.for %i0 = 0 to 7 { 13 %0 = affine.apply affine_map<(d0) -> (d0)> (%i0) 14 %1 = affine.apply affine_map<(d0) -> (d0)> (%0) 15 %2 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%0, %0) 16 %3 = affine.apply affine_map<(d0, d1) -> (d0 - d1)> (%0, %0) 17 } 18 // CHECK-NEXT: affine.for %{{.*}} = 0 to 7 19 // CHECK-NEXT: {{.*}} affine.apply #[[$ID1]](%{{.*}}) 20 // CHECK-NEXT: {{.*}} affine.apply #[[$D0TIMES2]](%{{.*}}) 21 // CHECK-NEXT: {{.*}} affine.apply #[[$ZERO]]() 22 23 affine.for %i1 = 0 to 7 { 24 affine.for %i2 = 0 to 42 { 25 %20 = affine.apply affine_map<(d0, d1) -> (d1)> (%i1, %i2) 26 %21 = affine.apply affine_map<(d0, d1) -> (d0)> (%i1, %i2) 27 %22 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%20, %21) 28 %23 = affine.apply affine_map<(d0, d1) -> (d0 - d1)> (%20, %21) 29 %24 = affine.apply affine_map<(d0, d1) -> (-d0 + d1)> (%20, %21) 30 } 31 } 32 // CHECK: affine.for %{{.*}} = 0 to 7 33 // CHECK-NEXT: affine.for %{{.*}} = 0 to 42 34 // CHECK-NEXT: {{.*}} affine.apply #[[$D0PLUSD1]](%{{.*}}, %{{.*}}) 35 // CHECK-NEXT: {{.*}} affine.apply #[[$MINSD0PLUSD1]](%{{.*}}, %{{.*}}) 36 // CHECK-NEXT: {{.*}} affine.apply #[[$D0MINUSD1]](%{{.*}}, %{{.*}}) 37 38 affine.for %i3 = 0 to 16 { 39 affine.for %i4 = 0 to 47 step 2 { 40 affine.for %i5 = 0 to 78 step 16 { 41 %50 = affine.apply affine_map<(d0) -> (d0)> (%i3) 42 %51 = affine.apply affine_map<(d0) -> (d0)> (%i4) 43 %52 = affine.apply affine_map<(d0) -> (d0)> (%i5) 44 %53 = affine.apply affine_map<(d0, d1, d2) -> (d0)> (%50, %51, %52) 45 %54 = affine.apply affine_map<(d0, d1, d2) -> (d1)> (%50, %51, %52) 46 %55 = affine.apply affine_map<(d0, d1, d2) -> (d2)> (%50, %51, %52) 47 } 48 } 49 } 50 // CHECK: affine.for %{{.*}} = 0 to 16 51 // CHECK-NEXT: affine.for %{{.*}} = 0 to 47 step 2 52 // CHECK-NEXT: affine.for %{{.*}} = 0 to 78 step 16 53 // CHECK-NEXT: {{.*}} affine.apply #[[$ID1]](%{{.*}}) 54 // CHECK-NEXT: {{.*}} affine.apply #[[$ID1]](%{{.*}}) 55 // CHECK-NEXT: {{.*}} affine.apply #[[$ID1]](%{{.*}}) 56 57 return 58} 59