[PATCH] D132252: [RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ? x : 1.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 10:40:49 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: reames, liaolucy.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, frasercrmck, evandro, 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, asb, 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.

Similar to D132211 <https://reviews.llvm.org/D132211>, we can optimize x <s -1 ? x : -1 -> x <s 0 ? x : -1

Also improve the unsigned case from D132211 <https://reviews.llvm.org/D132211> to use x != 0 which
will give a bnez instruction which might be compressible.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132252

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/forced-atomics.ll
  llvm/test/CodeGen/RISCV/min-max.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132252.454059.patch
Type: text/x-patch
Size: 4391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220819/e48990b3/attachment.bin>


More information about the llvm-commits mailing list