[mlir][arith] Add narrowing patterns for subi, divsi, and divui
authorJakub Kuderski <kubak@google.com>
Tue, 2 May 2023 14:41:05 +0000 (10:41 -0400)
committerJakub Kuderski <kubak@google.com>
Tue, 2 May 2023 14:44:29 +0000 (10:44 -0400)
commit46740dd02babfc47edd9f8fdb03479ad61223246
treed73f4785181bf03b3b38d6d1ec780d75955eca57
parent707b6e94b88a5bac96157d03756f359060458d08
[mlir][arith] Add narrowing patterns for subi, divsi, and divui

Each of these ops is compatible with only one extension kind and
produces an extra result bit.

I checked these transformation in Alive2:
1. subi + extsi: https://alive2.llvm.org/ce/z/ipmZZA
2. divsi + extsi: https://alive2.llvm.org/ce/z/fAcqUv
3. divui + extui: https://alive2.llvm.org/ce/z/QZJpFp

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149531
mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
mlir/test/Dialect/Arith/int-narrowing.mlir