// RUN: mlir-opt %s | mlir-opt -test-greedy-patterns | FileCheck %s // CHECK-LABEL: @test_enum_attr_roundtrip func.func @test_enum_attr_roundtrip() -> () { // CHECK: value = #test "test.op"() {value = #test} : () -> () // CHECK: value = #test "test.op"() {value = #test} : () -> () // CHECK: value = #test "test.op"() {value = #test} : () -> () return } // CHECK-LABEL: @test_op_with_enum func.func @test_op_with_enum() -> () { // CHECK: test.op_with_enum third test.op_with_enum third return } // CHECK-LABEL: @test_match_op_with_enum func.func @test_match_op_with_enum() -> () { // CHECK: test.op_with_enum third tag 0 : i32 test.op_with_enum third tag 0 : i32 // CHECK: test.op_with_enum second tag 1 : i32 test.op_with_enum first tag 0 : i32 return } // CHECK-LABEL: @test_match_op_with_bit_enum func.func @test_match_op_with_bit_enum() -> () { // CHECK: test.op_with_bit_enum tag 0 : i32 test.op_with_bit_enum tag 0 : i32 // CHECK: test.op_with_bit_enum tag 1 : i32 test.op_with_bit_enum tag 0 : i32 return } // CHECK-LABEL: @test_enum_prop func.func @test_enum_prop() -> () { // CHECK: test.op_with_enum_prop first test.op_with_enum_prop first // CHECK: test.op_with_enum_prop first "test.op_with_enum_prop"() <{value = 0 : i32}> {} : () -> () // CHECK: test.op_with_enum_prop_attr_form <{value = 0 : i32}> test.op_with_enum_prop_attr_form <{value = 0 : i32}> // CHECK: test.op_with_enum_prop_attr_form <{value = 1 : i32}> test.op_with_enum_prop_attr_form <{value = #test}> // CHECK: test.op_with_enum_prop_attr_form_always <{value = #test}> test.op_with_enum_prop_attr_form_always <{value = #test}> // CHECK: test.op_with_enum_prop_attr_form_always <{value = #test} test.op_with_enum_prop_attr_form_always <{value = #test}> return } // CHECK-LABEL: @test_two_default_enum_props func.func @test_two_default_enum_props() -> () { // Both default: both elided. // CHECK: test.op_with_two_default_enum_props{{$}} test.op_with_two_default_enum_props // value1 non-default, value2 default (dog): only value1 printed. // CHECK: test.op_with_two_default_enum_props second{{$}} test.op_with_two_default_enum_props second // value1 default (first), value2 non-default: only value2 printed. // Key test: value1 parser must not consume "cat" (not a TestEnum keyword). // CHECK: test.op_with_two_default_enum_props cat{{$}} test.op_with_two_default_enum_props cat // Both non-default. // CHECK: test.op_with_two_default_enum_props second cat{{$}} test.op_with_two_default_enum_props second cat return } // CHECK-LABEL: @test_two_default_bit_enum_props func.func @test_two_default_bit_enum_props() -> () { // Both default: both elided. // CHECK: test.op_with_two_default_bit_enum_props{{$}} test.op_with_two_default_bit_enum_props // value1 non-default (write), value2 default (user): only value1 printed. // CHECK: test.op_with_two_default_bit_enum_props write{{$}} test.op_with_two_default_bit_enum_props write // value1 default (read), value2 non-default: only value2 printed. // Key test: value1 parser must not consume "group" (not a TestBitEnum keyword). // CHECK: test.op_with_two_default_bit_enum_props group{{$}} test.op_with_two_default_bit_enum_props group // Both non-default. // CHECK: test.op_with_two_default_bit_enum_props write group{{$}} test.op_with_two_default_bit_enum_props write group return } // CHECK-LABEL @test_bit_enum_prop() func.func @test_bit_enum_prop() -> () { // CHECK: test.op_with_bit_enum_prop read : () test.op_with_bit_enum_prop read read : () // CHECK: test.op_with_bit_enum_prop read, write write, execute test.op_with_bit_enum_prop read, write write, execute : () // CHECK: test.op_with_bit_enum_prop read, execute write "test.op_with_bit_enum_prop"() <{value1 = 5 : i32, value2 = 2 : i32}> {} : () -> () // CHECK: test.op_with_bit_enum_prop read, write, execute test.op_with_bit_enum_prop read, write, execute : () // CHECK: test.op_with_bit_enum_prop_named bit_enum{{$}} test.op_with_bit_enum_prop_named bit_enum bit_enum // CHECK: test.op_with_bit_enum_prop_named bit_enum bit_enum test.op_with_bit_enum_prop_named bit_enum bit_enum // CHECK: test.op_with_bit_enum_prop_named bit_enum test.op_with_bit_enum_prop_named bit_enum return }