Nicolas Vasilache | dac75ae | 2019-06-24 21:35:21 | [diff] [blame] | 1 | // RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s |
Lei Zhang | 3812d956 | 2019-06-09 14:00:09 | [diff] [blame] | 2 | |
| 3 | //===----------------------------------------------------------------------===// |
| 4 | // Test mixed normal and variadic operands |
| 5 | //===----------------------------------------------------------------------===// |
| 6 | |
| 7 | func @correct_variadic_operand(%arg0: tensor<f32>, %arg1: f32) { |
| 8 | // CHECK: mixed_normal_variadic_operand |
| 9 | "test.mixed_normal_variadic_operand"(%arg0, %arg0, %arg0, %arg0, %arg0) : (tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>) -> () |
| 10 | return |
| 11 | } |
| 12 | |
| 13 | // ----- |
| 14 | |
| 15 | func @error_in_first_variadic_operand(%arg0: tensor<f32>, %arg1: f32) { |
Lei Zhang | a3e6f10 | 2019-06-12 19:08:13 | [diff] [blame] | 16 | // expected-error @+1 {{operand #1 must be tensor of any type}} |
Lei Zhang | 3812d956 | 2019-06-09 14:00:09 | [diff] [blame] | 17 | "test.mixed_normal_variadic_operand"(%arg0, %arg1, %arg0, %arg0, %arg0) : (tensor<f32>, f32, tensor<f32>, tensor<f32>, tensor<f32>) -> () |
| 18 | return |
| 19 | } |
| 20 | |
| 21 | // ----- |
| 22 | |
| 23 | func @error_in_normal_operand(%arg0: tensor<f32>, %arg1: f32) { |
Lei Zhang | a3e6f10 | 2019-06-12 19:08:13 | [diff] [blame] | 24 | // expected-error @+1 {{operand #2 must be tensor of any type}} |
Lei Zhang | 3812d956 | 2019-06-09 14:00:09 | [diff] [blame] | 25 | "test.mixed_normal_variadic_operand"(%arg0, %arg0, %arg1, %arg0, %arg0) : (tensor<f32>, tensor<f32>, f32, tensor<f32>, tensor<f32>) -> () |
| 26 | return |
| 27 | } |
| 28 | |
| 29 | // ----- |
| 30 | |
| 31 | func @error_in_second_variadic_operand(%arg0: tensor<f32>, %arg1: f32) { |
Lei Zhang | a3e6f10 | 2019-06-12 19:08:13 | [diff] [blame] | 32 | // expected-error @+1 {{operand #3 must be tensor of any type}} |
Lei Zhang | 3812d956 | 2019-06-09 14:00:09 | [diff] [blame] | 33 | "test.mixed_normal_variadic_operand"(%arg0, %arg0, %arg0, %arg1, %arg0) : (tensor<f32>, tensor<f32>, tensor<f32>, f32, tensor<f32>) -> () |
| 34 | return |
| 35 | } |
Stephen Neuendorffer | 34d12c1 | 2020-07-30 21:47:42 | [diff] [blame] | 36 | |
| 37 | // ----- |
| 38 | |
| 39 | func @testfunc(%arg0: i32) { |
| 40 | return |
| 41 | } |
| 42 | func @invalid_call_operandtype() { |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame^] | 43 | %0 = arith.constant 0.0 : f32 |
Stephen Neuendorffer | 34d12c1 | 2020-07-30 21:47:42 | [diff] [blame] | 44 | // expected-error @+1 {{operand type mismatch: expected operand type 'i32', but provided 'f32' for operand number 0}} |
| 45 | call @testfunc(%0) : (f32) -> () |
| 46 | return |
| 47 | } |