@@ -30,6 +30,15 @@ def ArmNeon_Dialect : Dialect {
30
30
// to the LLVMDialect (ops or types).
31
31
}
32
32
33
+ //===----------------------------------------------------------------------===//
34
+ // ArmNeon type definition
35
+ //===----------------------------------------------------------------------===//
36
+
37
+ class NeonVectorOfLength<int length, Type elementType> : ShapedContainerType<
38
+ [elementType], And<[IsVectorOfShape<[length]>, IsFixedVectorTypePred]>,
39
+ "Neon vector of " # length # "x" # elementType.summary,
40
+ "::mlir::VectorType">;
41
+
33
42
//===----------------------------------------------------------------------===//
34
43
// ArmNeon op definitions
35
44
//===----------------------------------------------------------------------===//
@@ -141,11 +150,11 @@ def SmmlaOp : ArmNeon_OverloadedOperandsWithOneResultIntrOp<"smmla",[1], [
141
150
}];
142
151
// Supports (vector<16xi8>, vector<16xi8>) -> (vector<4xi32>)
143
152
let arguments = (ins
144
- VectorOfLengthAndType<[4], [ I32] >:$acc,
145
- VectorOfLengthAndType<[16], [I8] >:$src1,
146
- VectorOfLengthAndType<[16], [I8] >:$src2
153
+ NeonVectorOfLength<4, I32>:$acc,
154
+ NeonVectorOfLength<16, I8 >:$src1,
155
+ NeonVectorOfLength<16, I8 >:$src2
147
156
);
148
- let results = (outs VectorOfLengthAndType<[4], [ I32] >:$res);
157
+ let results = (outs NeonVectorOfLength<4, I32>:$res);
149
158
let assemblyFormat =
150
159
"$acc `,` $src1 `,` $src2 attr-dict `:` type($src1) `to` type($res)";
151
160
}
@@ -172,11 +181,11 @@ def UmmlaOp : ArmNeon_OverloadedOperandsWithOneResultIntrOp<"ummla",[1], [
172
181
}];
173
182
// Supports (vector<16xi8>, vector<16xi8>) -> (vector<4xi32>)
174
183
let arguments = (ins
175
- VectorOfLengthAndType<[4], [ I32] >:$acc,
176
- VectorOfLengthAndType<[16], [I8] >:$src1,
177
- VectorOfLengthAndType<[16], [I8] >:$src2
184
+ NeonVectorOfLength<4, I32>:$acc,
185
+ NeonVectorOfLength<16, I8 >:$src1,
186
+ NeonVectorOfLength<16, I8 >:$src2
178
187
);
179
- let results = (outs VectorOfLengthAndType<[4], [ I32] >:$res);
188
+ let results = (outs NeonVectorOfLength<4, I32>:$res);
180
189
let assemblyFormat =
181
190
"$acc `,` $src1 `,` $src2 attr-dict `:` type($src1) `to` type($res)";
182
191
}
@@ -204,11 +213,11 @@ def UsmmlaOp : ArmNeon_OverloadedOperandsWithOneResultIntrOp<"usmmla",[1], [
204
213
}];
205
214
// Supports (vector<16xi8>, vector<16xi8>) -> (vector<4xi32>)
206
215
let arguments = (ins
207
- VectorOfLengthAndType<[4], [ I32] >:$acc,
208
- VectorOfLengthAndType<[16], [I8] >:$src1,
209
- VectorOfLengthAndType<[16], [I8] >:$src2
216
+ NeonVectorOfLength<4, I32>:$acc,
217
+ NeonVectorOfLength<16, I8 >:$src1,
218
+ NeonVectorOfLength<16, I8 >:$src2
210
219
);
211
- let results = (outs VectorOfLengthAndType<[4], [ I32] >:$res);
220
+ let results = (outs NeonVectorOfLength<4, I32>:$res);
212
221
let assemblyFormat =
213
222
"$acc `,` $src1 `,` $src2 attr-dict `:` type($src1) `to` type($res)";
214
223
}
0 commit comments