44// memref.alloc exists here because sub-byte vector data types such as i2
55// are currently not supported as input arguments.
66
7- func.func @vector_store_i2_const_index_two_rmw (%arg0: vector <3 xi2 >) {
7+ func.func @vector_store_i2_const_index_two_partial_stores (%arg0: vector <3 xi2 >) {
88 %0 = memref.alloc () : memref <3 x3 xi2 >
99 %c0 = arith.constant 0 : index
1010 %c2 = arith.constant 2 : index
1111 vector.store %arg0 , %0 [%c2 , %c0 ] :memref <3 x3 xi2 >, vector <3 xi2 >
1212 return
1313}
14- // Load from bit [12:18), byte [1:2] of total 3 bytes, both bytes needs rmw.
14+ // In this example, emit two RMW stores without full-width store.
15+ // Store bit [12:18), byte [1:2] to a 3-byte vector, both bytes are
16+ // accessed partially.
1517
16- // CHECK: func @vector_store_i2_const_index_two_rmw (
18+ // CHECK: func @vector_store_i2_const_index_two_partial_stores (
1719// CHECK-SAME: %[[ARG0:.+]]: vector<3xi2>)
1820// CHECK: %[[ALLOC:.+]] = memref.alloc() : memref<3xi8>
1921// CHECK: %[[C1:.+]] = arith.constant 1 : index
@@ -47,15 +49,17 @@ func.func @vector_store_i2_const_index_two_rmw(%arg0: vector<3xi2>) {
4749
4850// -----
4951
50- func.func @vector_store_i2_rmw (%arg0: vector <7 xi2 >) {
52+ func.func @vector_store_i2_two_partial_one_full_stores (%arg0: vector <7 xi2 >) {
5153 %0 = memref.alloc () : memref <3 x7 xi2 >
5254 %c0 = arith.constant 0 : index
5355 %c1 = arith.constant 1 : index
5456 vector.store %arg0 , %0 [%c1 , %c0 ] :memref <3 x7 xi2 >, vector <7 xi2 >
5557 return
5658}
5759
58- // CHECK: func @vector_store_i2_rmw(
60+ // In this example, emit two RMW stores and one full-width store.
61+
62+ // CHECK: func @vector_store_i2_two_partial_one_full_stores(
5963// CHECK-SAME: %[[ARG0:.+]]:
6064// CHECK: %[[ALLOC:.+]] = memref.alloc() : memref<6xi8>
6165// CHECK: %[[C1:.+]] = arith.constant 1 : index
@@ -94,16 +98,17 @@ func.func @vector_store_i2_rmw(%arg0: vector<7xi2>) {
9498
9599// -----
96100
97- func.func @vector_store_i2_single_rmw (%arg0: vector <1 xi2 >) {
101+ func.func @vector_store_i2_one_partial_store (%arg0: vector <1 xi2 >) {
98102 %0 = memref.alloc () : memref <4 x1 xi2 >
99103 %c0 = arith.constant 0 : index
100104 %c1 = arith.constant 1 : index
101105 vector.store %arg0 , %0 [%c1 , %c0 ] :memref <4 x1 xi2 >, vector <1 xi2 >
102106 return
103107}
104108
105- // in this test, only emit 1 rmw store
106- // CHECK: func @vector_store_i2_single_rmw(
109+ // in this test, only emit partial RMW store as the store is within one byte.
110+
111+ // CHECK: func @vector_store_i2_one_partial_store(
107112// CHECK-SAME: %[[ARG0:.+]]: vector<1xi2>)
108113// CHECK: %[[ALLOC:.+]] = memref.alloc() : memref<1xi8>
109114// CHECK: %[[C0:.+]] = arith.constant 0 : index
@@ -116,4 +121,3 @@ func.func @vector_store_i2_single_rmw(%arg0: vector<1xi2>) {
116121// CHECK: %[[SELECT:.+]] = arith.select %[[CST]], %[[INSERT]], %[[UPCAST]]
117122// CHECK: %[[DOWNCAST:.+]] = vector.bitcast %[[SELECT]]
118123// CHECK: vector.store %[[DOWNCAST]], %[[ALLOC]][%[[C0]]]
119-
0 commit comments