1 // RUN: mlir-opt %s -convert-scf-to-std -convert-vector-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
2 // RUN: mlir-cpu-runner -e entry -entry-point-result=void \
3 // RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
7 %f1 = arith.constant 1.0: f32
8 %f2 = arith.constant 2.0: f32
9 %f3 = arith.constant 3.0: f32
10 %f4 = arith.constant 4.0: f32
11 %f5 = arith.constant 5.0: f32
12 %f6 = arith.constant 6.0: f32
14 // Construct test vector.
15 %0 = vector.broadcast %f1 : f32 to vector<3x2xf32>
16 %1 = vector.insert %f2, %0[0, 1] : f32 into vector<3x2xf32>
17 %2 = vector.insert %f3, %1[1, 0] : f32 into vector<3x2xf32>
18 %3 = vector.insert %f4, %2[1, 1] : f32 into vector<3x2xf32>
19 %4 = vector.insert %f5, %3[2, 0] : f32 into vector<3x2xf32>
20 %x = vector.insert %f6, %4[2, 1] : f32 into vector<3x2xf32>
21 vector.print %x : vector<3x2xf32>
22 // CHECK: ( ( 1, 2 ), ( 3, 4 ), ( 5, 6 ) )
25 %a = vector.shape_cast %x : vector<3x2xf32> to vector<3x2xf32>
26 %b = vector.shape_cast %x : vector<3x2xf32> to vector<2x3xf32>
27 %c = vector.shape_cast %x : vector<3x2xf32> to vector<6xf32>
28 %d = vector.shape_cast %c : vector<6xf32> to vector<2x3xf32>
29 %e = vector.shape_cast %c : vector<6xf32> to vector<3x2xf32>
32 // CHECK: ( ( 1, 2 ), ( 3, 4 ), ( 5, 6 ) )
33 // CHECK: ( ( 1, 2, 3 ), ( 4, 5, 6 ) )
34 // CHECK: ( 1, 2, 3, 4, 5, 6 )
35 // CHECK: ( ( 1, 2, 3 ), ( 4, 5, 6 ) )
36 // CHECK: ( ( 1, 2 ), ( 3, 4 ), ( 5, 6 ) )
37 vector.print %a : vector<3x2xf32>
38 vector.print %b : vector<2x3xf32>
39 vector.print %c : vector<6xf32>
40 vector.print %d : vector<2x3xf32>
41 vector.print %e : vector<3x2xf32>