[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 17:43:33 PDT 2022


SixWeining added a comment.

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

> 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.
>
> And of course I meant "all positions in `b` to be overwritten ...", instead of `a` which is the destination. "Known bits" is the key though.

Yes, I have noticed that. :)


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