brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 0a81f9d Raw
75 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect -split-input-file %s | FileCheck %s --check-prefixes=CHECK-CUSTOM,CHECK2// RUN: mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -split-input-file   %s | FileCheck %s --check-prefixes=CHECK,CHECK-GENERIC3// RUN: mlir-opt -allow-unregistered-dialect -split-input-file --mlir-print-op-generic --mlir-print-debuginfo -mlir-print-local-scope  %s | FileCheck %s --check-prefixes=CHECK-LOCATION4 5// -----6 7func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) {8// CHECK-CUSTOM:  test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> f329// CHECK-GENERIC: "test.pretty_printed_region"(%arg1, %arg0)10// CHECK-GENERIC:   ^bb0(%arg[[x:[0-9]+]]: f32, %arg[[y:[0-9]+]]: f3211// CHECK-GENERIC:     %[[RES:.*]] = "test.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f3212// CHECK-GENERIC:     "test.return"(%[[RES]]) : (f32) -> ()13// CHECK-GENERIC:  : (f32, f32) -> f3214 15  %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc("some_NameLoc")16  return %res : f3217}18 19// -----20 21func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) {22// CHECK-CUSTOM:  test.pretty_printed_region %arg1, %arg023// CHECK-GENERIC: "test.pretty_printed_region"(%arg1, %arg0)24// CHECK:          ^bb0(%arg[[x:[0-9]+]]: f32, %arg[[y:[0-9]+]]: f32):25// CHECK:            %[[RES:.*]] = "test.non.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f3226// CHECK:            "test.return"(%[[RES]]) : (f32) -> ()27// CHECK:          : (f32, f32) -> f3228 29  %0 = test.pretty_printed_region %arg1, %arg0 ({30    ^bb0(%arg2: f32, %arg3: f32):31      %1 = "test.non.special.op"(%arg2, %arg3) : (f32, f32) -> f3232      "test.return"(%1) : (f32) -> ()33    }) : (f32, f32) -> f3234    return %0 : f3235}36 37// -----38 39func.func @pretty_printed_region_op_deferred_loc(%arg0 : f32, %arg1 : f32) -> (f32) {40// CHECK-LOCATION: "test.pretty_printed_region"(%arg1, %arg0)41// CHECK-LOCATION:   ^bb0(%arg[[x:[0-9]+]]: f32 loc("foo"), %arg[[y:[0-9]+]]: f32 loc("foo")42// CHECK-LOCATION:     %[[RES:.*]] = "test.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f3243// CHECK-LOCATION:     "test.return"(%[[RES]]) : (f32) -> ()44// CHECK-LOCATION:  : (f32, f32) -> f3245 46  %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc("foo")47  return %res : f3248}49 50// -----51 52// This tests the behavior of custom block names:53// operations like `test.block_names` can define custom names for blocks in54// nested regions.55// CHECK-CUSTOM-LABEL: func @block_names56func.func @block_names(%bool : i1) {57  // CHECK: test.block_names58  test.block_names {59    // CHECK-CUSTOM: br ^foo160    // CHECK-GENERIC: cf.br{{.*}}^bb161    cf.br ^foo162  // CHECK-CUSTOM: ^foo1:63  // CHECK-GENERIC: ^bb1:64  ^foo1:65    // CHECK-CUSTOM: br ^foo266    // CHECK-GENERIC: cf.br{{.*}}^bb267    cf.br ^foo268  // CHECK-CUSTOM: ^foo2:69  // CHECK-GENERIC: ^bb2:70  ^foo2:71     "test.return"() : () -> ()72  }73  return74}75