[mlir][arith] Add canonicalization patterns for 'mul*i_extended'
authorJakub Kuderski <kubak@google.com>
Tue, 13 Dec 2022 15:49:14 +0000 (10:49 -0500)
committerJakub Kuderski <kubak@google.com>
Tue, 13 Dec 2022 15:49:15 +0000 (10:49 -0500)
commit834c17f618ce87b14446e42250d924b8d5f01abe
tree45b8b970ae9099c203ae479ffbbe402208af0c26
parent6b1ea24c265205190d3e73b08ed76e85988d76f5
[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

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