[PATCH] D129357: [LoongArch] Implement OR combination to generate bstrins.w/d

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 06:06:46 PDT 2022


SixWeining added a comment.

In D129357#3638731 <https://reviews.llvm.org/D129357#3638731>, @xen0n wrote:

> What about the arguably more common case of `a = b | ((c & mask) << shamt)` (when `c` is not known to be small enough to not require the masking) or `a = b | (c & mask)`, where all positions in `a` to be overwritten by the incoming bits are known to be zero?
>
> One of the applicable real-world scenario is RISC code generation, where a lot of ORing between a "clean" insn template and shifted/masked operands take place. One doesn't mask the bits in the template hence the optimization chance is missed.
>
> The other cases LGTM, though.

Sorry to reply so late. Good suggestion! And `a = b | ((c << shamt) & shifted_mask)` seems also apply. Let me try to update the revision. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129357/new/

https://reviews.llvm.org/D129357



More information about the llvm-commits mailing list