Files
clang-p2996/mlir/test/Dialect/ControlFlow/ops.mlir
River Riddle 412b8850f6 [mlir][NFC] Update textual references of func to func.func in Bufferization/Complex/EmitC/CF/Func/GPU tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:28 -07:00

41 lines
906 B
MLIR

// RUN: mlir-opt %s | mlir-opt | FileCheck %s
// RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s
// CHECK-LABEL: @assert
func.func @assert(%arg : i1) {
cf.assert %arg, "Some message in case this assertion fails."
return
}
// CHECK-LABEL: func @switch(
func.func @switch(%flag : i32, %caseOperand : i32) {
cf.switch %flag : i32, [
default: ^bb1(%caseOperand : i32),
42: ^bb2(%caseOperand : i32),
43: ^bb3(%caseOperand : i32)
]
^bb1(%bb1arg : i32):
return
^bb2(%bb2arg : i32):
return
^bb3(%bb3arg : i32):
return
}
// CHECK-LABEL: func @switch_i64(
func.func @switch_i64(%flag : i64, %caseOperand : i32) {
cf.switch %flag : i64, [
default: ^bb1(%caseOperand : i32),
42: ^bb2(%caseOperand : i32),
43: ^bb3(%caseOperand : i32)
]
^bb1(%bb1arg : i32):
return
^bb2(%bb2arg : i32):
return
^bb3(%bb3arg : i32):
return
}