[clang-tidy][NFC]remove deps of clang in clang tidy test (#116588)
[llvm-project.git] / mlir / test / Dialect / Vector / vector-scalable-create-mask-lowering.mlir
blob772388b6490c6ea13730b888cacc8bdde6cefb4e
1 // RUN: mlir-opt %s --transform-interpreter | FileCheck %s
3 // CHECK-LABEL: func.func @create_mask_2d_trailing_scalable(
4 // CHECK-SAME: %[[arg:.*]]: index) -> vector<3x[4]xi1> {
5 // CHECK-DAG: %[[zero_mask_1d:.*]] = arith.constant dense<false> : vector<[4]xi1>
6 // CHECK-DAG: %[[zero_mask_2d:.*]] = arith.constant dense<false> : vector<3x[4]xi1>
7 // CHECK-NEXT: %[[create_mask_1d:.*]] = vector.create_mask %[[arg]] : vector<[4]xi1>
8 // CHECK-NEXT: %[[res_0:.*]] = vector.insert %[[create_mask_1d]], %[[zero_mask_2d]] [0] : vector<[4]xi1> into vector<3x[4]xi1>
9 // CHECK-NEXT: %[[res_1:.*]] = vector.insert %[[create_mask_1d]], %[[res_0]] [1] : vector<[4]xi1> into vector<3x[4]xi1>
10 // CHECK-NEXT: %[[res_2:.*]] = vector.insert %[[zero_mask_1d]], %[[res_1]] [2] : vector<[4]xi1> into vector<3x[4]xi1>
11 // CHECK-NEXT: return %[[res_2]] : vector<3x[4]xi1>
12 func.func @create_mask_2d_trailing_scalable(%a: index) -> vector<3x[4]xi1> {
13   %c2 = arith.constant 2 : index
14   %mask = vector.create_mask %c2, %a : vector<3x[4]xi1>
15   return %mask : vector<3x[4]xi1>
18 // -----
20 /// The following cannot be lowered as the current lowering requires unrolling
21 /// the leading dim.
23 // CHECK-LABEL: func.func @cannot_create_mask_2d_leading_scalable(
24 // CHECK-SAME: %[[arg:.*]]: index) -> vector<[4]x4xi1> {
25 // CHECK: %{{.*}} = vector.create_mask %[[arg]], %{{.*}} : vector<[4]x4xi1>
26 func.func @cannot_create_mask_2d_leading_scalable(%a: index) -> vector<[4]x4xi1> {
27   %c1 = arith.constant 1 : index
28   %mask = vector.create_mask %a, %c1 : vector<[4]x4xi1>
29   return %mask : vector<[4]x4xi1>
32 module attributes {transform.with_named_sequence} {
33   transform.named_sequence @__transform_main(%module_op: !transform.any_op {transform.readonly}) {
34     %f = transform.structured.match ops{["func.func"]} in %module_op
35       : (!transform.any_op) -> !transform.any_op
37     transform.apply_patterns to %f {
38       transform.apply_patterns.vector.lower_create_mask
39     } : !transform.any_op
40     transform.yield
41   }