Skip to content

Commit cf72618

Browse files
authored
add test
1 parent bd47095 commit cf72618

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

mlir/test/Dialect/Tosa/canonicalize.mlir

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,26 @@ func.func @clamp_f32_is_noop(%arg0: tensor<4xf32>) -> tensor<4xf32> {
241241

242242
// -----
243243

244+
// CHECK-LABEL: @clamp_boolean_is_noop
245+
func.func @clamp_boolean_is_noop(%arg0: tensor<4xi1>) -> tensor<4xi1> {
246+
// CHECK: return %arg0
247+
// CHECK-NOT: tosa.clamp
248+
%0 = tosa.clamp %arg0 {min_val = false, max_val = true} : (tensor<4xi1>) -> tensor<4xi1>
249+
return %0 : tensor<4xi1>
250+
}
251+
252+
// -----
253+
254+
// CHECK-LABEL: @clamp_boolean_dynamic_is_noop
255+
func.func @clamp_boolean_dynamic_is_noop(%arg0: tensor<?xi1>) -> tensor<?xi1> {
256+
// CHECK: return %arg0
257+
// CHECK-NOT: tosa.clamp
258+
%0 = tosa.clamp %arg0 {min_val = false, max_val = true} : (tensor<?xi1>) -> tensor<?xi1>
259+
return %0 : tensor<?xi1>
260+
}
261+
262+
// -----
263+
244264
// CHECK-LABEL: @clamp_int8_is_noop
245265
func.func @clamp_int8_is_noop(%arg0: tensor<4xi8>) -> tensor<4xi8> {
246266
// CHECK: return %arg0

0 commit comments

Comments
 (0)