@@ -140,6 +140,7 @@ func.func @negative_broadcast_transpose_021(%arg0 : vector<3x1x3xi8>) -> vector<
140
140
141
141
// -----
142
142
143
+ // Test of FoldTransposeShapeCast
143
144
// In this test, the permutation maps the non-unit dimensions (1 and 2) as follows:
144
145
// 1 -> 0
145
146
// 2 -> 4
@@ -158,6 +159,7 @@ func.func @transpose_shape_cast(%arg : vector<1x4x4x1x1xi8>) -> vector<4x4xi8> {
158
159
159
160
// -----
160
161
162
+ // Test of FoldTransposeShapeCast
161
163
// In this test, the mapping of non-unit dimensions (1 and 2) is as follows:
162
164
// 1 -> 2
163
165
// 2 -> 1
@@ -177,6 +179,7 @@ func.func @negative_transpose_shape_cast(%arg : vector<1x4x4x1xi8>) -> vector<4x
177
179
178
180
// -----
179
181
182
+ // Test of FoldTransposeShapeCast
180
183
// Currently the conversion shape_cast(transpose) -> shape_cast is disabled for
181
184
// scalable vectors because of bad interaction with ConvertIllegalShapeCastOpsToTransposes
182
185
// CHECK-LABEL: @negative_transpose_shape_cast_scalable
@@ -190,6 +193,7 @@ func.func @negative_transpose_shape_cast_scalable(%arg : vector<[4]x1xi8>) -> ve
190
193
191
194
// -----
192
195
196
+ // Test of shape_cast folding.
193
197
// The conversion transpose(shape_cast) -> shape_cast is not disabled for scalable
194
198
// vectors.
195
199
// CHECK-LABEL: @shape_cast_transpose_scalable
@@ -203,18 +207,8 @@ func.func @shape_cast_transpose_scalable(%arg : vector<[4]xi8>) -> vector<[4]x1x
203
207
204
208
// -----
205
209
206
- // Scalable dimensions should be treated as non-unit dimensions.
207
- // CHECK-LABEL: @shape_cast_transpose_scalable
208
- // CHECK: vector.shape_cast
209
- // CHECK: vector.transpose
210
- func.func @shape_cast_transpose_scalable_unit (%arg : vector <[1 ]x4 x1 xi8 >) -> vector <4 x[1 ]xi8 > {
211
- %0 = vector.shape_cast %arg : vector <[1 ]x4 x1 xi8 > to vector <[1 ]x4 xi8 >
212
- %1 = vector.transpose %0 , [1 , 0 ] : vector <[1 ]x4 xi8 > to vector <4 x[1 ]xi8 >
213
- return %1 : vector <4 x[1 ]xi8 >
214
- }
215
-
216
- // -----
217
-
210
+ // Test of shape_cast folding.
211
+ // A transpose that is 'order preserving' can be treated like a shape_cast.
218
212
// CHECK-LABEL: @shape_cast_transpose
219
213
// CHECK-SAME: %[[ARG:.*]]: vector<2x3x1x1xi8>) -> vector<6x1x1xi8> {
220
214
// CHECK: %[[SHAPE_CAST:.*]] = vector.shape_cast %[[ARG]] :
@@ -229,6 +223,20 @@ func.func @shape_cast_transpose(%arg : vector<2x3x1x1xi8>) -> vector<6x1x1xi8>
229
223
230
224
// -----
231
225
226
+ // Test of shape_cast folding.
227
+ // Scalable dimensions should be treated as non-unit dimensions.
228
+ // CHECK-LABEL: @shape_cast_transpose_scalable
229
+ // CHECK: vector.shape_cast
230
+ // CHECK: vector.transpose
231
+ func.func @shape_cast_transpose_scalable_unit (%arg : vector <[1 ]x4 x1 xi8 >) -> vector <4 x[1 ]xi8 > {
232
+ %0 = vector.shape_cast %arg : vector <[1 ]x4 x1 xi8 > to vector <[1 ]x4 xi8 >
233
+ %1 = vector.transpose %0 , [1 , 0 ] : vector <[1 ]x4 xi8 > to vector <4 x[1 ]xi8 >
234
+ return %1 : vector <4 x[1 ]xi8 >
235
+ }
236
+
237
+ // -----
238
+
239
+ // Test of shape_cast (not) folding.
232
240
// CHECK-LABEL: @negative_shape_cast_transpose
233
241
// CHECK-SAME: %[[ARG:.*]]: vector<6xi8>) -> vector<2x3xi8> {
234
242
// CHECK: %[[SHAPE_CAST:.*]] = vector.shape_cast %[[ARG]] :
0 commit comments