83 lines · plain
1// RUN: mlir-opt %s | mlir-opt -test-greedy-patterns | FileCheck %s2 3// CHECK-LABEL: @test_enum_attr_roundtrip4func.func @test_enum_attr_roundtrip() -> () {5 // CHECK: value = #test<enum first>6 "test.op"() {value = #test<enum first>} : () -> ()7 // CHECK: value = #test<enum second>8 "test.op"() {value = #test<enum second>} : () -> ()9 // CHECK: value = #test<enum third>10 "test.op"() {value = #test<enum third>} : () -> ()11 return12}13 14// CHECK-LABEL: @test_op_with_enum15func.func @test_op_with_enum() -> () {16 // CHECK: test.op_with_enum third17 test.op_with_enum third18 return19}20 21// CHECK-LABEL: @test_match_op_with_enum22func.func @test_match_op_with_enum() -> () {23 // CHECK: test.op_with_enum third tag 0 : i3224 test.op_with_enum third tag 0 : i3225 // CHECK: test.op_with_enum second tag 1 : i3226 test.op_with_enum first tag 0 : i3227 return28}29 30// CHECK-LABEL: @test_match_op_with_bit_enum31func.func @test_match_op_with_bit_enum() -> () {32 // CHECK: test.op_with_bit_enum <write> tag 0 : i3233 test.op_with_bit_enum <write> tag 0 : i3234 // CHECK: test.op_with_bit_enum <read, execute> tag 1 : i3235 test.op_with_bit_enum <execute, write> tag 0 : i3236 return37}38 39// CHECK-LABEL: @test_enum_prop40func.func @test_enum_prop() -> () {41 // CHECK: test.op_with_enum_prop first42 test.op_with_enum_prop first43 44 // CHECK: test.op_with_enum_prop first45 "test.op_with_enum_prop"() <{value = 0 : i32}> {} : () -> ()46 47 // CHECK: test.op_with_enum_prop_attr_form <{value = 0 : i32}>48 test.op_with_enum_prop_attr_form <{value = 0 : i32}>49 // CHECK: test.op_with_enum_prop_attr_form <{value = 1 : i32}>50 test.op_with_enum_prop_attr_form <{value = #test<enum second>}>51 52 // CHECK: test.op_with_enum_prop_attr_form_always <{value = #test<enum first>}>53 test.op_with_enum_prop_attr_form_always <{value = #test<enum first>}>54 // CHECK: test.op_with_enum_prop_attr_form_always <{value = #test<enum second>}55 test.op_with_enum_prop_attr_form_always <{value = #test<enum second>}>56 57 return58}59 60// CHECK-LABEL @test_bit_enum_prop()61func.func @test_bit_enum_prop() -> () {62 // CHECK: test.op_with_bit_enum_prop read : ()63 test.op_with_bit_enum_prop read read : ()64 65 // CHECK: test.op_with_bit_enum_prop read, write write, execute66 test.op_with_bit_enum_prop read, write write, execute : ()67 68 // CHECK: test.op_with_bit_enum_prop read, execute write69 "test.op_with_bit_enum_prop"() <{value1 = 5 : i32, value2 = 2 : i32}> {} : () -> ()70 71 // CHECK: test.op_with_bit_enum_prop read, write, execute72 test.op_with_bit_enum_prop read, write, execute : ()73 74 // CHECK: test.op_with_bit_enum_prop_named bit_enum<read>{{$}}75 test.op_with_bit_enum_prop_named bit_enum<read> bit_enum<read>76 // CHECK: test.op_with_bit_enum_prop_named bit_enum<read, write> bit_enum<write, execute>77 test.op_with_bit_enum_prop_named bit_enum<read, write> bit_enum<write, execute>78 // CHECK: test.op_with_bit_enum_prop_named bit_enum<read, write, execute>79 test.op_with_bit_enum_prop_named bit_enum<read, write, execute>80 81 return82}83