[PATCH] D131482: [RISCV] Return true in hasBitTest for Zbs and add new BINVI pattern for resulting canonicalisation
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 9 08:09:20 PDT 2022
reames requested changes to this revision.
reames added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoZb.td:896
(BINVI GPR:$rs1, BSETINVMask:$mask)>;
+def : Pat<(seteq (and GPR:$rs1, pow2_mask:$mask), 0),
+ (BINVI GPR:$rs1, pow2_mask:$mask)>;
----------------
I think this needs to use BSETINVMask. If I follow the existing logic right, we're preferring and/xor for immediate masks which fit within 12 bits.
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoZb.td:902
def : Pat<(and (not (srl GPR:$rs1, uimmlog2xlen:$shamt)), (XLenVT 1)),
(XORI (BEXTI GPR:$rs1, uimmlog2xlen:$shamt), (XLenVT 1))>;
----------------
This pattern looks to be matching the old canonicalization, but oddly, not using the BINV.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131482/new/
https://reviews.llvm.org/D131482
More information about the llvm-commits
mailing list