1// RUN: mlir-opt %s -test-vector-unrolling-patterns=unroll-based-on-type | FileCheck %s
2
3func @vector_contract_f32(%lhs : vector<8x8xf32>, %rhs : vector<8x8xf32>,
4                          %init : vector<8x8xf32>) -> vector<8x8xf32> {
5  %0 = vector.contract
6         {indexing_maps = [affine_map<(i, j, k) -> (i, k)>,
7                           affine_map<(i, j, k) -> (j, k)>,
8                           affine_map<(i, j, k) -> (i, j)>],
9          iterator_types = ["parallel", "parallel", "reduction"]}
10       %lhs, %rhs, %init : vector<8x8xf32>, vector<8x8xf32> into vector<8x8xf32>
11  return %0 : vector<8x8xf32>
12}
13// CHECK-LABEL: func @vector_contract_f32
14//       CHECK:   vector.contract {
15//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
16//       CHECK:   vector.contract {
17//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
18//       CHECK:   vector.contract {
19//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
20//       CHECK:   vector.contract {
21//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
22//       CHECK:   vector.contract {
23//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
24//       CHECK:   vector.contract {
25//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
26//       CHECK:   vector.contract {
27//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
28//       CHECK:   vector.contract {
29//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
30//       CHECK:   vector.contract {
31//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
32//       CHECK:   vector.contract {
33//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
34//       CHECK:   vector.contract {
35//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
36//       CHECK:   vector.contract {
37//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
38//       CHECK:   vector.contract {
39//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
40//       CHECK:   vector.contract {
41//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
42//       CHECK:   vector.contract {
43//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
44//       CHECK:   vector.contract {
45//  CHECK-SAME:     vector<4x2xf32>, vector<4x2xf32> into vector<4x4xf32>
46//       CHECK:   return
47
48func @vector_contract_f16(%lhs : vector<8x8xf16>, %rhs : vector<8x8xf16>,
49                          %init : vector<8x8xf16>) -> vector<8x8xf16> {
50  %0 = vector.contract
51         {indexing_maps = [affine_map<(i, j, k) -> (i, k)>,
52                           affine_map<(i, j, k) -> (j, k)>,
53                           affine_map<(i, j, k) -> (i, j)>],
54          iterator_types = ["parallel", "parallel", "reduction"]}
55       %lhs, %rhs, %init : vector<8x8xf16>, vector<8x8xf16> into vector<8x8xf16>
56  return %0 : vector<8x8xf16>
57}
58// CHECK-LABEL: func @vector_contract_f16
59//       CHECK:   vector.contract {
60//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
61//       CHECK:   vector.contract {
62//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
63//       CHECK:   vector.contract {
64//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
65//       CHECK:   vector.contract {
66//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
67//       CHECK:   vector.contract {
68//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
69//       CHECK:   vector.contract {
70//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
71//       CHECK:   vector.contract {
72//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
73//       CHECK:   vector.contract {
74//  CHECK-SAME:     vector<4x4xf16>, vector<4x4xf16> into vector<4x4xf16>
75//       CHECK:   return
76