36 lines · plain
1// RUN: mlir-opt -split-input-file %s | FileCheck %s2 3// -----4 5func.func @condif_cond_type_check(%arg0: tensor<f32>, %arg1: tensor<f32>, %arg2: tensor<i1>) -> tensor<f32> {6 // CHECK: tosa.cond_if %[[ARG2:.*]] : tensor<i1> -> tensor<f32> {7 %0 = tosa.cond_if %arg2 : tensor<i1> -> tensor<f32> {8 %1 = tosa.add %arg0, %arg1 : (tensor<f32>, tensor<f32>) -> tensor<f32>9 tosa.yield %1 : tensor<f32>10 // CHECK: } else {11 } else {12 %1 = tosa.sub %arg0, %arg1 : (tensor<f32>, tensor<f32>) -> tensor<f32>13 tosa.yield %1 : tensor<f32>14 }15 return %0 : tensor<f32>16}17 18// -----19 20func.func @condif_block_args_check(%arg0: tensor<f32>, %arg1: tensor<f32>, %arg2: tensor<i1>) -> tensor<f32> {21 // CHECK: tosa.cond_if %[[ARG2:.*]] (%[[ARG3:.*]] = %[[ARG0:.*]], %[[ARG4:.*]] = %[[ARG1:.*]]) : tensor<i1> (tensor<f32>, tensor<f32>) -> tensor<f32> {22 // CHECK-NEXT: ^bb0(%[[ARG3]]: tensor<f32>, %[[ARG4]]: tensor<f32>):23 %0 = tosa.cond_if %arg2 (%arg3 = %arg0, %arg4 = %arg1) : tensor<i1> (tensor<f32>, tensor<f32>) -> tensor<f32> {24 ^bb0(%arg3: tensor<f32>, %arg4: tensor<f32>):25 %1 = tosa.add %arg3, %arg4 : (tensor<f32>, tensor<f32>) -> tensor<f32>26 tosa.yield %1 : tensor<f32>27 // CHECK: } else {28 // CHECK-NEXT: ^bb0(%[[ARG3]]: tensor<f32>, %[[ARG4]]: tensor<f32>):29 } else {30 ^bb0(%arg3: tensor<f32>, %arg4: tensor<f32>):31 %1 = tosa.sub %arg3, %arg4 : (tensor<f32>, tensor<f32>) -> tensor<f32>32 tosa.yield %1 : tensor<f32>33 }34 return %0 : tensor<f32>35} 36