xref: /llvm-project/mlir/test/Integration/Dialect/Vector/CPU/shuffle.mlir (revision eb206e9ea84eff0a0596fed2de8316d924f946d1)
1// RUN: mlir-opt %s -test-lower-to-llvm  | \
2// RUN: mlir-runner -e entry -entry-point-result=void  \
3// RUN:   -shared-libs=%mlir_c_runner_utils | \
4// RUN: FileCheck %s
5
6func.func @entry() {
7  %f1 = arith.constant 1.0: f32
8  %f2 = arith.constant 2.0: f32
9  %v1 = vector.broadcast %f1 : f32 to vector<2x4xf32>
10  %v2 = vector.broadcast %f2 : f32 to vector<2x4xf32>
11  vector.print %v1 : vector<2x4xf32>
12  vector.print %v2 : vector<2x4xf32>
13  //
14  // test vectors:
15  //
16  // CHECK: ( ( 1, 1, 1, 1 ), ( 1, 1, 1, 1 ) )
17  // CHECK: ( ( 2, 2, 2, 2 ), ( 2, 2, 2, 2 ) )
18
19  %v3 = vector.shuffle %v1, %v2 [3, 1, 2] : vector<2x4xf32>, vector<2x4xf32>
20  vector.print %v3 : vector<3x4xf32>
21  // CHECK: ( ( 2, 2, 2, 2 ), ( 1, 1, 1, 1 ), ( 2, 2, 2, 2 ) )
22
23  return
24}
25