test-create-mask.mlir
6.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// RUN: mlir-opt %s -convert-scf-to-std -convert-vector-to-llvm -convert-std-to-llvm | \
// RUN: mlir-cpu-runner -e entry -entry-point-result=void \
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
func @entry() {
%c0 = constant 0 : index
%c1 = constant 1 : index
%c2 = constant 2 : index
%c3 = constant 3 : index
%c6 = constant 6 : index
//
// 1-D.
//
%1 = vector.create_mask %c2 : vector<5xi1>
vector.print %1 : vector<5xi1>
// CHECK: ( 1, 1, 0, 0, 0 )
scf.for %i = %c0 to %c6 step %c1 {
%2 = vector.create_mask %i : vector<5xi1>
vector.print %2 : vector<5xi1>
}
// CHECK: ( 0, 0, 0, 0, 0 )
// CHECK: ( 1, 0, 0, 0, 0 )
// CHECK: ( 1, 1, 0, 0, 0 )
// CHECK: ( 1, 1, 1, 0, 0 )
// CHECK: ( 1, 1, 1, 1, 0 )
// CHECK: ( 1, 1, 1, 1, 1 )
//
// 2-D.
//
%3 = vector.create_mask %c2, %c3 : vector<5x5xi1>
vector.print %3 : vector<5x5xi1>
// CHECK: ( ( 1, 1, 1, 0, 0 ), ( 1, 1, 1, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
%4 = vector.create_mask %c3, %c2 : vector<5x5xi1>
vector.print %4 : vector<5x5xi1>
// CHECK: ( ( 1, 1, 0, 0, 0 ), ( 1, 1, 0, 0, 0 ), ( 1, 1, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
scf.for %i = %c0 to %c6 step %c1 {
%5 = vector.create_mask %c2, %i : vector<5x5xi1>
vector.print %5 : vector<5x5xi1>
}
// CHECK: ( ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
// CHECK: ( ( 1, 0, 0, 0, 0 ), ( 1, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
// CHECK: ( ( 1, 1, 0, 0, 0 ), ( 1, 1, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
// CHECK: ( ( 1, 1, 1, 0, 0 ), ( 1, 1, 1, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
// CHECK: ( ( 1, 1, 1, 1, 0 ), ( 1, 1, 1, 1, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
// CHECK: ( ( 1, 1, 1, 1, 1 ), ( 1, 1, 1, 1, 1 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
scf.for %i = %c0 to %c6 step %c1 {
%6 = vector.create_mask %i, %c2 : vector<5x5xi1>
vector.print %6 : vector<5x5xi1>
}
// CHECK: ( ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
// CHECK: ( ( 1, 1, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ), ( 0, 0, 0, 0, 0 ) )
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