1// RUN: mlir-opt %s -test-lower-to-llvm | \ 2// RUN: mlir-runner -e entry -entry-point-result=void \ 3// RUN: -shared-libs=%mlir_c_runner_utils | \ 4// RUN: FileCheck %s 5 6// 7// Test various signless, signed, unsigned integer types. 8// 9func.func @entry() { 10 %0 = arith.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 = arith.constant dense<[true, false, -1, 0]> : vector<4xi1> 15 %cast_1 = vector.bitcast %1 : vector<4xi1> to vector<4xsi1> 16 vector.print %cast_1 : vector<4xsi1> 17 // CHECK: ( 1, 0, 1, 0 ) 18 19 %2 = arith.constant dense<[true, false, 0, 1]> : vector<4xi1> 20 %cast_2 = vector.bitcast %2 : vector<4xi1> to vector<4xui1> 21 vector.print %cast_2 : vector<4xui1> 22 // CHECK: ( 1, 0, 0, 1 ) 23 24 %3 = arith.constant dense<[-128, -127, -1, 0, 1, 127, 128, 254, 255]> : vector<9xi8> 25 vector.print %3 : vector<9xi8> 26 // CHECK: ( -128, -127, -1, 0, 1, 127, -128, -2, -1 ) 27 28 %4 = arith.constant dense<[-128, -127, -1, 0, 1, 127]> : vector<6xi8> 29 %cast_4 = vector.bitcast %4 : vector<6xi8> to vector<6xsi8> 30 vector.print %cast_4 : vector<6xsi8> 31 // CHECK: ( -128, -127, -1, 0, 1, 127 ) 32 33 %5 = arith.constant dense<[0, 1, 127, 128, 254, 255]> : vector<6xi8> 34 %cast_5 = vector.bitcast %5 : vector<6xi8> to vector<6xui8> 35 vector.print %cast_5 : vector<6xui8> 36 // CHECK: ( 0, 1, 127, 128, 254, 255 ) 37 38 %6 = arith.constant dense<[-32768, -32767, -1, 0, 1, 32767, 32768, 65534, 65535]> : vector<9xi16> 39 vector.print %6 : vector<9xi16> 40 // CHECK: ( -32768, -32767, -1, 0, 1, 32767, -32768, -2, -1 ) 41 42 %7 = arith.constant dense<[-32768, -32767, -1, 0, 1, 32767]> : vector<6xi16> 43 %cast_7 = vector.bitcast %7 : vector<6xi16> to vector<6xsi16> 44 vector.print %cast_7 : vector<6xsi16> 45 // CHECK: ( -32768, -32767, -1, 0, 1, 32767 ) 46 47 %8 = arith.constant dense<[0, 1, 32767, 32768, 65534, 65535]> : vector<6xi16> 48 %cast_8 = vector.bitcast %8 : vector<6xi16> to vector<6xui16> 49 vector.print %cast_8 : vector<6xui16> 50 // CHECK: ( 0, 1, 32767, 32768, 65534, 65535 ) 51 52 %9 = arith.constant dense<[-2147483648, -2147483647, -1, 0, 1, 53 2147483647, 2147483648, 4294967294, 4294967295]> : vector<9xi32> 54 vector.print %9 : vector<9xi32> 55 // CHECK: ( -2147483648, -2147483647, -1, 0, 1, 2147483647, -2147483648, -2, -1 ) 56 57 %10 = arith.constant dense<[-2147483648, -2147483647, -1, 0, 1, 2147483647]> : vector<6xi32> 58 %cast_10 = vector.bitcast %10 : vector<6xi32> to vector<6xsi32> 59 vector.print %cast_10 : vector<6xsi32> 60 // CHECK: ( -2147483648, -2147483647, -1, 0, 1, 2147483647 ) 61 62 %11 = arith.constant dense<[0, 1, 2147483647, 2147483648, 4294967294, 4294967295]> : vector<6xi32> 63 %cast_11 = vector.bitcast %11 : vector<6xi32> to vector<6xui32> 64 vector.print %cast_11 : vector<6xui32> 65 // CHECK: ( 0, 1, 2147483647, 2147483648, 4294967294, 4294967295 ) 66 67 %12 = arith.constant dense<[-9223372036854775808, -9223372036854775807, -1, 0, 1, 68 9223372036854775807, 9223372036854775808, 69 18446744073709551614, 18446744073709551615]> : vector<9xi64> 70 vector.print %12 : vector<9xi64> 71 // CHECK: ( -9223372036854775808, -9223372036854775807, -1, 0, 1, 9223372036854775807, -9223372036854775808, -2, -1 ) 72 73 %13 = arith.constant dense<[-9223372036854775808, -9223372036854775807, -1, 0, 1, 74 9223372036854775807]> : vector<6xi64> 75 %cast_13 = vector.bitcast %13 : vector<6xi64> to vector<6xsi64> 76 vector.print %cast_13 : vector<6xsi64> 77 // CHECK: ( -9223372036854775808, -9223372036854775807, -1, 0, 1, 9223372036854775807 ) 78 79 %14 = arith.constant dense<[0, 1, 9223372036854775807, 9223372036854775808, 80 18446744073709551614, 18446744073709551615]> : vector<6xi64> 81 %cast_14 = vector.bitcast %14 : vector<6xi64> to vector<6xui64> 82 vector.print %cast_14 : vector<6xui64> 83 // CHECK: ( 0, 1, 9223372036854775807, 9223372036854775808, 18446744073709551614, 18446744073709551615 ) 84 85 return 86} 87