@@ -15,7 +15,7 @@ func.func @unparallel_loop_reduction_unsupported(%in: memref<256x512xf32>, %out:
1515#map = affine_map <(d0 )[s0 ] -> (d0 mod s0 )>
1616#map1 = affine_map <(d0 )[s0 ] -> (d0 floordiv s0 )>
1717
18- func.func @single_loop_unrolling_2D_access_pattern (%arg0: index ) -> memref <2 x2 xf32 > {
18+ func.func @single_loop_unrolling_2D_access_pattern_storeOp (%arg0: index ) -> memref <2 x2 xf32 > {
1919 %c2 = arith.constant 2 : index
2020 %cst = arith.constant 1.0 : f32
2121 %alloc = memref.alloc () : memref <2 x2 xf32 >
@@ -33,7 +33,7 @@ func.func @single_loop_unrolling_2D_access_pattern(%arg0: index) -> memref<2x2xf
3333// CHECK: #[[$ATTR_1:.+]] = affine_map<(d0)[s0] -> (d0 mod s0)>
3434
3535// CHECK-LABEL: func.func @single_loop_unrolling_2D_access_pattern(
36- // CHECK-SAME: %[[VAL_0:[0-9]+|[a-zA-Z$._-][a-zA-Z0-9$._-]*]]: index) -> memref<2x2xf32> {
36+ // CHECK-SAME: %[[VAL_0:[0-9]+|[a-zA-Z$._-][a-zA-Z0-9$._-]*]]: index) -> memref<2x2xf32> {
3737// CHECK: %[[VAL_1:.*]] = arith.constant 2 : index
3838// CHECK: %[[VAL_2:.*]] = arith.constant 1.000000e+00 : f32
3939// CHECK: %[[VAL_3:.*]] = memref.alloc() : memref<2x2xf32>
@@ -43,4 +43,37 @@ func.func @single_loop_unrolling_2D_access_pattern(%arg0: index) -> memref<2x2xf
4343// CHECK: affine.store %[[VAL_2]], %[[VAL_3]]{{\[}}%[[VAL_5]], %[[VAL_6]]] : memref<2x2xf32>
4444// CHECK: }
4545// CHECK: return %[[VAL_3]] : memref<2x2xf32>
46+ // CHECK: }
47+
48+ // -----
49+
50+ #map = affine_map <(d0 )[s0 ] -> (d0 mod s0 )>
51+ #map1 = affine_map <(d0 )[s0 ] -> (d0 floordiv s0 )>
52+
53+ func.func @single_loop_unrolling_2D_access_pattern_loadOp (%arg0: index ) -> memref <2 x2 xf32 > {
54+ %c2 = arith.constant 2 : index
55+ %alloc = memref.alloc () : memref <2 x2 xf32 >
56+
57+ affine.for %i = 0 to 4 {
58+ %row = affine.apply #map1 (%i )[%c2 ]
59+ %col = affine.apply #map (%i )[%c2 ]
60+ %val = affine.load %alloc [%row , %col ] : memref <2 x2 xf32 >
61+ }
62+
63+ return %alloc : memref <2 x2 xf32 >
64+ }
65+
66+ // CHECK: #[[$ATTR_0:.+]] = affine_map<(d0)[s0] -> (d0 floordiv s0)>
67+ // CHECK: #[[$ATTR_1:.+]] = affine_map<(d0)[s0] -> (d0 mod s0)>
68+
69+ // CHECK-LABEL: func.func @single_loop_unrolling_2D_access_pattern(
70+ // CHECK-SAME: %[[VAL_0:[0-9]+|[a-zA-Z$._-][a-zA-Z0-9$._-]*]]: index) -> memref<2x2xf32> {
71+ // CHECK: %[[VAL_1:.*]] = arith.constant 2 : index
72+ // CHECK: %[[VAL_2:.*]] = memref.alloc() : memref<2x2xf32>
73+ // CHECK: affine.for %[[VAL_3:.*]] = 0 to 4 {
74+ // CHECK: %[[VAL_4:.*]] = affine.apply #[[$ATTR_0]](%[[VAL_3]]){{\[}}%[[VAL_1]]]
75+ // CHECK: %[[VAL_5:.*]] = affine.apply #[[$ATTR_1]](%[[VAL_3]]){{\[}}%[[VAL_1]]]
76+ // CHECK: %[[VAL_6:.*]] = affine.load %[[VAL_2]]{{\[}}%[[VAL_4]], %[[VAL_5]]] : memref<2x2xf32>
77+ // CHECK: }
78+ // CHECK: return %[[VAL_2]] : memref<2x2xf32>
4679// CHECK: }
0 commit comments