Skip to content

Commit f01719a

Browse files
authored
[mlir][test] Add integration tests for vector.interleave (#80969)
1 parent 4a602d9 commit f01719a

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: mlir-opt %s -test-lower-to-llvm | \
2+
// RUN: %mcr_aarch64_cmd -e entry -entry-point-result=void \
3+
// RUN: -shared-libs=%mlir_c_runner_utils,%mlir_arm_runner_utils | \
4+
// RUN: FileCheck %s
5+
6+
func.func @entry() {
7+
%f1 = arith.constant 1.0 : f32
8+
%f2 = arith.constant 2.0 : f32
9+
%v1 = vector.splat %f1 : vector<[4]xf32>
10+
%v2 = vector.splat %f2 : vector<[4]xf32>
11+
vector.print %v1 : vector<[4]xf32>
12+
vector.print %v2 : vector<[4]xf32>
13+
//
14+
// Test vectors:
15+
//
16+
// CHECK: ( 1, 1, 1, 1
17+
// CHECK: ( 2, 2, 2, 2
18+
19+
%v3 = vector.interleave %v1, %v2 : vector<[4]xf32>
20+
vector.print %v3 : vector<[8]xf32>
21+
// CHECK: ( 1, 2, 1, 2, 1, 2, 1, 2
22+
23+
return
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: mlir-opt %s -test-lower-to-llvm | \
2+
// RUN: mlir-cpu-runner -e entry -entry-point-result=void \
3+
// RUN: -shared-libs=%mlir_c_runner_utils | \
4+
// RUN: FileCheck %s
5+
6+
func.func @entry() {
7+
%f1 = arith.constant 1.0 : f32
8+
%f2 = arith.constant 2.0 : f32
9+
%v1 = vector.splat %f1 : vector<2x4xf32>
10+
%v2 = vector.splat %f2 : 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.interleave %v1, %v2 : vector<2x4xf32>
20+
vector.print %v3 : vector<2x8xf32>
21+
// CHECK: ( ( 1, 2, 1, 2, 1, 2, 1, 2 ), ( 1, 2, 1, 2, 1, 2, 1, 2 ) )
22+
23+
return
24+
}

0 commit comments

Comments
 (0)