- 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)
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td | ||
---|---|---|
125 | FYI, this is my first time writing non-trivial DDR, I'd appreciate feedback if you see how to simplify these or make them more idiomatic. |
Can you update the description to explain the pattern? It's hard to tell at-a-glance what I'm looking for
mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td | ||
---|---|---|
289 | Do you care about matching arith constantop explicitly? Else use constantlikematcher | |
mlir/lib/Dialect/Arith/IR/ArithOps.cpp | ||
80 | I would probably use getElementTypeOrSame followed by this rather than getElementTypeBitWidth. | |
86 | With (getScalarOrElementWidth($0) - getScalarOrElementWidth($1)) == " "getIntOrSplatIntValue($2) it seems this will happily allow for known and unsupported cases with this chosen sentinel. And one could end up with $0 having width 1, $1 unsupported (so -1) and a shift amount of 2 and the constraint is happy. | |
101 | -1 is a valid integer so using it as a sentinel here seems problematic given generic name of function. |
mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td | ||
---|---|---|
289 | These patterns don't but this seems to be the convention used in this file. |
mlir/lib/Dialect/Arith/IR/ArithOps.cpp | ||
---|---|---|
86 | I think this can't happen in valid IR because of the other type constraints |
FYI, this is my first time writing non-trivial DDR, I'd appreciate feedback if you see how to simplify these or make them more idiomatic.