The arith.addi_carry op implements integer addition with overflows. The carry is returned via the second result, as i1.
Details
Diff Detail
Event Timeline
This patch actually contains both the new arith op definition and lowering to SPIR-V. What about splitting them into two patches for more targeted patches and a clean history?
mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
---|---|---|
245 | It's fine to construct a temporary mlir::Builder using the context with mlir::Builder(getContext()) and then call the getZeroAttr method. In MLIR attributes are uniqued and kept in the context and have a lifelime as a context. So it's fine. (mlir::OpBuilder is different---it can build operations and thus would need an insertion point and are stateful, etc.) | |
mlir/test/Dialect/Arithmetic/canonicalize.mlir | ||
549 | Normally we won't want to directly use the symbols from printer given they can be changed and thus break these tests. It's unlikely that we are gonna change how function arguments are printed though. So it's fine then, given other tests already use it. |
mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
---|---|---|
245 | Ah, makes sense, thanks! |
Added comments, removed includes.
mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
---|---|---|
24 | I removed all of these. | |
239–289 | I added some prose. Is this what you expected? Other fold functions in this file don't seem to explain much when it comes to the default case that calls the default folder (constFoldBinaryOp). | |
268–269 | Actually I don't think these are needed/useful, as constFoldBinaryOp must already check the same things. I removed them. |
mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
---|---|---|
24 |
mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
---|---|---|
263 | Typo: calculate |
Not needed.