1// RUN: mlir-opt %s -convert-scf-to-std -convert-vector-to-llvm -convert-std-to-llvm | \ 2// RUN: mlir-cpu-runner -e entry -entry-point-result=void \ 3// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \ 4// RUN: FileCheck %s 5 6func @entry() { 7 %f0 = constant 0.0: f32 8 %f1 = constant 1.0: f32 9 %f2 = constant 2.0: f32 10 %f3 = constant 3.0: f32 11 %f4 = constant 4.0: f32 12 %f5 = constant 5.0: f32 13 %f6 = constant 6.0: f32 14 %f7 = constant 7.0: f32 15 %f8 = constant 8.0: f32 16 %f9 = constant 9.0: f32 17 %f10 = constant 10.0: f32 18 %f11 = constant 11.0: f32 19 %f12 = constant 12.0: f32 20 %f13 = constant 13.0: f32 21 %f14 = constant 14.0: f32 22 %f15 = constant 15.0: f32 23 24 %a0 = vector.broadcast %f0 : f32 to vector<3x3xf32> 25 %a1 = vector.insert %f0, %a0[0, 0] : f32 into vector<3x3xf32> 26 %a2 = vector.insert %f1, %a1[0, 1] : f32 into vector<3x3xf32> 27 %a3 = vector.insert %f2, %a2[0, 2] : f32 into vector<3x3xf32> 28 %a4 = vector.insert %f4, %a3[1, 0] : f32 into vector<3x3xf32> 29 %a5 = vector.insert %f5, %a4[1, 1] : f32 into vector<3x3xf32> 30 %a6 = vector.insert %f6, %a5[1, 2] : f32 into vector<3x3xf32> 31 %a7 = vector.insert %f8, %a6[2, 0] : f32 into vector<3x3xf32> 32 %a8 = vector.insert %f9, %a7[2, 1] : f32 into vector<3x3xf32> 33 %a9 = vector.insert %f10, %a8[2, 2] : f32 into vector<3x3xf32> 34 35 %b0 = vector.broadcast %f0 : f32 to vector<3x1xf32> 36 %b1 = vector.insert %f3, %b0[0, 0] : f32 into vector<3x1xf32> 37 %b2 = vector.insert %f7, %b1[1, 0] : f32 into vector<3x1xf32> 38 %b3 = vector.insert %f11, %b2[2, 0] : f32 into vector<3x1xf32> 39 40 %c0 = vector.broadcast %f0 : f32 to vector<1x3xf32> 41 %c1 = vector.insert %f12, %c0[0, 0] : f32 into vector<1x3xf32> 42 %c2 = vector.insert %f13, %c1[0, 1] : f32 into vector<1x3xf32> 43 %c3 = vector.insert %f14, %c2[0, 2] : f32 into vector<1x3xf32> 44 45 %d0 = vector.broadcast %f0 : f32 to vector<1x1xf32> 46 %d1 = vector.insert %f15, %d0[0, 0] : f32 into vector<1x1xf32> 47 48 vector.print %a9 : vector<3x3xf32> 49 vector.print %b3 : vector<3x1xf32> 50 vector.print %c3 : vector<1x3xf32> 51 vector.print %d1 : vector<1x1xf32> 52 // 53 // input slices: 54 // 55 // CHECK: ( ( 0, 1, 2 ), ( 4, 5, 6 ), ( 8, 9, 10 ) ) 56 // CHECK: ( ( 3 ), ( 7 ), ( 11 ) ) 57 // CHECK: ( ( 12, 13, 14 ) ) 58 // CHECK: ( ( 15 ) ) 59 60 %vt = vector.tuple %a9, %b3, %c3, %d1 : 61 vector<3x3xf32>, vector<3x1xf32>, vector<1x3xf32>, vector<1x1xf32> 62 %is = vector.insert_slices %vt, [3, 3], [1, 1] : 63 tuple<vector<3x3xf32>, vector<3x1xf32>, vector<1x3xf32>, vector<1x1xf32>> into vector<4x4xf32> 64 65 vector.print %is : vector<4x4xf32> 66 // 67 // insert slices: 68 // 69 // CHECK: ( ( 0, 1, 2, 3 ), ( 4, 5, 6, 7 ), ( 8, 9, 10, 11 ), ( 12, 13, 14, 15 ) ) 70 71 return 72} 73