Reland "[mlir][arith] Add canonicalization patterns for 'mul*i_extended'"
authorJakub Kuderski <kubak@google.com>
Tue, 13 Dec 2022 19:33:22 +0000 (14:33 -0500)
committerJakub Kuderski <kubak@google.com>
Tue, 13 Dec 2022 19:33:31 +0000 (14:33 -0500)
commitdbf42f0b1269eacb928efc079fd6ee54975c91da
treee60086d865404cb5bae31f648eb09e04b28a4f80
parent3a020527c2af10741b12e756de45bd6f774885a4
Reland "[mlir][arith] Add canonicalization patterns for 'mul*i_extended'"

- Add a fold for `mulsi_extended(x, 1)`
- Add folds to demote wide integer multiplication to `mul*i_extended` when the result is shifted
   and truncated: `trunci(shrui(mul(*ext(x), *ext(y)), c)) -> mul*i_extended(x, y)`

Reviewed By: Mogball, jpienaar

Differential Revision: https://reviews.llvm.org/D139778
mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td
mlir/lib/Dialect/Arith/IR/ArithOps.cpp
mlir/test/Dialect/Arith/canonicalize.mlir