Skip to content

Commit 2b8a653

Browse files
committed
Add test case for scalable vector
1 parent 24b0739 commit 2b8a653

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

mlir/test/Dialect/Vector/linearize.mlir

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,22 @@ func.func @linearize_create_mask() -> vector<1x16xi1> {
364364
%0 = vector.create_mask %c0, %c20 : vector<1x16xi1>
365365
return %0 : vector<1x16xi1>
366366
}
367+
368+
// -----
369+
// ALL-LABEL: linearize_scalable_create_mask
370+
func.func @linearize_scalable_create_mask() -> vector<1x[16]xi1> {
371+
// CHECK: %[[C0:.*]] = arith.constant 0 : index
372+
// CHECK: %[[C20:.*]] = arith.constant 20 : index
373+
// CHECK: %[[C0_0:.*]] = arith.constant 0 : index
374+
// CHECK: %[[CMP:.*]] = arith.cmpi sle, %[[C0]], %[[C0_0]] : index
375+
// CHECK: %[[SPLAT:.*]] = vector.splat %[[CMP]] : vector<[16]xi1>
376+
// CHECK: %[[CST:.*]] = arith.constant dense<false> : vector<[16]xi1>
377+
// CHECK: %[[MASK_1D:.*]] = vector.create_mask %[[C20]] : vector<[16]xi1>
378+
// CHECK: %[[SELECT:.*]] = arith.select %[[SPLAT]], %[[CST]], %[[MASK_1D]] : vector<[16]xi1>, vector<[16]xi1>
379+
// CHECK: %[[CAST:.*]] = vector.shape_cast %[[SELECT]] : vector<[16]xi1> to vector<1x[16]xi1>
380+
// CHECK: return %[[CAST]] : vector<1x[16]xi1>
381+
%c0 = arith.constant 0 : index
382+
%c20 = arith.constant 20 : index
383+
%0 = vector.create_mask %c0, %c20 : vector<1x[16]xi1>
384+
return %0 : vector<1x[16]xi1>
385+
}

0 commit comments

Comments
 (0)