64 lines · plain
1// RUN: mlir-opt %s | mlir-opt | FileCheck %s2// RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s3 4// CHECK-LABEL: @assert5func.func @assert(%arg : i1) {6 cf.assert %arg, "Some message in case this assertion fails."7 return8}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 return20 ^bb2(%bb2arg : i32):21 return22 ^bb3(%bb3arg : i32):23 return24}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 return36 ^bb2(%bb2arg : i32):37 return38 ^bb3(%bb3arg : i32):39 return40}41 42// CHECK-LABEL: func @switch_result_number43func.func @switch_result_number(%arg0: i32) {44 %0:2 = "test.op_with_two_results"() : () -> (i32, i32)45 cf.switch %arg0 : i32, [46 default: ^bb2,47 0: ^bb1(%0#0 : i32)48 ]49 ^bb1(%1: i32):50 return51 ^bb2:52 return53}54 55// CHECK-LABEL: func @cond_weights56func.func @cond_weights(%cond: i1) {57// CHECK: cf.cond_br %{{.*}} weights([60, 40]), ^{{.*}}, ^{{.*}}58 cf.cond_br %cond weights([60, 40]), ^bb1, ^bb259 ^bb1:60 return61 ^bb2:62 return63}64