@@ -83,3 +83,33 @@ func.func @test_resize_invalid_boarder_x(%arg0: tensor<1x8x8x8xf32>) -> tensor<?
83
83
%1 = tosa.resize %arg0 , %scale , %offset , %border { mode = " BILINEAR" } : (tensor <1 x8 x8 x8 xf32 >, !tosa.shape <4 >, !tosa.shape <2 >, !tosa.shape <2 >) -> tensor <?x?x?x?xf32 >
84
84
return %1 : tensor <?x?x?x?xf32 >
85
85
}
86
+
87
+ // -----
88
+
89
+ // CHECK-LABEL: test_mul_negative_shift
90
+ func.func @test_mul_negative_shift (%arg0: tensor <1 x8 x8 x8 xi32 >, %arg1: tensor <1 x8 x8 x8 xi32 >) -> tensor <1 x8 x8 x8 xi32 > {
91
+ %shift = " tosa.const" () { values = dense <-1 > : tensor <1 xi8 > } : () -> tensor <1 xi8 >
92
+ // expected-error@+1 {{'tosa.mul' op requires 0 <= shift && shift <= 63, but got: -1}}
93
+ %mul = tosa.mul %arg0 , %arg1 , %shift : (tensor <1 x8 x8 x8 xi32 >, tensor <1 x8 x8 x8 xi32 >, tensor <1 xi8 >) -> tensor <1 x8 x8 x8 xi32 >
94
+ return %mul : tensor <1 x8 x8 x8 xi32 >
95
+ }
96
+
97
+ // -----
98
+
99
+ // CHECK-LABEL: test_mul_too_big_shift
100
+ func.func @test_mul_too_big_shift (%arg0: tensor <1 x8 x8 x8 xi32 >, %arg1: tensor <1 x8 x8 x8 xi32 >) -> tensor <1 x8 x8 x8 xi32 > {
101
+ %shift = " tosa.const" () { values = dense <64 > : tensor <1 xi8 > } : () -> tensor <1 xi8 >
102
+ // expected-error@+1 {{'tosa.mul' op requires 0 <= shift && shift <= 63, but got: 64}}
103
+ %mul = tosa.mul %arg0 , %arg1 , %shift : (tensor <1 x8 x8 x8 xi32 >, tensor <1 x8 x8 x8 xi32 >, tensor <1 xi8 >) -> tensor <1 x8 x8 x8 xi32 >
104
+ return %mul : tensor <1 x8 x8 x8 xi32 >
105
+ }
106
+
107
+ // -----
108
+
109
+ // CHECK-LABEL: test_mul_non_zero_shift
110
+ func.func @test_mul_non_zero_shift (%arg0: tensor <1 x8 x8 x8 xi16 >, %arg1: tensor <1 x8 x8 x8 xi16 >) -> tensor <1 x8 x8 x8 xi32 > {
111
+ %shift = " tosa.const" () { values = dense <1 > : tensor <1 xi8 > } : () -> tensor <1 xi8 >
112
+ // expected-error@+1 {{'tosa.mul' op requires shift = 0 for all input data types that are not int32_t, but got: 1}}
113
+ %mul = tosa.mul %arg0 , %arg1 , %shift : (tensor <1 x8 x8 x8 xi16 >, tensor <1 x8 x8 x8 xi16 >, tensor <1 xi8 >) -> tensor <1 x8 x8 x8 xi32 >
114
+ return %mul : tensor <1 x8 x8 x8 xi32 >
115
+ }
0 commit comments