1 // # RUN: mlir-opt %s -split-input-file | mlir-opt |FileCheck %s
2 // # RUN: mlir-opt %s -mlir-print-op-generic -split-input-file | mlir-opt -mlir-print-op-generic | FileCheck %s --check-prefix=GENERIC
4 // CHECK: test.with_properties
5 // CHECK-SAME: a = 32, b = "foo", c = "bar", flag = true, array = [1, 2, 3, 4]{{$}}
6 // GENERIC: "test.with_properties"()
7 // GENERIC-SAME: <{a = 32 : i64, array = array<i64: 1, 2, 3, 4>, b = "foo", c = "bar", flag = true}> : () -> ()
8 test.with_properties a = 32, b = "foo", c = "bar", flag = true, array = [1, 2, 3, 4]
10 // CHECK: test.with_nice_properties
11 // CHECK-SAME: "foo bar" is -3{{$}}
12 // GENERIC: "test.with_nice_properties"()
13 // GENERIC-SAME: <{prop = {label = "foo bar", value = -3 : i32}}> : () -> ()
14 test.with_nice_properties "foo bar" is -3
16 // CHECK: test.with_wrapped_properties
17 // CHECK-SAME: <{prop = "content for properties"}>{{$}}
18 // GENERIC: "test.with_wrapped_properties"()
19 // GENERIC-SAME: <{prop = "content for properties"}> : () -> ()
20 test.with_wrapped_properties <{prop = "content for properties"}>
22 // CHECK: test.empty_properties
23 // GENERIC: "test.empty_properties"()
26 // CHECK: test.using_property_in_custom
27 // CHECK-SAME: [1, 4, 20]{{$}}
28 // GENERIC: "test.using_property_in_custom"()
29 // GENERIC-SAME: prop = array<i64: 1, 4, 20>
30 test.using_property_in_custom [1, 4, 20]
32 // CHECK: test.using_property_ref_in_custom
33 // CHECK-SAME: 1 + 4 = 5{{$}}
34 // GENERIC: "test.using_property_ref_in_custom"()
36 // GENERIC-SAME: first = 1
37 // GENERIC-SAME: second = 4
39 test.using_property_ref_in_custom 1 + 4 = 5
41 // CHECK: test.with_default_valued_properties na{{$}}
42 // GENERIC: "test.with_default_valued_properties"()
43 // GENERIC-SAME: <{a = 0 : i32, b = "", c = -1 : i32, unit = false}> : () -> ()
44 test.with_default_valued_properties 0 "" -1 unit_absent
46 // CHECK: test.with_default_valued_properties 1 "foo" 0 unit{{$}}
47 // GENERIC: "test.with_default_valued_properties"()
48 // GENERIC-SAME: <{a = 1 : i32, b = "foo", c = 0 : i32, unit}> : () -> ()
49 test.with_default_valued_properties 1 "foo" 0 unit
51 // CHECK: test.with_optional_properties
52 // CHECK-SAME: simple = 0
53 // GENERIC: "test.with_optional_properties"()
54 // GENERIC-SAME: <{hasDefault = [], hasUnit = false, longSyntax = [], maybeUnit = [], nested = [], nonTrivialStorage = [], simple = [0]}> : () -> ()
55 test.with_optional_properties simple = 0
57 // CHECK: test.with_optional_properties{{$}}
58 // GENERIC: "test.with_optional_properties"()
59 // GENERIC-SAME: simple = []
60 test.with_optional_properties
62 // CHECK: test.with_optional_properties
63 // CHECK-SAME: anAttr = 0 simple = 1 nonTrivialStorage = "foo" hasDefault = some<0> nested = some<1> longSyntax = some<"bar"> hasUnit maybeUnit = some<unit>
64 // GENERIC: "test.with_optional_properties"()
65 // GENERIC-SAME: <{anAttr = 0 : i32, hasDefault = [0], hasUnit, longSyntax = ["bar"], maybeUnit = [unit], nested = {{\[}}[1]], nonTrivialStorage = ["foo"], simple = [1]}> : () -> ()
66 test.with_optional_properties
69 nonTrivialStorage = "foo"
72 longSyntax = some<"bar">
74 maybeUnit = some<unit>
76 // CHECK: test.with_optional_properties
77 // CHECK-SAME: nested = some<none>
78 // GENERIC: "test.with_optional_properties"()
79 // GENERIC-SAME: nested = {{\[}}[]]
80 test.with_optional_properties nested = some<none>
82 // CHECK: test.with_array_properties
83 // CHECK-SAME: ints = [1, 2] strings = ["a", "b"] nested = {{\[}}[1, 2], [3, 4]] opt = [-1, -2] explicitOptions = [none, 0] explicitUnits = [unit, unit_absent]
84 // GENERIC: "test.with_array_properties"()
85 test.with_array_properties ints = [1, 2] strings = ["a", "b"] nested = [[1, 2], [3, 4]] opt = [-1, -2] explicitOptions = [none, 0] explicitUnits = [unit, unit_absent] [] thats_has_default