[PATCH] D155083: [RISCV] Introduce RISCVISD::CZERO_{EQZ,NEZ} nodes produce them when zicond is present in lowerSELECT

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 06:59:50 PDT 2023


asb created this revision.
asb added reviewers: craig.topper, reames, luke.
Herald added subscribers: jobnoorman, wingo, pmatos, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
asb requested review of this revision.
Herald added subscribers: wangpc, eopXD, MaskRay.
Herald added a project: LLVM.

This patch is a step towards altering how we handle the emission of condops. Marking ISD::SELECT as legal is a major change in the codegen path, and gives few options for maintaining the old codegen path when it is believed to be better (e.g. a better branchless sequence is possible using non-zicond instructions, or the branch-based sequence is preferable).

      

This removes the existing SelectionDAG patterns and moves the logic into lowerSELECT. Along some small codegen changes you'll note a few minor regressions in the generated code quality - this are due to the fact that by lowering the SELECT node early we miss out on combines that would kick in later when setcc condcodes that aren't natively supported have been expanded (thus exposing opportunities for optimisation by performing logical negation and swapping truev/falsev). I've opted to split out work that addresses these into follow-on patches, but can merge in if preferred.

      

matchSetCC is a straight-forward translation from the version in RISCVISelDAGToDAG. I haven't yet looked at the viability of having a shared helper.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155083

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/lib/Target/RISCV/RISCVInstrInfoZicond.td
  llvm/test/CodeGen/RISCV/condops.ll
  llvm/test/CodeGen/RISCV/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155083.539543.patch
Type: text/x-patch
Size: 19861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/3dafc896/attachment.bin>


More information about the llvm-commits mailing list