[PATCH] D140421: [RISCV] Add more XVentanCondOps patterns.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 10:54:08 PST 2022


craig.topper created this revision.
craig.topper added reviewers: reames, kconsul, asb, luismarques.
Herald added subscribers: sunshaoce, VincentWu, StephenFan, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, steven.zhang, 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.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Add patterns with seteq/setne conditions.

We don't have instructions for seteq/setne except for comparing
with zero and need to emit an ADDI or XOR before a seqz/snez to
compare other values.

The select ISD node takes a 0/1 value for the condition, but the
VT_MASKC(N) instructions check all XLen bits for zero or non-zero.
We can use this to avoid the seqz/snez in many cases.

This is pretty ridiculous number of patterns. I wonder if we could
use some ComplexPatterns to merge them, but I'd like to do that as
a follow up and focus on correctness of the result in this patch.

I also wonder if we really need the binop patterns. They are
non-canonical according to InstCombine. If we do need them, it is
probably better to implement the same InstCombine transform in
DAGCombine instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140421

Files:
  llvm/lib/Target/RISCV/RISCVInstrInfoXVentana.td
  llvm/test/CodeGen/RISCV/select.ll
  llvm/test/CodeGen/RISCV/xventanacondops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140421.484326.patch
Type: text/x-patch
Size: 14954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221220/e2ef1835/attachment.bin>


More information about the llvm-commits mailing list