[PATCH] D150670: [WebAssembly] Disable generation of fshl/fshr for rotates
Paulo Matos via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 17 23:55:22 PDT 2023
pmatos added a comment.
In D150670#4351147 <https://reviews.llvm.org/D150670#4351147>, @nikic wrote:
> This doesn't looks like a wasm specific problem. You get essentially the same issue on any target that has a rotate instruction but no funnel shift instruction. Here are just a couple examples: https://godbolt.org/z/8v6nfaax9
Yes, I am indeed aware this is not specific to wasm. What's specific to wasm afaiu is that the code generated is much worse when expanding fshl. That's what I mentioned in the bug discussion here: https://github.com/llvm/llvm-project/issues/62703#issuecomment-1548474310
> I believe this needs to be either solved by preventing demanded bits simplifications that break a rotate pattern (though I'm not sure if that would break any other optimizations we care about) or by adding a special case for this in the backend when lowering FSH to ROT.
Preventing the simplification means adding target specific code in instcombine which seems even worse than adding it here given as @dschuff
pointed out, there's precedent with x86.
> Lowering to a rotate intrinsic only "solves" this for wasm and will at the same time make these rotates completely opaque to optimization -- heck, it looks like we don't even support constant folding for these intrinsics (https://llvm.godbolt.org/z/hMWG16b9W).
I just added the intrinsics, so those optimizations were not added yet.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150670/new/
https://reviews.llvm.org/D150670
More information about the cfe-commits
mailing list