32 lines · plain
1// RUN: mlir-opt %s -transform-preload-library='transform-library-paths=%p/td/unroll-elements.mlir' \2// RUN: -transform-interpreter=entry-point=unroll_to_elements | FileCheck %s3 4//===----------------------------------------------------------------------===//5// Test UnrollToElements.6//===----------------------------------------------------------------------===//7 8// 1-D vector.from_elements should not be unrolled.9 10// CHECK-LABEL: func.func @negative_unroll_to_elements_1d(11// CHECK-SAME: %[[ARG0:.+]]: vector<2xf32>12// CHECK: %[[RES:.+]]:2 = vector.to_elements %[[ARG0]] : vector<2xf32>13// CHECK: return %[[RES]]#0, %[[RES]]#114func.func @negative_unroll_to_elements_1d(%arg0: vector<2xf32>) -> (f32, f32) {15 %0:2 = vector.to_elements %arg0 : vector<2xf32>16 return %0#0, %0#1 : f32, f3217}18 19// -----20 21// CHECK-LABEL: func.func @unroll_to_elements_2d(22// CHECK-SAME: %[[ARG0:.+]]: vector<2x2xf32>23// CHECK: %[[VEC0:.+]] = vector.extract %[[ARG0]][0] : vector<2xf32> from vector<2x2xf32>24// CHECK: %[[VEC1:.+]] = vector.extract %[[ARG0]][1] : vector<2xf32> from vector<2x2xf32>25// CHECK: %[[RES0:.+]]:2 = vector.to_elements %[[VEC0]] : vector<2xf32>26// CHECK: %[[RES1:.+]]:2 = vector.to_elements %[[VEC1]] : vector<2xf32>27// CHECK: return %[[RES0]]#0, %[[RES0]]#1, %[[RES1]]#0, %[[RES1]]#128func.func @unroll_to_elements_2d(%arg0: vector<2x2xf32>) -> (f32, f32, f32, f32) {29 %0:4 = vector.to_elements %arg0 : vector<2x2xf32>30 return %0#0, %0#1, %0#2, %0#3 : f32, f32, f32, f3231}32