@@ -214,6 +214,19 @@ func @test_simple_f16(%arg0: tensor<1xf16>) -> () {
214
214
215
215
// -----
216
216
217
+ // CHECK-LABEL: @test_simple_i16
218
+ func @test_simple_i16 (%arg0: tensor <1 xi16 >) -> () {
219
+ // CHECK: linalg.generic
220
+ // CHECK: sext
221
+ // CHECK: sext
222
+ // CHECK: muli
223
+ %0 = " tosa.mul" (%arg0 , %arg0 ) {shift = 0 : i32 } : (tensor <1 xi16 >, tensor <1 xi16 >) -> tensor <1 xi32 >
224
+
225
+ return
226
+ }
227
+
228
+ // -----
229
+
217
230
// CHECK-LABEL: @test_simple_i32
218
231
func @test_simple_i32 (%arg0: tensor <1 xi32 >) -> () {
219
232
// CHECK: linalg.generic
@@ -228,82 +241,87 @@ func @test_simple_i32(%arg0: tensor<1xi32>) -> () {
228
241
// CHECK: muli
229
242
%2 = " tosa.mul" (%arg0 , %arg0 ) {shift = 0 : i32 } : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
230
243
244
+ // CHECK: linalg.generic
245
+ // CHECK: constant 2
246
+ // CHECK: apply_scale
247
+ %3 = " tosa.mul" (%arg0 , %arg0 ) {shift = 2 : i32 } : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
248
+
231
249
// CHECK: linalg.generic
232
250
// CHECK: muli
233
- %3 = " tosa.negate" (%arg0 ) : (tensor <1 xi32 >) -> tensor <1 xi32 >
251
+ %4 = " tosa.negate" (%arg0 ) : (tensor <1 xi32 >) -> tensor <1 xi32 >
234
252
235
253
// CHECK: linalg.generic
236
254
// CHECK: and
237
- %4 = " tosa.bitwise_and" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
255
+ %5 = " tosa.bitwise_and" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
238
256
239
257
// CHECK: linalg.generic
240
258
// CHECK: or
241
- %5 = " tosa.bitwise_or" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
259
+ %6 = " tosa.bitwise_or" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
242
260
243
261
// CHECK: linalg.generic
244
262
// CHECK: xor
245
- %6 = " tosa.bitwise_xor" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
263
+ %7 = " tosa.bitwise_xor" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
246
264
247
265
// CHECK: linalg.generic
248
266
// CHECK: shift_left
249
- %7 = " tosa.logical_left_shift" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
267
+ %8 = " tosa.logical_left_shift" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
250
268
251
269
// CHECK: linalg.generic
252
270
// CHECK: shift_right_unsigned
253
- %8 = " tosa.logical_right_shift" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
271
+ %9 = " tosa.logical_right_shift" (%arg0 , %arg0 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
254
272
255
273
// CHECK: linalg.generic
256
274
// CHECK: cmpi
257
- %9 = " tosa.greater" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi1 >
275
+ %10 = " tosa.greater" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi1 >
258
276
259
277
// CHECK: linalg.generic
260
278
// CHECK: cmpi
261
- %10 = " tosa.greater_equal" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi1 >
279
+ %11 = " tosa.greater_equal" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi1 >
262
280
263
281
// CHECK: linalg.generic
264
282
// CHECK: select
265
- %11 = " tosa.select" (%9 , %0 , %1 ) : (tensor <1 xi1 >, tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
283
+ %12 = " tosa.select" (%10 , %0 , %1 ) : (tensor <1 xi1 >, tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
266
284
267
285
// CHECK: linalg.generic
268
286
// CHECK: cmpi
269
287
// CHECK: select
270
- %12 = " tosa.maximum" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
288
+ %13 = " tosa.maximum" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
271
289
272
290
// CHECK: linalg.generic
273
291
// CHECK: cmpi
274
292
// CHECK: select
275
- %13 = " tosa.minimum" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
293
+ %14 = " tosa.minimum" (%0 , %1 ) : (tensor <1 xi32 >, tensor <1 xi32 >) -> tensor <1 xi32 >
276
294
277
295
// CHECK: linalg.generic
278
296
// CHECK: cmpi
279
297
// CHECK: select
280
- %14 = " tosa.clamp" (%0 ) {min_int = 1 : i64 , max_int = 5 : i64 , min_fp = 1.0 : f32 , max_fp = 5.0 : f32 } : (tensor <1 xi32 >) -> tensor <1 xi32 >
298
+ %15 = " tosa.clamp" (%0 ) {min_int = 1 : i64 , max_int = 5 : i64 , min_fp = 1.0 : f32 , max_fp = 5.0 : f32 } : (tensor <1 xi32 >) -> tensor <1 xi32 >
281
299
282
300
// CHECK: linalg.generic
283
301
// CHECK: cmpi
284
302
// CHECK: select
285
- %15 = " tosa.reluN" (%0 ) {max_int = 5 : i64 , max_fp = 5.0 : f32 } : (tensor <1 xi32 >) -> tensor <1 xi32 >
303
+ %16 = " tosa.reluN" (%0 ) {max_int = 5 : i64 , max_fp = 5.0 : f32 } : (tensor <1 xi32 >) -> tensor <1 xi32 >
286
304
287
305
// CHECK: linalg.generic
288
306
// CHECK: trunci
289
- %16 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi16 >
307
+ %17 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi16 >
290
308
291
309
// CHECK: linalg.generic
292
310
// CHECK: yield
293
- %17 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi32 >
311
+ %18 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi32 >
294
312
295
313
// CHECK: linalg.generic
296
314
// CHECK: sexti
297
- %18 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi64 >
315
+ %19 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi64 >
298
316
299
317
// CHECK: linalg.generic
300
318
// CHECK: constant 0
301
319
// CHECK: cmpi
302
- %19 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi1 >
320
+ %20 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xi1 >
303
321
304
322
// CHECK: linalg.generic
305
323
// CHECK: sitofp
306
- %20 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xf32 >
324
+ %21 = " tosa.cast" (%0 ) : (tensor <1 xi32 >) -> tensor <1 xf32 >
307
325
308
326
return
309
327
}
0 commit comments