xref: /llvm-project/mlir/test/Dialect/Builtin/Bytecode/types.mlir (revision bb0bbed610d86ba155f9c066c23038f7f34e2dbb)
1// RUN: mlir-opt -emit-bytecode %s | mlir-opt | FileCheck %s
2
3//===----------------------------------------------------------------------===//
4// ComplexType
5//===----------------------------------------------------------------------===//
6
7// CHECK-LABEL: @TestComplex
8module @TestComplex attributes {
9  // CHECK: bytecode.test = complex<i32>
10  bytecode.test = complex<i32>
11} {}
12
13//===----------------------------------------------------------------------===//
14// FloatType
15//===----------------------------------------------------------------------===//
16
17// CHECK-LABEL: @TestFloat
18module @TestFloat attributes {
19  // CHECK: bytecode.test = bf16,
20  // CHECK: bytecode.test1 = f16,
21  // CHECK: bytecode.test2 = f32,
22  // CHECK: bytecode.test3 = f64,
23  // CHECK: bytecode.test4 = f80,
24  // CHECK: bytecode.test5 = f128
25  bytecode.test = bf16,
26  bytecode.test1 = f16,
27  bytecode.test2 = f32,
28  bytecode.test3 = f64,
29  bytecode.test4 = f80,
30  bytecode.test5 = f128
31} {}
32
33//===----------------------------------------------------------------------===//
34// IntegerType
35//===----------------------------------------------------------------------===//
36
37// CHECK-LABEL: @TestInteger
38module @TestInteger attributes {
39  // CHECK: bytecode.int = i1024,
40  // CHECK: bytecode.int1 = si32,
41  // CHECK: bytecode.int2 = ui512
42  bytecode.int = i1024,
43  bytecode.int1 = si32,
44  bytecode.int2 = ui512
45} {}
46
47//===----------------------------------------------------------------------===//
48// IndexType
49//===----------------------------------------------------------------------===//
50
51// CHECK-LABEL: @TestIndex
52module @TestIndex attributes {
53  // CHECK: bytecode.index = index
54  bytecode.index = index
55} {}
56
57//===----------------------------------------------------------------------===//
58// FunctionType
59//===----------------------------------------------------------------------===//
60
61// CHECK-LABEL: @TestFunc
62module @TestFunc attributes {
63  // CHECK: bytecode.func = () -> (),
64  // CHECK: bytecode.func1 = (i1) -> i32
65  bytecode.func = () -> (),
66  bytecode.func1 = (i1) -> (i32)
67} {}
68
69//===----------------------------------------------------------------------===//
70// MemRefType
71//===----------------------------------------------------------------------===//
72
73// CHECK-LABEL: @TestMemRef
74module @TestMemRef attributes {
75  // CHECK: bytecode.test = memref<2xi8>,
76  // CHECK: bytecode.test1 = memref<2xi8, 1>
77  bytecode.test = memref<2xi8>,
78  bytecode.test1 = memref<2xi8, 1>
79} {}
80
81//===----------------------------------------------------------------------===//
82// NoneType
83//===----------------------------------------------------------------------===//
84
85// CHECK-LABEL: @TestNone
86module @TestNone attributes {
87  // CHECK: bytecode.test = none
88  bytecode.test = none
89} {}
90
91//===----------------------------------------------------------------------===//
92// RankedTensorType
93//===----------------------------------------------------------------------===//
94
95// CHECK-LABEL: @TestRankedTensor
96module @TestRankedTensor attributes {
97  // CHECK: bytecode.test = tensor<16x32x?xf64>,
98  // CHECK: bytecode.test1 = tensor<16xf64, "sparse">
99  bytecode.test = tensor<16x32x?xf64>,
100  bytecode.test1 = tensor<16xf64, "sparse">
101} {}
102
103//===----------------------------------------------------------------------===//
104// TupleType
105//===----------------------------------------------------------------------===//
106
107// CHECK-LABEL: @TestTuple
108module @TestTuple attributes {
109  // CHECK: bytecode.test = tuple<>,
110  // CHECK: bytecode.test1 = tuple<i32, i1, f32>
111  bytecode.test = tuple<>,
112  bytecode.test1 = tuple<i32, i1, f32>
113} {}
114
115//===----------------------------------------------------------------------===//
116// UnrankedMemRefType
117//===----------------------------------------------------------------------===//
118
119// CHECK-LABEL: @TestUnrankedMemRef
120module @TestUnrankedMemRef attributes {
121  // CHECK: bytecode.test = memref<*xi8>,
122  // CHECK: bytecode.test1 = memref<*xi8, 1>
123  bytecode.test = memref<*xi8>,
124  bytecode.test1 = memref<*xi8, 1>
125} {}
126
127//===----------------------------------------------------------------------===//
128// UnrankedTensorType
129//===----------------------------------------------------------------------===//
130
131// CHECK-LABEL: @TestUnrankedTensor
132module @TestUnrankedTensor attributes {
133  // CHECK: bytecode.test = tensor<*xi8>
134  bytecode.test = tensor<*xi8>
135} {}
136
137//===----------------------------------------------------------------------===//
138// VectorType
139//===----------------------------------------------------------------------===//
140
141// CHECK-LABEL: @TestVector
142module @TestVector attributes {
143  // CHECK: bytecode.test = vector<8x8x128xi8>,
144  // CHECK: bytecode.test1 = vector<8x[8]xf32>
145  bytecode.test = vector<8x8x128xi8>,
146  bytecode.test1 = vector<8x[8]xf32>
147} {}
148