aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/IR/result.mlir
blob: 1e4eb3bede4c51c72d556df0587a26e5b770d6a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s

//===----------------------------------------------------------------------===//
// Test mixed normal and variadic results
//===----------------------------------------------------------------------===//

func.func @correct_variadic_result() -> tensor<f32> {
  // CHECK: mixed_normal_variadic_result
  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>)
  return %0#4 : tensor<f32>
}

// -----

func.func @error_in_first_variadic_result() -> tensor<f32> {
  // expected-error @+1 {{result #1 must be variadic of tensor of any type}}
  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, f32, tensor<f32>, tensor<f32>, tensor<f32>)
  return %0#4 : tensor<f32>
}

// -----

func.func @error_in_normal_result() -> tensor<f32> {
  // expected-error @+1 {{result #2 must be tensor of any type}}
  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, f32, tensor<f32>, tensor<f32>)
  return %0#4 : tensor<f32>
}

// -----

func.func @error_in_second_variadic_result() -> tensor<f32> {
  // expected-error @+1 {{result #3 must be variadic of tensor of any type}}
  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, tensor<f32>, f32, tensor<f32>)
  return %0#4 : tensor<f32>
}