[PATCH] D140319: [RISCV] Match neg (and x, 1) to two shifts to improve codesize
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 19 10:26:11 PST 2022
reames created this revision.
reames added reviewers: craig.topper, asb, frasercrmck.
Herald added subscribers: sunshaoce, VincentWu, StephenFan, vkmr, 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, bollu, simoncook, johnrusso, rbar, hiraditya, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
The negate operation is never compressible (as the destination and rs1 register must differ). The two shift versions will be equal size if the input GPR is reused, or smaller if this is the only use of the input.
For clarity, the operation being performed is (select (low-bit-of x), -1, 0).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140319
Files:
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/test/CodeGen/RISCV/short-foward-branch-opt.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140319.483999.patch
Type: text/x-patch
Size: 4028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221219/f626f819/attachment.bin>
More information about the llvm-commits
mailing list