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
6//
7// Test various signless, signed, unsigned integer types.
8//
9func @entry() {
10  %0 = std.constant dense<[true, false, -1, 0, 1]> : vector<5xi1>
11  vector.print %0 : vector<5xi1>
12  // CHECK: ( 1, 0, 1, 0, 1 )
13
14  %1 = std.constant dense<[true, false, -1, 0]> : vector<4xsi1>
15  vector.print %1 : vector<4xsi1>
16  // CHECK: ( 1, 0, 1, 0 )
17
18  %2 = std.constant dense<[true, false, 0, 1]> : vector<4xui1>
19  vector.print %2 : vector<4xui1>
20  // CHECK: ( 1, 0, 0, 1 )
21
22  %3 = std.constant dense<[-128, -127, -1, 0, 1, 127, 128, 254, 255]> : vector<9xi8>
23  vector.print %3 : vector<9xi8>
24  // CHECK: ( -128, -127, -1, 0, 1, 127, -128, -2, -1 )
25
26  %4 = std.constant dense<[-128, -127, -1, 0, 1, 127]> : vector<6xsi8>
27  vector.print %4 : vector<6xsi8>
28  // CHECK: ( -128, -127, -1, 0, 1, 127 )
29
30  %5 = std.constant dense<[0, 1, 127, 128, 254, 255]> : vector<6xui8>
31  vector.print %5 : vector<6xui8>
32  // CHECK: ( 0, 1, 127, 128, 254, 255 )
33
34  %6 = std.constant dense<[-32768, -32767, -1, 0, 1, 32767, 32768, 65534, 65535]> : vector<9xi16>
35  vector.print %6 : vector<9xi16>
36  // CHECK: ( -32768, -32767, -1, 0, 1, 32767, -32768, -2, -1 )
37
38  %7 = std.constant dense<[-32768, -32767, -1, 0, 1, 32767]> : vector<6xsi16>
39  vector.print %7 : vector<6xsi16>
40  // CHECK: ( -32768, -32767, -1, 0, 1, 32767 )
41
42  %8 = std.constant dense<[0, 1, 32767, 32768, 65534, 65535]> : vector<6xui16>
43  vector.print %8 : vector<6xui16>
44  // CHECK: ( 0, 1, 32767, 32768, 65534, 65535 )
45
46  %9 = std.constant dense<[-2147483648, -2147483647, -1, 0, 1,
47                            2147483647, 2147483648, 4294967294, 4294967295]> : vector<9xi32>
48  vector.print %9 : vector<9xi32>
49  // CHECK: ( -2147483648, -2147483647, -1, 0, 1, 2147483647, -2147483648, -2, -1 )
50
51  %10 = std.constant dense<[-2147483648, -2147483647, -1, 0, 1, 2147483647]> : vector<6xsi32>
52  vector.print %10 : vector<6xsi32>
53  // CHECK: ( -2147483648, -2147483647, -1, 0, 1, 2147483647 )
54
55  %11 = std.constant dense<[0, 1, 2147483647, 2147483648, 4294967294, 4294967295]> : vector<6xui32>
56  vector.print %11 : vector<6xui32>
57  // CHECK: ( 0, 1, 2147483647, 2147483648, 4294967294, 4294967295 )
58
59  %12 = std.constant dense<[-9223372036854775808, -9223372036854775807, -1, 0, 1,
60                             9223372036854775807, 9223372036854775808,
61                             18446744073709551614, 18446744073709551615]> : vector<9xi64>
62  vector.print %12 : vector<9xi64>
63  // CHECK: ( -9223372036854775808, -9223372036854775807, -1, 0, 1, 9223372036854775807, -9223372036854775808, -2, -1 )
64
65  %13 = std.constant dense<[-9223372036854775808, -9223372036854775807, -1, 0, 1,
66                             9223372036854775807]> : vector<6xsi64>
67  vector.print %13 : vector<6xsi64>
68  // CHECK: ( -9223372036854775808, -9223372036854775807, -1, 0, 1, 9223372036854775807 )
69
70  %14 = std.constant dense<[0, 1, 9223372036854775807, 9223372036854775808,
71                            18446744073709551614, 18446744073709551615]> : vector<6xui64>
72  vector.print %14 : vector<6xui64>
73  // CHECK: ( 0, 1, 9223372036854775807, 9223372036854775808, 18446744073709551614, 18446744073709551615 )
74
75  return
76}
77