[PATCH] D131482: [RISCV] Return true in hasBitTest when Zbs is enabled and update BEXTI pattern for resulting canonicalisation

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 08:52:34 PDT 2022


craig.topper added a comment.

In D131482#3712522 <https://reviews.llvm.org/D131482#3712522>, @reames wrote:

> LGTM
>
> Glancing at the pattern, I find myself wondering if we can generalize further.  You have:
>
>   def : Pat<(seteq (and GPR:$rs1, SingleBitSetMask:$mask), 0),
>             (BEXTI (XORI GPR:$rs1, -1), SingleBitSetMask:$mask)>;
>
> Could we do something like:
>
>   def : Pat<(and GPR:$rs1, SingleBitSetMask:$mask),
>             (BEXTI GPR:$rs1, SingleBitSetMask:$mask)>;
>
> Follow up only to be clear.

That does not work. BEXTI returns 0 or 1. An And keeps the bit in the same place.


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

https://reviews.llvm.org/D131482



More information about the llvm-commits mailing list