@@ -24,8 +24,25 @@ class SPIRV_ArithmeticBinaryOp<string mnemonic, Type type,
24
24
SPIRV_BinaryOp<mnemonic, type, type,
25
25
!listconcat(traits,
26
26
[Pure, AllTypesMatch<["operand1", "operand2", "result"]>])> {
27
- // In addition to normal types arithmetic instructions can support cooperative
28
- // matrix.
27
+ let arguments = (ins
28
+ SPIRV_ScalarOrVectorOf<type>:$operand1,
29
+ SPIRV_ScalarOrVectorOf<type>:$operand2
30
+ );
31
+
32
+ let results = (outs
33
+ SPIRV_ScalarOrVectorOf<type>:$result
34
+ );
35
+ let assemblyFormat = "operands attr-dict `:` type($result)";
36
+ }
37
+
38
+ class SPIRV_ArithmeticBinaryOpWithCoopMatrix<string mnemonic, Type type,
39
+ list<Trait> traits = []> :
40
+ // Operands type same as result type.
41
+ SPIRV_BinaryOp<mnemonic, type, type,
42
+ !listconcat(traits,
43
+ [Pure, AllTypesMatch<["operand1", "operand2", "result"]>])> {
44
+ // In addition to normal types these arithmetic instructions can support
45
+ // cooperative matrix.
29
46
let arguments = (ins
30
47
SPIRV_ScalarOrVectorOrCoopMatrixOf<type>:$operand1,
31
48
SPIRV_ScalarOrVectorOrCoopMatrixOf<type>:$operand2
@@ -82,7 +99,7 @@ class SPIRV_ArithmeticExtendedBinaryOp<string mnemonic,
82
99
83
100
// -----
84
101
85
- def SPIRV_FAddOp : SPIRV_ArithmeticBinaryOp <"FAdd", SPIRV_Float, [Commutative]> {
102
+ def SPIRV_FAddOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"FAdd", SPIRV_Float, [Commutative]> {
86
103
let summary = "Floating-point addition of Operand 1 and Operand 2.";
87
104
88
105
let description = [{
@@ -104,7 +121,7 @@ def SPIRV_FAddOp : SPIRV_ArithmeticBinaryOp<"FAdd", SPIRV_Float, [Commutative]>
104
121
105
122
// -----
106
123
107
- def SPIRV_FDivOp : SPIRV_ArithmeticBinaryOp <"FDiv", SPIRV_Float, []> {
124
+ def SPIRV_FDivOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"FDiv", SPIRV_Float, []> {
108
125
let summary = "Floating-point division of Operand 1 divided by Operand 2.";
109
126
110
127
let description = [{
@@ -154,7 +171,7 @@ def SPIRV_FModOp : SPIRV_ArithmeticBinaryOp<"FMod", SPIRV_Float, []> {
154
171
155
172
// -----
156
173
157
- def SPIRV_FMulOp : SPIRV_ArithmeticBinaryOp <"FMul", SPIRV_Float, [Commutative]> {
174
+ def SPIRV_FMulOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"FMul", SPIRV_Float, [Commutative]> {
158
175
let summary = "Floating-point multiplication of Operand 1 and Operand 2.";
159
176
160
177
let description = [{
@@ -229,7 +246,7 @@ def SPIRV_FRemOp : SPIRV_ArithmeticBinaryOp<"FRem", SPIRV_Float, []> {
229
246
230
247
// -----
231
248
232
- def SPIRV_FSubOp : SPIRV_ArithmeticBinaryOp <"FSub", SPIRV_Float, []> {
249
+ def SPIRV_FSubOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"FSub", SPIRV_Float, []> {
233
250
let summary = "Floating-point subtraction of Operand 2 from Operand 1.";
234
251
235
252
let description = [{
@@ -251,9 +268,9 @@ def SPIRV_FSubOp : SPIRV_ArithmeticBinaryOp<"FSub", SPIRV_Float, []> {
251
268
252
269
// -----
253
270
254
- def SPIRV_IAddOp : SPIRV_ArithmeticBinaryOp <"IAdd",
255
- SPIRV_Integer,
256
- [Commutative, UsableInSpecConstantOp]> {
271
+ def SPIRV_IAddOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"IAdd",
272
+ SPIRV_Integer,
273
+ [Commutative, UsableInSpecConstantOp]> {
257
274
let summary = "Integer addition of Operand 1 and Operand 2.";
258
275
259
276
let description = [{
@@ -322,9 +339,9 @@ def SPIRV_IAddCarryOp : SPIRV_ArithmeticExtendedBinaryOp<"IAddCarry",
322
339
323
340
// -----
324
341
325
- def SPIRV_IMulOp : SPIRV_ArithmeticBinaryOp <"IMul",
326
- SPIRV_Integer,
327
- [Commutative, UsableInSpecConstantOp]> {
342
+ def SPIRV_IMulOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"IMul",
343
+ SPIRV_Integer,
344
+ [Commutative, UsableInSpecConstantOp]> {
328
345
let summary = "Integer multiplication of Operand 1 and Operand 2.";
329
346
330
347
let description = [{
@@ -354,9 +371,9 @@ def SPIRV_IMulOp : SPIRV_ArithmeticBinaryOp<"IMul",
354
371
355
372
// -----
356
373
357
- def SPIRV_ISubOp : SPIRV_ArithmeticBinaryOp <"ISub",
358
- SPIRV_Integer,
359
- [UsableInSpecConstantOp]> {
374
+ def SPIRV_ISubOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"ISub",
375
+ SPIRV_Integer,
376
+ [UsableInSpecConstantOp]> {
360
377
let summary = "Integer subtraction of Operand 2 from Operand 1.";
361
378
362
379
let description = [{
@@ -460,9 +477,9 @@ def SPIRV_DotOp : SPIRV_Op<"Dot",
460
477
461
478
// -----
462
479
463
- def SPIRV_SDivOp : SPIRV_ArithmeticBinaryOp <"SDiv",
464
- SPIRV_Integer,
465
- [UsableInSpecConstantOp]> {
480
+ def SPIRV_SDivOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"SDiv",
481
+ SPIRV_Integer,
482
+ [UsableInSpecConstantOp]> {
466
483
let summary = "Signed-integer division of Operand 1 divided by Operand 2.";
467
484
468
485
let description = [{
@@ -622,9 +639,9 @@ def SPIRV_SRemOp : SPIRV_ArithmeticBinaryOp<"SRem",
622
639
623
640
// -----
624
641
625
- def SPIRV_UDivOp : SPIRV_ArithmeticBinaryOp <"UDiv",
626
- SPIRV_Integer,
627
- [UnsignedOp, UsableInSpecConstantOp]> {
642
+ def SPIRV_UDivOp : SPIRV_ArithmeticBinaryOpWithCoopMatrix <"UDiv",
643
+ SPIRV_Integer,
644
+ [UnsignedOp, UsableInSpecConstantOp]> {
628
645
let summary = "Unsigned-integer division of Operand 1 divided by Operand 2.";
629
646
630
647
let description = [{
0 commit comments