[PATCH] D125638: [TargetLowering] Expand the last stage of i16 popcnt using shift+add+and instead of mul+shift.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 15 11:17:04 PDT 2022
craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.
Herald added subscribers: StephenFan, frasercrmck, luismarques, apazos, sameer.abuasal, steven.zhang, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, nemanjai.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: LLVM.
If we use multiply it would be with 0x0101 which is 1 more than a power
of 2. On some targets we would expand this to shl+add. By avoiding the
multiply earlier, we can generate better code.
Note, PowerPC doesn't do the shl+add expansion of multiply so one of
the tests increased in instruction count.
Limiting to scalars because it almost always increased the number of
instructions in vector tests.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125638
Files:
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/PowerPC/popcnt-zext.ll
llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
llvm/test/CodeGen/X86/parity-vec.ll
llvm/test/CodeGen/X86/popcnt.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125638.429549.patch
Type: text/x-patch
Size: 11319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220515/d7f28c56/attachment.bin>
More information about the llvm-commits
mailing list