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  %f1 = constant 1.0: f32
8  %f2 = constant 2.0: f32
9  %f3 = constant 3.0: f32
10  %f4 = constant 4.0: f32
11  %v1 = vector.broadcast %f1 : f32 to vector<4xf32>
12  %v2 = vector.broadcast %f2 : f32 to vector<3xf32>
13  %v3 = vector.broadcast %f3 : f32 to vector<4x4xf32>
14  %v4 = vector.broadcast %f4 : f32 to vector<1xf32>
15
16  %s1 = vector.insert_strided_slice %v1, %v3 {offsets = [2, 0], strides = [1]} : vector<4xf32> into vector<4x4xf32>
17  %s2 = vector.insert_strided_slice %v2, %s1 {offsets = [1, 1], strides = [1]} : vector<3xf32> into vector<4x4xf32>
18  %s3 = vector.insert_strided_slice %v2, %s2 {offsets = [0, 0], strides = [1]} : vector<3xf32> into vector<4x4xf32>
19  %s4 = vector.insert_strided_slice %v4, %s3 {offsets = [3, 3], strides = [1]} : vector<1xf32> into vector<4x4xf32>
20
21  vector.print %v3 : vector<4x4xf32>
22  vector.print %s1 : vector<4x4xf32>
23  vector.print %s2 : vector<4x4xf32>
24  vector.print %s3 : vector<4x4xf32>
25  vector.print %s4 : vector<4x4xf32>
26  //
27  // insert strided slice:
28  //
29  // CHECK: ( ( 3, 3, 3, 3 ), ( 3, 3, 3, 3 ), ( 3, 3, 3, 3 ), ( 3, 3, 3, 3 ) )
30  // CHECK: ( ( 3, 3, 3, 3 ), ( 3, 3, 3, 3 ), ( 1, 1, 1, 1 ), ( 3, 3, 3, 3 ) )
31  // CHECK: ( ( 3, 3, 3, 3 ), ( 3, 2, 2, 2 ), ( 1, 1, 1, 1 ), ( 3, 3, 3, 3 ) )
32  // CHECK: ( ( 2, 2, 2, 3 ), ( 3, 2, 2, 2 ), ( 1, 1, 1, 1 ), ( 3, 3, 3, 3 ) )
33  // CHECK: ( ( 2, 2, 2, 3 ), ( 3, 2, 2, 2 ), ( 1, 1, 1, 1 ), ( 3, 3, 3, 4 ) )
34
35  return
36}
37