Mercurial > hg > CbC > CbC_llvm
comparison mlir/test/mlir-tblgen/op-format.mlir @ 236:c4bab56944e8 llvm-original
LLVM 16
author | kono |
---|---|
date | Wed, 09 Nov 2022 17:45:10 +0900 |
parents | 5f17cb93ff66 |
children | 1f2b6ac9f198 |
comparison
equal
deleted
inserted
replaced
232:70dce7da266c | 236:c4bab56944e8 |
---|---|
149 test.format_operand_e_op %i64, %memref : i64, memref<1xf64> | 149 test.format_operand_e_op %i64, %memref : i64, memref<1xf64> |
150 | 150 |
151 // CHECK: test.format_variadic_operand %[[I64]], %[[I64]], %[[I64]] : i64, i64, i64 | 151 // CHECK: test.format_variadic_operand %[[I64]], %[[I64]], %[[I64]] : i64, i64, i64 |
152 test.format_variadic_operand %i64, %i64, %i64 : i64, i64, i64 | 152 test.format_variadic_operand %i64, %i64, %i64 : i64, i64, i64 |
153 | 153 |
154 // CHECK: test.format_variadic_of_variadic_operand (%[[I64]], %[[I64]]), (), (%[[I64]]) : (i64, i64), (), (i64) | |
155 test.format_variadic_of_variadic_operand (%i64, %i64), (), (%i64) : (i64, i64), (), (i64) | |
156 | |
154 // CHECK: test.format_multiple_variadic_operands (%[[I64]], %[[I64]], %[[I64]]), (%[[I64]], %[[I32]] : i64, i32) | 157 // CHECK: test.format_multiple_variadic_operands (%[[I64]], %[[I64]], %[[I64]]), (%[[I64]], %[[I32]] : i64, i32) |
155 test.format_multiple_variadic_operands (%i64, %i64, %i64), (%i64, %i32 : i64, i32) | 158 test.format_multiple_variadic_operands (%i64, %i64, %i64), (%i64, %i32 : i64, i32) |
156 | 159 |
157 //===----------------------------------------------------------------------===// | 160 //===----------------------------------------------------------------------===// |
158 // Format successors | 161 // Format successors |
159 //===----------------------------------------------------------------------===// | 162 //===----------------------------------------------------------------------===// |
160 | 163 |
161 "foo.successor_test_region"() ( { | 164 "foo.successor_test_region"() ({ |
162 ^bb0: | 165 ^bb0: |
163 // CHECK: test.format_successor_a_op ^bb1 {attr} | 166 // CHECK: test.format_successor_a_op ^bb1 {attr} |
164 test.format_successor_a_op ^bb1 {attr} | 167 test.format_successor_a_op ^bb1 {attr} |
165 | 168 |
166 ^bb1: | 169 ^bb1: |
192 | 195 |
193 // CHECK: test.format_optional_enum_attr | 196 // CHECK: test.format_optional_enum_attr |
194 // CHECK-NOT: "case5" | 197 // CHECK-NOT: "case5" |
195 test.format_optional_enum_attr | 198 test.format_optional_enum_attr |
196 | 199 |
200 // CHECK: test.format_optional_default_attrs "foo" @foo case10 | |
201 test.format_optional_default_attrs "foo" @foo case10 | |
202 | |
203 // CHECK: test.format_optional_default_attr | |
204 // CHECK-NOT: "default" | |
205 // CHECK-NOT: @default | |
206 // CHECK-NOT: case5 | |
207 test.format_optional_default_attrs "default" @default case5 | |
208 | |
197 //===----------------------------------------------------------------------===// | 209 //===----------------------------------------------------------------------===// |
198 // Format optional operands and results | 210 // Format optional operands and results |
199 //===----------------------------------------------------------------------===// | 211 //===----------------------------------------------------------------------===// |
200 | 212 |
201 // CHECK: test.format_optional_operand_result_a_op(%[[I64]] : i64) : i64 | 213 // CHECK: test.format_optional_operand_result_a_op(%[[I64]] : i64) : i64 |
248 | 260 |
249 // CHECK: test.format_optional_else else | 261 // CHECK: test.format_optional_else else |
250 test.format_optional_else else | 262 test.format_optional_else else |
251 | 263 |
252 //===----------------------------------------------------------------------===// | 264 //===----------------------------------------------------------------------===// |
265 // Format a custom attribute | |
266 //===----------------------------------------------------------------------===// | |
267 | |
268 // CHECK: test.format_compound_attr <1, !test.smpla, [5, 6]> | |
269 test.format_compound_attr <1, !test.smpla, [5, 6]> | |
270 | |
271 //----- | |
272 | |
273 | |
274 // CHECK: module attributes {test.nested = #test.cmpnd_nested<nested = <1, !test.smpla, [5, 6]>>} { | |
275 module attributes {test.nested = #test.cmpnd_nested<nested = <1, !test.smpla, [5, 6]>>} { | |
276 } | |
277 | |
278 //----- | |
279 | |
280 // Same as above, but fully spelling the inner attribute prefix `#test.cmpnd_a`. | |
281 // CHECK: module attributes {test.nested = #test.cmpnd_nested<nested = <1, !test.smpla, [5, 6]>>} { | |
282 module attributes {test.nested = #test.cmpnd_nested<nested = #test.cmpnd_a<1, !test.smpla, [5, 6]>>} { | |
283 } | |
284 | |
285 // CHECK: test.format_nested_attr <nested = <1, !test.smpla, [5, 6]>> | |
286 test.format_nested_attr #test.cmpnd_nested<nested = <1, !test.smpla, [5, 6]>> | |
287 | |
288 //----- | |
289 | |
290 // Same as above, but fully spelling the inner attribute prefix `#test.cmpnd_a`. | |
291 // CHECK: test.format_nested_attr <nested = <1, !test.smpla, [5, 6]>> | |
292 test.format_nested_attr #test.cmpnd_nested<nested = #test.cmpnd_a<1, !test.smpla, [5, 6]>> | |
293 | |
294 //----- | |
295 | |
296 // CHECK: module attributes {test.someAttr = #test.cmpnd_nested_inner<42 <1, !test.smpla, [5, 6]>>} | |
297 module attributes {test.someAttr = #test.cmpnd_nested_inner<42 <1, !test.smpla, [5, 6]>>} | |
298 { | |
299 } | |
300 | |
301 //----- | |
302 | |
303 // CHECK: module attributes {test.someAttr = #test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>} | |
304 module attributes {test.someAttr = #test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>} | |
305 { | |
306 } | |
307 | |
308 //----- | |
309 | |
310 // CHECK: test.format_cpmd_nested_attr nested <i <42 <1, !test.smpla, [5, 6]>>> | |
311 test.format_cpmd_nested_attr nested <i <42 <1, !test.smpla, [5, 6]>>> | |
312 | |
313 //----- | |
314 | |
315 // CHECK: test.format_qual_cpmd_nested_attr nested #test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>> | |
316 test.format_qual_cpmd_nested_attr nested #test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>> | |
317 | |
318 //----- | |
319 | |
320 // Check the `qualified` directive in the declarative assembly format. | |
321 // CHECK: @qualifiedCompoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>) | |
322 func.func @qualifiedCompoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>) -> () { | |
323 // Verify that the type prefix is not elided | |
324 // CHECK: format_qual_cpmd_nested_type %arg0 nested !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>> | |
325 test.format_qual_cpmd_nested_type %arg0 nested !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>> | |
326 return | |
327 } | |
328 | |
329 //----- | |
330 | |
331 //===----------------------------------------------------------------------===// | |
253 // Format custom directives | 332 // Format custom directives |
254 //===----------------------------------------------------------------------===// | 333 //===----------------------------------------------------------------------===// |
255 | 334 |
256 // CHECK: test.format_custom_directive_operands %[[I64]], %[[I64]] -> (%[[I64]]) | 335 // CHECK: test.format_custom_directive_operands %[[I64]], %[[I64]] -> (%[[I64]]) |
257 test.format_custom_directive_operands %i64, %i64 -> (%i64) | 336 test.format_custom_directive_operands %i64, %i64 -> (%i64) |
305 test.format_custom_directive_with_optional_operand_ref %i64 : 1 | 384 test.format_custom_directive_with_optional_operand_ref %i64 : 1 |
306 | 385 |
307 // CHECK: test.format_custom_directive_with_optional_operand_ref : 0 | 386 // CHECK: test.format_custom_directive_with_optional_operand_ref : 0 |
308 test.format_custom_directive_with_optional_operand_ref : 0 | 387 test.format_custom_directive_with_optional_operand_ref : 0 |
309 | 388 |
310 func @foo() { | 389 func.func @foo() { |
311 // CHECK: test.format_custom_directive_successors ^bb1, ^bb2 | 390 // CHECK: test.format_custom_directive_successors ^bb1, ^bb2 |
312 test.format_custom_directive_successors ^bb1, ^bb2 | 391 test.format_custom_directive_successors ^bb1, ^bb2 |
313 | 392 |
314 ^bb1: | 393 ^bb1: |
315 // CHECK: test.format_custom_directive_successors ^bb2 | 394 // CHECK: test.format_custom_directive_successors ^bb2 |
317 | 396 |
318 ^bb2: | 397 ^bb2: |
319 return | 398 return |
320 } | 399 } |
321 | 400 |
401 // CHECK: test.format_literal_following_optional_group(5 : i32) : i32 {a} | |
402 test.format_literal_following_optional_group(5 : i32) : i32 {a} | |
403 | |
404 func.func @variadic(%a: i32) { | |
405 // CHECK: test.ellipsis(%{{.*}} ...) : i32 ... | |
406 test.ellipsis(%a ...) : i32 ... | |
407 return | |
408 } | |
409 | |
322 //===----------------------------------------------------------------------===// | 410 //===----------------------------------------------------------------------===// |
323 // Format trait type inference | 411 // Format trait type inference |
324 //===----------------------------------------------------------------------===// | 412 //===----------------------------------------------------------------------===// |
325 | 413 |
326 // CHECK: test.format_infer_variadic_type_from_non_variadic %[[I64]], %[[I64]] : i64 | 414 // CHECK: test.format_infer_variadic_type_from_non_variadic %[[I64]], %[[I64]] : i64 |
349 // CHECK: test.format_types_match_attr 1 : i64 | 437 // CHECK: test.format_types_match_attr 1 : i64 |
350 %ignored_res5 = test.format_types_match_attr 1 : i64 | 438 %ignored_res5 = test.format_types_match_attr 1 : i64 |
351 | 439 |
352 // CHECK: test.format_types_match_context %[[I64]] : i64 | 440 // CHECK: test.format_types_match_context %[[I64]] : i64 |
353 %ignored_res6 = test.format_types_match_context %i64 : i64 | 441 %ignored_res6 = test.format_types_match_context %i64 : i64 |
442 | |
443 //===----------------------------------------------------------------------===// | |
444 // InferTypeOpInterface type inference | |
445 //===----------------------------------------------------------------------===// | |
446 | |
447 // CHECK: test.format_infer_type | |
448 %ignored_res7a = test.format_infer_type | |
449 | |
450 // CHECK: test.format_infer_type2 | |
451 %ignored_res7b = test.format_infer_type2 | |
452 | |
453 // CHECK: test.format_infer_type_all_operands_and_types(%[[I64]], %[[I32]]) : i64, i32 | |
454 %ignored_res8:2 = test.format_infer_type_all_operands_and_types(%i64, %i32) : i64, i32 | |
455 | |
456 // CHECK: test.format_infer_type_all_types_one_operand(%[[I64]], %[[I32]]) : i64, i32 | |
457 %ignored_res9:2 = test.format_infer_type_all_types_one_operand(%i64, %i32) : i64, i32 | |
458 | |
459 // CHECK: test.format_infer_type_all_types_two_operands(%[[I64]], %[[I32]]) (%[[I64]], %[[I32]]) : i64, i32, i64, i32 | |
460 %ignored_res10:4 = test.format_infer_type_all_types_two_operands(%i64, %i32) (%i64, %i32) : i64, i32, i64, i32 | |
461 | |
462 // CHECK: test.format_infer_type_all_types(%[[I64]], %[[I32]]) : i64, i32 | |
463 %ignored_res11:2 = test.format_infer_type_all_types(%i64, %i32) : i64, i32 | |
464 | |
465 // CHECK: test.format_infer_type_regions | |
466 // CHECK-NEXT: ^bb0(%{{.*}}: {{.*}}, %{{.*}}: {{.*}}): | |
467 %ignored_res12:2 = test.format_infer_type_regions { | |
468 ^bb0(%arg0: i32, %arg1: f32): | |
469 "test.terminator"() : () -> () | |
470 } | |
471 | |
472 // CHECK: test.format_infer_type_variadic_operands(%[[I32]], %[[I32]] : i32, i32) (%[[I64]], %[[I64]] : i64, i64) | |
473 %ignored_res13:4 = test.format_infer_type_variadic_operands(%i32, %i32 : i32, i32) (%i64, %i64 : i64, i64) | |
474 | |
475 //===----------------------------------------------------------------------===// | |
476 // Check DefaultValuedStrAttr | |
477 //===----------------------------------------------------------------------===// | |
478 | |
479 // CHECK: test.has_str_value | |
480 test.has_str_value {} | |
481 | |
482 //===----------------------------------------------------------------------===// | |
483 // ElseAnchorOp | |
484 //===----------------------------------------------------------------------===// | |
485 | |
486 // CHECK-LABEL: @else_anchor_op | |
487 func.func @else_anchor_op(%a: !test.else_anchor<?>, %b: !test.else_anchor<5>) { | |
488 // CHECK: test.else_anchor(?) {a = !test.else_anchor_struct<?>} | |
489 test.else_anchor(?) {a = !test.else_anchor_struct<?>} | |
490 // CHECK: test.else_anchor(%{{.*}} : !test.else_anchor<?>) {a = !test.else_anchor_struct<a = 0>} | |
491 test.else_anchor(%a : !test.else_anchor<?>) {a = !test.else_anchor_struct<a = 0>} | |
492 // CHECK: test.else_anchor(%{{.*}} : !test.else_anchor<5>) {a = !test.else_anchor_struct<b = 0>} | |
493 test.else_anchor(%b : !test.else_anchor<5>) {a = !test.else_anchor_struct<b = 0>} | |
494 return | |
495 } |