[Mlir-commits] [mlir] [mlir][vector] Adds ToElementsToTargetShape pattern. (PR #166476)

Jakub Kuderski llvmlistbot at llvm.org
Fri Nov 7 09:51:32 PST 2025


================
@@ -29,3 +29,26 @@ func.func @unroll_to_elements_2d(%arg0: vector<2x2xf32>) -> (f32, f32, f32, f32)
   %0:4 = vector.to_elements %arg0 : vector<2x2xf32>
   return %0#0, %0#1, %0#2, %0#3 : f32, f32, f32, f32
 }
+
+// -----
+
+// COM: Here we are testing the pattern ToElementsToTargetShape
+// COM: The pattern has a native shape of [4], which means
+// COM: that vectors multiples of 4 will be split. In this
+// COM: case, that will happen in the function's body, not the argument.
+
+// CHECK-LABEL: func.func @unroll_vector_8xf32
+// CHECK-SAME: (%[[ARG0:.+]]: vector<8xf32>)
+func.func @unroll_vector_8xf32(%arg0: vector<8xf32>) -> (f32, f32) {
+  %0:8 = vector.to_elements %arg0 : vector<8xf32>
+
+  // COM: We only return two elements, one from each of the
+  // COM: vectors.
----------------
kuhar wrote:

we don't need these `COM: ` prefixes

https://github.com/llvm/llvm-project/pull/166476


More information about the Mlir-commits mailing list