For integer extension or truncation with type emulation, we need
to make sure we perform masking or shifting to discard unwanted
bits to avoid pollute consumer ops.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp | ||
---|---|---|
113–114 | nit: I implemented a similar helper in wide int emulation: https://github.com/llvm/llvm-project/blob/da56750f82a60b5872679424fc6ae78a42c786a0/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp#L62-L74. I think that implementation is a little bit more concise and uses SplatElementsAttr::get without a temporary vector. | |
565–568 | Should we assert that the shift amount is as expected? ([0, BW-1]) | |
579 | the right *sign* (i.e., the MSB) bit? I think the sign bit may not be the leading bit depending on the endiannes, no? | |
621 | Outdated comment? This pattern doesn't generate any selects. | |
644 | Should we do uint64_t(1) << bw if the helper expects u64 anyway? Or even better, use one of the helpers in MathExtras to create a mask: https://llvm.org/doxygen/namespacellvm.html#a79dff91526e31b1a05f59eed6c189eb4? | |
691 | Same: the comment doesn't match the code | |
713 | Also here |
nit: I implemented a similar helper in wide int emulation: https://github.com/llvm/llvm-project/blob/da56750f82a60b5872679424fc6ae78a42c786a0/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp#L62-L74.
I think that implementation is a little bit more concise and uses SplatElementsAttr::get without a temporary vector.