• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  %v = std.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : vector<16xui4>
8  vector.print %v : vector<16xui4>
9  //
10  // Test vector:
11  //
12  // CHECK: ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 )
13
14  %0 = vector.reduction "add", %v : vector<16xui4> into ui4
15  vector.print %0 : ui4
16  // CHECK: 8
17
18  %1 = vector.reduction "mul", %v : vector<16xui4> into ui4
19  vector.print %1 : ui4
20  // CHECK: 0
21
22  %2 = vector.reduction "min", %v : vector<16xui4> into ui4
23  vector.print %2 : ui4
24  // CHECK: 0
25
26  %3 = vector.reduction "max", %v : vector<16xui4> into ui4
27  vector.print %3 : ui4
28  // CHECK: 15
29
30  %4 = vector.reduction "and", %v : vector<16xui4> into ui4
31  vector.print %4 : ui4
32  // CHECK: 0
33
34  %5 = vector.reduction "or", %v : vector<16xui4> into ui4
35  vector.print %5 : ui4
36  // CHECK: 15
37
38  %6 = vector.reduction "xor", %v : vector<16xui4> into ui4
39  vector.print %6 : ui4
40  // CHECK: 0
41
42  return
43}
44