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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 12:36:14 PDT 2022


reames added a comment.

In D131482#3713009 <https://reviews.llvm.org/D131482#3713009>, @craig.topper wrote:

> 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.

Doh.  And the same mistake I already made once in this review as well.  Oops.


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

https://reviews.llvm.org/D131482



More information about the llvm-commits mailing list