[llvm-commits] [llvm] r123547 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Frits van Bommel fvbommel at gmail.com
Sat Jan 15 13:04:44 PST 2011


On Sat, Jan 15, 2011 at 9:51 PM, Frits van Bommel <fvbommel at gmail.com> wrote:
> On Sat, Jan 15, 2011 at 9:30 PM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Reimplement CTPOP legalization with the "best" algorithm from
>> http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
>
> You seem to be using the "generalization of the best bit counting
> method to integers of bit-widths upto 128" from that site. Did you
> check whether this works for >128 bits too?

Thinking about it, this *can't* be correct for >255 bits since the
result is a one-byte value.
The obvious way to fix it would be to generate this code for every
128-bit chunk of the input, and add the results. (or codegen a loop
for especially large values)
Maybe there's a better way though?



More information about the llvm-commits mailing list