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

Duncan Sands baldrick at free.fr
Sat Jan 15 13:17:30 PST 2011


Hi Frits,

> 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?

in LegalizeDAG all types are legal, so it is enough to future proof things by
adding an assertion if there are more than 128 bits.

Ciao, Duncan.



More information about the llvm-commits mailing list