@@ -27,7 +27,7 @@ namespace mlir {
27
27
28
28
static MLIRContext &getContext () {
29
29
static MLIRContext ctx;
30
- ctx.getOrLoadDialect <TestDialect>();
30
+ ctx.getOrLoadDialect <test:: TestDialect>();
31
31
return ctx;
32
32
}
33
33
// / Test fixture for providing basic utilities for testing.
@@ -36,8 +36,8 @@ class OpBuildGenTest : public ::testing::Test {
36
36
OpBuildGenTest ()
37
37
: ctx(getContext()), builder(&ctx), loc(builder.getUnknownLoc()),
38
38
i32Ty (builder.getI32Type()), f32Ty(builder.getF32Type()),
39
- cstI32(builder.create<TableGenConstant>(loc, i32Ty)),
40
- cstF32(builder.create<TableGenConstant>(loc, f32Ty)),
39
+ cstI32(builder.create<test:: TableGenConstant>(loc, i32Ty)),
40
+ cstF32(builder.create<test:: TableGenConstant>(loc, f32Ty)),
41
41
noAttrs(), attrStorage{builder.getNamedAttr (" attr0" ,
42
42
builder.getBoolAttr (true )),
43
43
builder.getNamedAttr (
@@ -96,8 +96,8 @@ class OpBuildGenTest : public ::testing::Test {
96
96
Location loc;
97
97
Type i32Ty;
98
98
Type f32Ty;
99
- TableGenConstant cstI32;
100
- TableGenConstant cstF32;
99
+ test:: TableGenConstant cstI32;
100
+ test:: TableGenConstant cstF32;
101
101
102
102
ArrayRef<NamedAttribute> noAttrs;
103
103
std::vector<NamedAttribute> attrStorage;
@@ -107,21 +107,21 @@ class OpBuildGenTest : public ::testing::Test {
107
107
// / Test basic build methods.
108
108
TEST_F (OpBuildGenTest, BasicBuildMethods) {
109
109
// Test separate args, separate results build method.
110
- auto op = builder.create <TableGenBuildOp0>(loc, i32Ty, cstI32);
110
+ auto op = builder.create <test:: TableGenBuildOp0>(loc, i32Ty, cstI32);
111
111
verifyOp (op, {i32Ty}, {cstI32}, noAttrs);
112
112
113
113
// Test separate args, collective results build method.
114
- op = builder.create <TableGenBuildOp0>(loc, TypeRange{i32Ty}, cstI32);
114
+ op = builder.create <test:: TableGenBuildOp0>(loc, TypeRange{i32Ty}, cstI32);
115
115
verifyOp (op, {i32Ty}, {cstI32}, noAttrs);
116
116
117
117
// Test collective args, collective params build method.
118
- op = builder.create <TableGenBuildOp0>(loc, TypeRange{i32Ty},
119
- ValueRange{cstI32});
118
+ op = builder.create <test:: TableGenBuildOp0>(loc, TypeRange{i32Ty},
119
+ ValueRange{cstI32});
120
120
verifyOp (op, {i32Ty}, {cstI32}, noAttrs);
121
121
122
122
// Test collective args, collective results, non-empty attributes
123
- op = builder.create <TableGenBuildOp0>(loc, TypeRange{i32Ty},
124
- ValueRange{cstI32}, attrs);
123
+ op = builder.create <test:: TableGenBuildOp0>(loc, TypeRange{i32Ty},
124
+ ValueRange{cstI32}, attrs);
125
125
verifyOp (op, {i32Ty}, {cstI32}, attrs);
126
126
}
127
127
@@ -138,48 +138,49 @@ TEST_F(OpBuildGenTest, BasicBuildMethods) {
138
138
// / variadic result.
139
139
TEST_F (OpBuildGenTest, BuildMethodsSingleVariadicArgAndResult) {
140
140
// Test collective args, collective results method, building a unary op.
141
- auto op = builder.create <TableGenBuildOp1>(loc, TypeRange{i32Ty},
142
- ValueRange{cstI32});
141
+ auto op = builder.create <test:: TableGenBuildOp1>(loc, TypeRange{i32Ty},
142
+ ValueRange{cstI32});
143
143
verifyOp (std::move (op), {i32Ty}, {cstI32}, noAttrs);
144
144
145
145
// Test collective args, collective results method, building a unary op with
146
146
// named attributes.
147
- op = builder.create <TableGenBuildOp1>(loc, TypeRange{i32Ty},
148
- ValueRange{cstI32}, attrs);
147
+ op = builder.create <test:: TableGenBuildOp1>(loc, TypeRange{i32Ty},
148
+ ValueRange{cstI32}, attrs);
149
149
verifyOp (std::move (op), {i32Ty}, {cstI32}, attrs);
150
150
151
151
// Test collective args, collective results method, building a binary op.
152
- op = builder.create <TableGenBuildOp1>(loc, TypeRange{i32Ty, f32Ty},
153
- ValueRange{cstI32, cstF32});
152
+ op = builder.create <test:: TableGenBuildOp1>(loc, TypeRange{i32Ty, f32Ty},
153
+ ValueRange{cstI32, cstF32});
154
154
verifyOp (std::move (op), {i32Ty, f32Ty}, {cstI32, cstF32}, noAttrs);
155
155
156
156
// Test collective args, collective results method, building a binary op with
157
157
// named attributes.
158
- op = builder.create <TableGenBuildOp1>(loc, TypeRange{i32Ty, f32Ty},
159
- ValueRange{cstI32, cstF32}, attrs);
158
+ op = builder.create <test:: TableGenBuildOp1>(
159
+ loc, TypeRange{i32Ty, f32Ty}, ValueRange{cstI32, cstF32}, attrs);
160
160
verifyOp (std::move (op), {i32Ty, f32Ty}, {cstI32, cstF32}, attrs);
161
161
}
162
162
163
163
// / Test build methods for an Op with a single varadic arg and a non-variadic
164
164
// / result.
165
165
TEST_F (OpBuildGenTest, BuildMethodsSingleVariadicArgNonVariadicResults) {
166
166
// Test separate arg, separate param build method.
167
- auto op = builder.create <TableGenBuildOp1>(loc, i32Ty, ValueRange{cstI32});
167
+ auto op =
168
+ builder.create <test::TableGenBuildOp1>(loc, i32Ty, ValueRange{cstI32});
168
169
verifyOp (std::move (op), {i32Ty}, {cstI32}, noAttrs);
169
170
170
171
// Test collective params build method, no attributes.
171
- op = builder.create <TableGenBuildOp1>(loc, TypeRange{i32Ty},
172
- ValueRange{cstI32});
172
+ op = builder.create <test:: TableGenBuildOp1>(loc, TypeRange{i32Ty},
173
+ ValueRange{cstI32});
173
174
verifyOp (std::move (op), {i32Ty}, {cstI32}, noAttrs);
174
175
175
176
// Test collective params build method no attributes, 2 inputs.
176
- op = builder.create <TableGenBuildOp1>(loc, TypeRange{i32Ty},
177
- ValueRange{cstI32, cstF32});
177
+ op = builder.create <test:: TableGenBuildOp1>(loc, TypeRange{i32Ty},
178
+ ValueRange{cstI32, cstF32});
178
179
verifyOp (std::move (op), {i32Ty}, {cstI32, cstF32}, noAttrs);
179
180
180
181
// Test collective params build method, non-empty attributes.
181
- op = builder.create <TableGenBuildOp1>(loc, TypeRange{i32Ty},
182
- ValueRange{cstI32, cstF32}, attrs);
182
+ op = builder.create <test:: TableGenBuildOp1>(
183
+ loc, TypeRange{i32Ty}, ValueRange{cstI32, cstF32}, attrs);
183
184
verifyOp (std::move (op), {i32Ty}, {cstI32, cstF32}, attrs);
184
185
}
185
186
@@ -188,18 +189,18 @@ TEST_F(OpBuildGenTest, BuildMethodsSingleVariadicArgNonVariadicResults) {
188
189
TEST_F (OpBuildGenTest,
189
190
BuildMethodsSingleVariadicArgAndMultipleVariadicResults) {
190
191
// Test separate arg, separate param build method.
191
- auto op = builder.create <TableGenBuildOp3>(
192
+ auto op = builder.create <test:: TableGenBuildOp3>(
192
193
loc, TypeRange{i32Ty}, TypeRange{f32Ty}, ValueRange{cstI32});
193
194
verifyOp (std::move (op), {i32Ty, f32Ty}, {cstI32}, noAttrs);
194
195
195
196
// Test collective params build method, no attributes.
196
- op = builder.create <TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
197
- ValueRange{cstI32});
197
+ op = builder.create <test:: TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
198
+ ValueRange{cstI32});
198
199
verifyOp (std::move (op), {i32Ty, f32Ty}, {cstI32}, noAttrs);
199
200
200
201
// Test collective params build method, with attributes.
201
- op = builder.create <TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
202
- ValueRange{cstI32}, attrs);
202
+ op = builder.create <test:: TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
203
+ ValueRange{cstI32}, attrs);
203
204
verifyOp (std::move (op), {i32Ty, f32Ty}, {cstI32}, attrs);
204
205
}
205
206
@@ -209,13 +210,13 @@ TEST_F(OpBuildGenTest,
209
210
// InferOpTypeInterface interface. For such ops, the ODS framework generates
210
211
// build methods with no result types as they are inferred from the input types.
211
212
TEST_F (OpBuildGenTest, BuildMethodsSameOperandsAndResultTypeSuppression) {
212
- testSingleVariadicInputInferredType<TableGenBuildOp4>();
213
+ testSingleVariadicInputInferredType<test:: TableGenBuildOp4>();
213
214
}
214
215
215
216
TEST_F (
216
217
OpBuildGenTest,
217
218
BuildMethodsSameOperandsAndResultTypeAndInferOpTypeInterfaceSuppression) {
218
- testSingleVariadicInputInferredType<TableGenBuildOp5>();
219
+ testSingleVariadicInputInferredType<test:: TableGenBuildOp5>();
219
220
}
220
221
221
222
} // namespace mlir
0 commit comments