[PATCH] D141607: [RISCV] Optimize (brcond (seteq (and X, (1 << C)-1), 0))

Liao Chunyu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 05:59:55 PST 2023


liaolucy created this revision.
liaolucy added reviewers: craig.topper, reames.
Herald added subscribers: sunshaoce, VincentWu, 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, arichardson.
Herald added a project: All.
liaolucy requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Inspired by gcc's assembly: https://godbolt.org/z/54hbzsGYn, while referring to D130203 <https://reviews.llvm.org/D130203>

Replace AND+IMM{32,64} with a slli.

But gcc does not handle 0xffff and 0xffffffff, which also seem to be optimizable.

The testcases copies all the bits in D130203 <https://reviews.llvm.org/D130203> and adds 16, 32, and 64 bits.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141607

Files:
  llvm/test/CodeGen/RISCV/bittest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141607.488627.patch
Type: text/x-patch
Size: 45348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230112/6372645d/attachment.bin>


More information about the llvm-commits mailing list