1 // RUN: mlir-opt %s -convert-scf-to-std -convert-vector-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
2 // RUN: mlir-cpu-runner -e entry -entry-point-result=void \
3 // RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
6 // NOTE: This is similar to test-create-mask.mlir, but with a different length,
7 // because the v4i1 vector specifically exposed bugs in the LLVM backend.
10 %c0 = arith.constant 0 : index
11 %c1 = arith.constant 1 : index
12 %c2 = arith.constant 2 : index
13 %c3 = arith.constant 3 : index
14 %c5 = arith.constant 5 : index
20 %1 = vector.create_mask %c2 : vector<4xi1>
21 vector.print %1 : vector<4xi1>
22 // CHECK: ( 1, 1, 0, 0 )
24 scf.for %i = %c0 to %c5 step %c1 {
25 %2 = vector.create_mask %i : vector<4xi1>
26 vector.print %2 : vector<4xi1>
28 // CHECK: ( 0, 0, 0, 0 )
29 // CHECK: ( 1, 0, 0, 0 )
30 // CHECK: ( 1, 1, 0, 0 )
31 // CHECK: ( 1, 1, 1, 0 )
32 // CHECK: ( 1, 1, 1, 1 )
38 %3 = vector.create_mask %c2, %c3 : vector<4x4xi1>
39 vector.print %3 : vector<4x4xi1>
40 // CHECK: ( ( 1, 1, 1, 0 ), ( 1, 1, 1, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
42 %4 = vector.create_mask %c3, %c2 : vector<4x4xi1>
43 vector.print %4 : vector<4x4xi1>
44 // CHECK: ( ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 0, 0, 0, 0 ) )
46 scf.for %i = %c0 to %c5 step %c1 {
47 %5 = vector.create_mask %c2, %i : vector<4x4xi1>
48 vector.print %5 : vector<4x4xi1>
50 // CHECK: ( ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
51 // CHECK: ( ( 1, 0, 0, 0 ), ( 1, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
52 // CHECK: ( ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
53 // CHECK: ( ( 1, 1, 1, 0 ), ( 1, 1, 1, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
54 // CHECK: ( ( 1, 1, 1, 1 ), ( 1, 1, 1, 1 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
56 scf.for %i = %c0 to %c5 step %c1 {
57 %6 = vector.create_mask %i, %c2 : vector<4x4xi1>
58 vector.print %6 : vector<4x4xi1>
60 // CHECK: ( ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
61 // CHECK: ( ( 1, 1, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
62 // CHECK: ( ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
63 // CHECK: ( ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 0, 0, 0, 0 ) )
64 // CHECK: ( ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ), ( 1, 1, 0, 0 ) )
66 scf.for %i = %c0 to %c5 step %c1 {
67 scf.for %j = %c0 to %c5 step %c1 {
68 %7 = vector.create_mask %i, %j : vector<4x4xi1>
69 vector.print %7 : vector<4x4xi1>
72 // CHECK: ( ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
73 // CHECK: ( ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ) )
74 // CHECK: ( ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0, 0, 0 ), ( 0, 0,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