[PATCH] D93767: [RISCV] Legalize select when Zbt extension available

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 4 09:17:52 PST 2021


lenary added a comment.

The code generation improvements here are looking good, let's hope they stay with a set of `riscv_selectcc` patterns.



================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoB.td:780
           (CMIX GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
-def : Pat<(riscv_selectcc GPR:$rs2, (XLenVT 0), (XLenVT 17), GPR:$rs3, GPR:$rs1),
+def : Pat<(select (XLenVT (setne GPR:$rs2, 0)), GPR:$rs1, GPR:$rs3),
+          (CMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
----------------
craig.topper wrote:
> mundaym wrote:
> > craig.topper wrote:
> > > Is there a difference between doing it this way versus just adding more riscv_selectcc patterns for other condition codes?
> > No I think either would work. Using `riscv_selectcc` would have the advantage that we'd only encounter normalised condition codes so we'd need fewer patterns. Do you have a preference?
> I think my preference is towards fewer patterns.
@mundaym and I discussed this today, and fewer patterns makes sense, though there's a slight hiccup with using `CondCode` directly in the `riscv_selectcc` pattern that he's looking into.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93767



More information about the llvm-commits mailing list