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

Benjamin Kramer benny.kra at googlemail.com
Sat Jan 15 13:20:40 PST 2011


On 15.01.2011, at 22:04, Frits van Bommel wrote:

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

CodeGen will split up large popcounts. I'll add an assert though so we don't have silent miscompiles
when a target with native 256 bit ints gets implemented in LLVM.



More information about the llvm-commits mailing list