[PATCH] D117680: [InstCombine] Fold bswap(shl(x, C)) -> and(x, 255)
Paweł Bylica via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 19 09:10:40 PST 2022
chfast added a comment.
Hi @spatel,
My motivation is rather boring. I have a generic data -> integer loader. The data is in big-endian order. For i32 example the data can be from 1 to 4 bytes in size. Here is the generic template which handles all 4 cases:
https://godbolt.org/z/dPcGjvb94
The `load<1>` has unnecessary `bswap`, there `zext(*data)` should be enough.
There may be some optimization opportunities in `load<3>` but I did not investigated this in detail.
I can implement other proposed matches on IR and CodeGen levels if you think this is good idea.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117680/new/
https://reviews.llvm.org/D117680
More information about the llvm-commits
mailing list