@@ -137,20 +137,6 @@ class Arith_CompareOpOfAnyRank<string mnemonic, list<Trait> traits = []> :
137
137
let results = (outs BoolLikeOfAnyRank:$result);
138
138
}
139
139
140
- class Arith_IntBinaryOpWithOverflowFlags<string mnemonic, list<Trait> traits = []> :
141
- Arith_BinaryOp<mnemonic, traits #
142
- [Pure, DeclareOpInterfaceMethods<InferIntRangeInterface>,
143
- DeclareOpInterfaceMethods<ArithIntegerOverflowFlagsInterface>]>,
144
- Arguments<(ins SignlessIntegerLike:$lhs, SignlessIntegerLike:$rhs,
145
- DefaultValuedAttr<
146
- Arith_IntegerOverflowAttr,
147
- "::mlir::arith::IntegerOverflowFlags::none">:$overflowFlags)>,
148
- Results<(outs SignlessIntegerLike:$result)> {
149
-
150
- let assemblyFormat = [{ $lhs `,` $rhs (`overflow` `` $overflowFlags^)?
151
- attr-dict `:` type($result) }];
152
- }
153
-
154
140
//===----------------------------------------------------------------------===//
155
141
// ConstantOp
156
142
//===----------------------------------------------------------------------===//
@@ -206,7 +192,7 @@ def Arith_ConstantOp : Op<Arith_Dialect, "constant",
206
192
// AddIOp
207
193
//===----------------------------------------------------------------------===//
208
194
209
- def Arith_AddIOp : Arith_IntBinaryOpWithOverflowFlags <"addi", [Commutative]> {
195
+ def Arith_AddIOp : Arith_TotalIntBinaryOp <"addi", [Commutative]> {
210
196
let summary = "integer addition operation";
211
197
let description = [{
212
198
Performs N-bit addition on the operands. The operands are interpreted as
@@ -217,23 +203,16 @@ def Arith_AddIOp : Arith_IntBinaryOpWithOverflowFlags<"addi", [Commutative]> {
217
203
218
204
The `addi` operation takes two operands and returns one result, each of
219
205
these is required to be the same type. This type may be an integer scalar type,
220
- a vector whose element type is integer, or a tensor of integers.
221
-
222
- This op supports `nuw`/`nsw` overflow flags which stands stand for
223
- "No Unsigned Wrap" and "No Signed Wrap", respectively. If the `nuw` and/or
224
- `nsw` flags are present, and an unsigned/signed overflow occurs
225
- (respectively), the result is poison.
206
+ a vector whose element type is integer, or a tensor of integers. It has no
207
+ standard attributes.
226
208
227
209
Example:
228
210
229
211
```mlir
230
212
// Scalar addition.
231
213
%a = arith.addi %b, %c : i64
232
214
233
- // Scalar addition with overflow flags.
234
- %a = arith.addi %b, %c overflow<nsw, nuw> : i64
235
-
236
- // SIMD vector element-wise addition.
215
+ // SIMD vector element-wise addition, e.g. for Intel SSE.
237
216
%f = arith.addi %g, %h : vector<4xi32>
238
217
239
218
// Tensor element-wise addition.
@@ -299,41 +278,21 @@ def Arith_AddUIExtendedOp : Arith_Op<"addui_extended", [Pure, Commutative,
299
278
// SubIOp
300
279
//===----------------------------------------------------------------------===//
301
280
302
- def Arith_SubIOp : Arith_IntBinaryOpWithOverflowFlags <"subi"> {
281
+ def Arith_SubIOp : Arith_TotalIntBinaryOp <"subi"> {
303
282
let summary = [{
304
283
Integer subtraction operation.
305
284
}];
306
285
let description = [{
307
- Performs N-bit subtraction on the operands. The operands are interpreted as unsigned
308
- bitvectors. The result is represented by a bitvector containing the mathematical
309
- value of the subtraction modulo 2^n, where `n` is the bitwidth. Because `arith`
310
- integers use a two's complement representation, this operation is applicable on
286
+ Performs N-bit subtraction on the operands. The operands are interpreted as unsigned
287
+ bitvectors. The result is represented by a bitvector containing the mathematical
288
+ value of the subtraction modulo 2^n, where `n` is the bitwidth. Because `arith`
289
+ integers use a two's complement representation, this operation is applicable on
311
290
both signed and unsigned integer operands.
312
291
313
292
The `subi` operation takes two operands and returns one result, each of
314
- these is required to be the same type. This type may be an integer scalar type,
315
- a vector whose element type is integer, or a tensor of integers.
316
-
317
- This op supports `nuw`/`nsw` overflow flags which stands stand for
318
- "No Unsigned Wrap" and "No Signed Wrap", respectively. If the `nuw` and/or
319
- `nsw` flags are present, and an unsigned/signed overflow occurs
320
- (respectively), the result is poison.
321
-
322
- Example:
323
-
324
- ```mlir
325
- // Scalar subtraction.
326
- %a = arith.subi %b, %c : i64
327
-
328
- // Scalar subtraction with overflow flags.
329
- %a = arith.subi %b, %c overflow<nsw, nuw> : i64
330
-
331
- // SIMD vector element-wise subtraction.
332
- %f = arith.subi %g, %h : vector<4xi32>
333
-
334
- // Tensor element-wise subtraction.
335
- %x = arith.subi %y, %z : tensor<4x?xi8>
336
- ```
293
+ these is required to be the same type. This type may be an integer scalar type,
294
+ a vector whose element type is integer, or a tensor of integers. It has no
295
+ standard attributes.
337
296
}];
338
297
let hasFolder = 1;
339
298
let hasCanonicalizer = 1;
@@ -343,41 +302,21 @@ def Arith_SubIOp : Arith_IntBinaryOpWithOverflowFlags<"subi"> {
343
302
// MulIOp
344
303
//===----------------------------------------------------------------------===//
345
304
346
- def Arith_MulIOp : Arith_IntBinaryOpWithOverflowFlags <"muli", [Commutative]> {
305
+ def Arith_MulIOp : Arith_TotalIntBinaryOp <"muli", [Commutative]> {
347
306
let summary = [{
348
307
Integer multiplication operation.
349
308
}];
350
309
let description = [{
351
- Performs N-bit multiplication on the operands. The operands are interpreted as
352
- unsigned bitvectors. The result is represented by a bitvector containing the
353
- mathematical value of the multiplication modulo 2^n, where `n` is the bitwidth.
354
- Because `arith` integers use a two's complement representation, this operation is
310
+ Performs N-bit multiplication on the operands. The operands are interpreted as
311
+ unsigned bitvectors. The result is represented by a bitvector containing the
312
+ mathematical value of the multiplication modulo 2^n, where `n` is the bitwidth.
313
+ Because `arith` integers use a two's complement representation, this operation is
355
314
applicable on both signed and unsigned integer operands.
356
315
357
316
The `muli` operation takes two operands and returns one result, each of
358
- these is required to be the same type. This type may be an integer scalar type,
359
- a vector whose element type is integer, or a tensor of integers.
360
-
361
- This op supports `nuw`/`nsw` overflow flags which stands stand for
362
- "No Unsigned Wrap" and "No Signed Wrap", respectively. If the `nuw` and/or
363
- `nsw` flags are present, and an unsigned/signed overflow occurs
364
- (respectively), the result is poison.
365
-
366
- Example:
367
-
368
- ```mlir
369
- // Scalar multiplication.
370
- %a = arith.muli %b, %c : i64
371
-
372
- // Scalar multiplication with overflow flags.
373
- %a = arith.muli %b, %c overflow<nsw, nuw> : i64
374
-
375
- // SIMD vector element-wise multiplication.
376
- %f = arith.muli %g, %h : vector<4xi32>
377
-
378
- // Tensor element-wise multiplication.
379
- %x = arith.muli %y, %z : tensor<4x?xi8>
380
- ```
317
+ these is required to be the same type. This type may be an integer scalar type,
318
+ a vector whose element type is integer, or a tensor of integers. It has no
319
+ standard attributes.
381
320
}];
382
321
let hasFolder = 1;
383
322
let hasCanonicalizer = 1;
0 commit comments