Changeset 5124 for icGREP/icgrep-devel


Ignore:
Timestamp:
Aug 11, 2016, 7:27:12 AM (3 years ago)
Author:
cameron
Message:

popcnt using 32-bit fields on 32-bit machines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r5121 r5124  
    365365        std::string counter = c->getName()->to_string();
    366366        Value * countSoFar = mKernelBuilder->getScalarField(mSelf, counter);
    367         Value * fieldCounts = iBuilder->simd_popcount(64, to_count);
    368         for (unsigned i = 0; i < iBuilder->getBitBlockWidth()/64; ++i) {
    369             countSoFar = iBuilder->CreateAdd(countSoFar, iBuilder->mvmd_extract(64, fieldCounts, i));
     367        unsigned counterSize = countSoFar->getType()->getIntegerBitWidth();
     368        Value * fieldCounts = iBuilder->simd_popcount(counterSize, to_count);
     369        for (unsigned i = 0; i < iBuilder->getBitBlockWidth()/counterSize; ++i) {
     370            countSoFar = iBuilder->CreateAdd(countSoFar, iBuilder->mvmd_extract(counterSize, fieldCounts, i));
    370371        }
    371372        mKernelBuilder->setScalarField(mSelf, counter, countSoFar);
Note: See TracChangeset for help on using the changeset viewer.