1// RUN: mlir-opt %s | mlir-opt | FileCheck %s
2// RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s
3
4// CHECK-LABEL: @assert
5func.func @assert(%arg : i1) {
6  cf.assert %arg, "Some message in case this assertion fails."
7  return
8}
9
10// CHECK-LABEL: func @switch(
11func.func @switch(%flag : i32, %caseOperand : i32) {
12  cf.switch %flag : i32, [
13    default: ^bb1(%caseOperand : i32),
14    42: ^bb2(%caseOperand : i32),
15    43: ^bb3(%caseOperand : i32)
16  ]
17
18  ^bb1(%bb1arg : i32):
19    return
20  ^bb2(%bb2arg : i32):
21    return
22  ^bb3(%bb3arg : i32):
23    return
24}
25
26// CHECK-LABEL: func @switch_i64(
27func.func @switch_i64(%flag : i64, %caseOperand : i32) {
28  cf.switch %flag : i64, [
29    default: ^bb1(%caseOperand : i32),
30    42: ^bb2(%caseOperand : i32),
31    43: ^bb3(%caseOperand : i32)
32  ]
33
34  ^bb1(%bb1arg : i32):
35    return
36  ^bb2(%bb2arg : i32):
37    return
38  ^bb3(%bb3arg : i32):
39    return
40}
41