brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · b541447 Raw
100 lines · plain
1// # RUN: mlir-opt %s -split-input-file | mlir-opt | FileCheck %s2// # RUN: mlir-opt %s -mlir-print-op-generic -split-input-file  | mlir-opt -mlir-print-op-generic | FileCheck %s --check-prefix=GENERIC3 4// CHECK:   test.with_properties5// CHECK-SAME: a = 32, b = "foo", c = "bar", flag = true, array = [1, 2, 3, 4], array32 = [5, 6]{{$}}6// GENERIC:   "test.with_properties"()7// GENERIC-SAME: <{a = 32 : i64, array = array<i64: 1, 2, 3, 4>, array32 = array<i32: 5, 6>, b = "foo", c = "bar", flag = true}> : () -> ()8test.with_properties a = 32, b = "foo", c = "bar", flag = true, array = [1, 2, 3, 4], array32 = [5, 6]9 10// CHECK:   test.with_nice_properties11// CHECK-SAME:    "foo bar" is -3{{$}}12// GENERIC: "test.with_nice_properties"()13// GENERIC-SAME:  <{prop = {label = "foo bar", value = -3 : i32}}> : () -> ()14test.with_nice_properties "foo bar" is -315 16// CHECK:   test.with_wrapped_properties17// CHECK-SAME:    <{prop = "content for properties"}>{{$}}18// GENERIC: "test.with_wrapped_properties"()19// GENERIC-SAME:  <{prop = "content for properties"}> : () -> ()20test.with_wrapped_properties <{prop = "content for properties"}>21 22// CHECK: test.empty_properties23// GENERIC: "test.empty_properties"()24test.empty_properties25 26// CHECK: test.using_property_in_custom27// CHECK-SAME: [1, 4, 20]{{$}}28// GENERIC: "test.using_property_in_custom"()29// GENERIC-SAME: prop = array<i64: 1, 4, 20>30test.using_property_in_custom [1, 4, 20]31 32// CHECK: test.using_property_ref_in_custom33// CHECK-SAME: 1 + 4 = 5{{$}}34// GENERIC: "test.using_property_ref_in_custom"()35// GENERIC-SAME: <{36// GENERIC-SAME: first = 137// GENERIC-SAME: second = 438// GENERIC-SAME: }>39test.using_property_ref_in_custom 1 + 4 = 540 41// Tests that the variadic segment size properties are elided.42// CHECK: %[[CI64:.*]] = arith.constant43// CHECK-NEXT: test.variadic_segment_prop %[[CI64]], %[[CI64]] : %[[CI64]] : i64, i64 : i64 end44// GENERIC: %[[CI64:.*]] = "arith.constant"()45// GENERIC-NEXT: "test.variadic_segment_prop"(%[[CI64]], %[[CI64]], %[[CI64]]) <{operandSegmentSizes = array<i32: 2, 1>, resultSegmentSizes = array<i32: 2, 1>}> : (i64, i64, i64) -> (i64, i64, i64)46%ci64 = arith.constant 0 : i6447test.variadic_segment_prop %ci64, %ci64 : %ci64 : i64, i64 : i64 end48 49// CHECK:   test.with_default_valued_properties na{{$}}50// GENERIC: "test.with_default_valued_properties"()51// GENERIC-SAME: <{a = 0 : i32, b = "", c = -1 : i32, unit = false}> : () -> ()52test.with_default_valued_properties 0 "" -1 unit_absent53 54// CHECK:   test.with_default_valued_properties 1 "foo" 0 unit{{$}}55// GENERIC: "test.with_default_valued_properties"()56// GENERIC-SAME: <{a = 1 : i32, b = "foo", c = 0 : i32, unit}> : () -> ()57test.with_default_valued_properties 1 "foo" 0 unit58 59// CHECK:   test.with_optional_properties60// CHECK-SAME: simple = 061// GENERIC: "test.with_optional_properties"()62// GENERIC-SAME:  <{hasDefault = [], hasUnit = false, longSyntax = [], maybeUnit = [], nested = [], nonTrivialStorage = [], simple = [0], simplei8 = [], simpleui8 = []}> : () -> ()63test.with_optional_properties simple = 064 65// CHECK:   test.with_optional_properties66// CHECK-SAME: simple = 1 simplei8 = -1 simpleui8 = 25567// GENERIC: "test.with_optional_properties"()68// GENERIC-SAME:  <{hasDefault = [], hasUnit = false, longSyntax = [], maybeUnit = [], nested = [], nonTrivialStorage = [], simple = [1], simplei8 = [-1 : i8], simpleui8 = [-1 : i8]}> : () -> ()69test.with_optional_properties simple = 1 simplei8 = -1 simpleui8 = 25570 71// CHECK:   test.with_optional_properties{{$}}72// GENERIC: "test.with_optional_properties"()73// GENERIC-SAME: simple = []74test.with_optional_properties75 76// CHECK:    test.with_optional_properties77// CHECK-SAME: anAttr = 0 simple = 1 nonTrivialStorage = "foo" hasDefault = some<0> nested = some<1>  longSyntax = some<"bar"> hasUnit maybeUnit = some<unit>78// GENERIC: "test.with_optional_properties"()79// GENERIC-SAME: <{anAttr = 0 : i32, hasDefault = [0], hasUnit, longSyntax = ["bar"], maybeUnit = [unit], nested = {{\[}}[1]], nonTrivialStorage = ["foo"], simple = [1], simplei8 = [], simpleui8 = []}> : () -> ()80test.with_optional_properties81  anAttr = 082  simple = 183  nonTrivialStorage = "foo"84  hasDefault = some<0>85  nested = some<1>86  longSyntax = some<"bar">87  hasUnit88  maybeUnit = some<unit>89 90// CHECK:    test.with_optional_properties91// CHECK-SAME: nested = some<none>92// GENERIC: "test.with_optional_properties"()93// GENERIC-SAME: nested = {{\[}}[]]94test.with_optional_properties nested = some<none>95 96// CHECK:    test.with_array_properties97// CHECK-SAME: ints = [1, 2] strings = ["a", "b"] nested = {{\[}}[1, 2], [3, 4]] opt = [-1, -2] explicitOptions = [none, 0] explicitUnits = [unit, unit_absent]98// GENERIC: "test.with_array_properties"()99test.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_default100