[PATCH] D150670: [InstCombine] Disable generation of fshl/fshr for rotates

Paulo Matos via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 02:14:24 PDT 2023


pmatos added a comment.

In D150670#4383823 <https://reviews.llvm.org/D150670#4383823>, @nikic wrote:

> Can you please drop all wasm related tests and instead add an InstCombine test for the fsh+and pattern?
>
> It would also be good to have a test where we can fold one side to a constant, but that constant is not zero. We should then consider whether that is profitable or not. (In that case we can't reduce to a simple shift and will reduce to a shift and or with constant instead -- is that better or worse than a rotate?)

I have added the tests. I looked into the output of WebAssembly and it looks good. Even in the case of the generation of a non-zero const, Wasm still managed to generate a rotate which is generally more profitable, since the runtime can be then the one choosing how to implement that depending on the hardware. In the general case, I am not sure what the right answer is tbh.


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