105 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s2 3//===----------------------------------------------------------------------===//4// Test OpAsmOpInterface5//===----------------------------------------------------------------------===//6 7func.func @result_name_from_op_asm_type_interface() {8 // CHECK-LABEL: @result_name_from_op_asm_type_interface9 // CHECK: %op_asm_type_interface10 %0 = "test.result_name_from_type"() : () -> !test.op_asm_type_interface11 return12}13 14// -----15 16func.func @block_argument_name_from_op_asm_type_interface() {17 // CHECK-LABEL: @block_argument_name_from_op_asm_type_interface18 // CHECK: ^bb0(%op_asm_type_interface19 test.block_argument_name_from_type {20 ^bb0(%arg0: !test.op_asm_type_interface):21 "test.terminator"() : ()->()22 }23 return24}25 26// -----27 28//===----------------------------------------------------------------------===//29// Test OpAsmTypeInterface30//===----------------------------------------------------------------------===//31 32func.func @result_name_from_op_asm_type_interface_asmprinter() {33 // CHECK-LABEL: @result_name_from_op_asm_type_interface_asmprinter34 // CHECK: %op_asm_type_interface35 %0 = "test.result_name_from_type_interface"() : () -> !test.op_asm_type_interface36 return37}38 39// -----40 41// i1 does not have OpAsmTypeInterface, should not get named.42func.func @result_name_from_op_asm_type_interface_not_all() {43 // CHECK-LABEL: @result_name_from_op_asm_type_interface_not_all44 // CHECK-NOT: %op_asm_type_interface45 // CHECK: %0:246 %0:2 = "test.result_name_from_type_interface"() : () -> (!test.op_asm_type_interface, i1)47 return48}49 50// -----51 52func.func @block_argument_name_from_op_asm_type_interface_asmprinter() {53 // CHECK-LABEL: @block_argument_name_from_op_asm_type_interface_asmprinter54 // CHECK: ^bb0(%op_asm_type_interface55 test.block_argument_name_from_type_interface {56 ^bb0(%arg0: !test.op_asm_type_interface):57 "test.terminator"() : ()->()58 }59 return60}61 62// -----63 64// CHECK: !op_asm_type_interface_type =65!type = !test.op_asm_type_interface66 67func.func @alias_from_op_asm_type_interface() {68 %0 = "test.result_name_from_type"() : () -> !type69 return70}71 72// -----73 74// CHECK: !op_asm_type_interface_tablegen_default =75!type = !test.op_asm_type_interface_tablegen_default76 77func.func @alias_from_op_asm_type_interface_tablegen_default() {78 %0 = "test.result_name_from_type"() : () -> !type79 return80}81 82// -----83 84//===----------------------------------------------------------------------===//85// Test OpAsmAttrInterface86//===----------------------------------------------------------------------===//87 88// CHECK: #op_asm_attr_interface_test89#attr = #test.op_asm_attr_interface<value = "test">90 91func.func @test_op_asm_attr_interface() {92 %1 = "test.result_name_from_type"() {attr = #attr} : () -> !test.op_asm_type_interface93 return94}95 96// -----97 98// CHECK: #op_asm_attr_interface_tablegen_default99#attr = #test.op_asm_attr_interface_tablegen_default<value = "test">100 101func.func @test_op_asm_attr_interface() {102 %1 = "test.result_name_from_type"() {attr = #attr} : () -> !test.op_asm_type_interface103 return104}105