4
4
// memref.alloc exists here because sub-byte vector data types such as i2
5
5
// are currently not supported as input arguments.
6
6
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 >) {
8
8
%0 = memref.alloc () : memref <3 x3 xi2 >
9
9
%c0 = arith.constant 0 : index
10
10
%c2 = arith.constant 2 : index
11
11
vector.store %arg0 , %0 [%c2 , %c0 ] :memref <3 x3 xi2 >, vector <3 xi2 >
12
12
return
13
13
}
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.
15
17
16
- // CHECK: func @vector_store_i2_const_index_two_rmw (
18
+ // CHECK: func @vector_store_i2_const_index_two_partial_stores (
17
19
// CHECK-SAME: %[[ARG0:.+]]: vector<3xi2>)
18
20
// CHECK: %[[ALLOC:.+]] = memref.alloc() : memref<3xi8>
19
21
// CHECK: %[[C1:.+]] = arith.constant 1 : index
@@ -47,15 +49,17 @@ func.func @vector_store_i2_const_index_two_rmw(%arg0: vector<3xi2>) {
47
49
48
50
// -----
49
51
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 >) {
51
53
%0 = memref.alloc () : memref <3 x7 xi2 >
52
54
%c0 = arith.constant 0 : index
53
55
%c1 = arith.constant 1 : index
54
56
vector.store %arg0 , %0 [%c1 , %c0 ] :memref <3 x7 xi2 >, vector <7 xi2 >
55
57
return
56
58
}
57
59
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(
59
63
// CHECK-SAME: %[[ARG0:.+]]:
60
64
// CHECK: %[[ALLOC:.+]] = memref.alloc() : memref<6xi8>
61
65
// CHECK: %[[C1:.+]] = arith.constant 1 : index
@@ -94,16 +98,17 @@ func.func @vector_store_i2_rmw(%arg0: vector<7xi2>) {
94
98
95
99
// -----
96
100
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 >) {
98
102
%0 = memref.alloc () : memref <4 x1 xi2 >
99
103
%c0 = arith.constant 0 : index
100
104
%c1 = arith.constant 1 : index
101
105
vector.store %arg0 , %0 [%c1 , %c0 ] :memref <4 x1 xi2 >, vector <1 xi2 >
102
106
return
103
107
}
104
108
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(
107
112
// CHECK-SAME: %[[ARG0:.+]]: vector<1xi2>)
108
113
// CHECK: %[[ALLOC:.+]] = memref.alloc() : memref<1xi8>
109
114
// CHECK: %[[C0:.+]] = arith.constant 0 : index
@@ -116,4 +121,3 @@ func.func @vector_store_i2_single_rmw(%arg0: vector<1xi2>) {
116
121
// CHECK: %[[SELECT:.+]] = arith.select %[[CST]], %[[INSERT]], %[[UPCAST]]
117
122
// CHECK: %[[DOWNCAST:.+]] = vector.bitcast %[[SELECT]]
118
123
// CHECK: vector.store %[[DOWNCAST]], %[[ALLOC]][%[[C0]]]
119
-
0 commit comments