Ignore:
Timestamp:
Jun 6, 2017, 6:20:55 PM (2 years ago)
Author:
cameron
Message:

Restore check-ins from the last several days

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/lz4_index_decoder.cpp

    r5440 r5493  
    7171 */
    7272Value * LZ4IndexDecoderKernel::getWordOffset(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) {
    73     Value * wordWidthMask = iBuilder->getInt32(wordWidth - 1);
    74     return iBuilder->CreateAnd(
    75             iBuilder->CreateLoad(sOffset),
    76             wordWidthMask
    77             );
    78 }
    79 
     73    Value * offset = iBuilder->CreateLoad(sOffset);
     74    IntegerType * type = cast<IntegerType>(offset->getType());
     75    Constant * mask = ConstantInt::get(type, wordWidth - 1);
     76    return iBuilder->CreateAnd(offset, mask);
     77}
    8078
    8179/**
     
    8381 */
    8482Value * LZ4IndexDecoderKernel::getWordStartOffset(const std::unique_ptr<KernelBuilder> & iBuilder) {
    85     Value * wordWidthMask = iBuilder->getInt32(wordWidth - 1);
    86     return iBuilder->CreateAnd(
    87             iBuilder->CreateLoad(sOffset),
    88             iBuilder->CreateNot(wordWidthMask)
    89             );
    90 }
    91 
     83    Value * offset = iBuilder->CreateLoad(sOffset);
     84    IntegerType * type = cast<IntegerType>(offset->getType());
     85    Constant * mask = ConstantExpr::getNeg(ConstantInt::get(type, wordWidth));
     86    return iBuilder->CreateAnd(offset, mask);
     87}
    9288
    9389/**
     
    136132 */
    137133void LZ4IndexDecoderKernel::loadCurrentExtender(const std::unique_ptr<KernelBuilder> & iBuilder) {
    138     iBuilder->CreateStore(
    139             iBuilder->CreateExtractElement(extenders,
    140                 iBuilder->CreateLShr(
    141                     iBuilder->CreateLoad(sOffset),
    142                     iBuilder->getInt32(std::log2(wordWidth))
    143                     )
    144                 ),
    145             sExtender);
     134    Value * offset = iBuilder->CreateLoad(sOffset);
     135    IntegerType * type = cast<IntegerType>(offset->getType());
     136    ConstantInt * shift = ConstantInt::get(type, std::log2(wordWidth));
     137    Value * shiftedOffset = iBuilder->CreateLShr(offset, shift);
     138    Value * extender = iBuilder->CreateExtractElement(extenders, shiftedOffset);
     139    iBuilder->CreateStore(extender, sExtender);
    146140}
    147141
     
    195189    extenders = iBuilder->CreateBitCast(
    196190            iBuilder->loadInputStreamBlock("extenders", iBuilder->getInt32(0)),
    197             VectorType::get(iBuilder->getSizeTy(), iBuilder->getBitBlockWidth() / wordWidth),
     191            VectorType::get(iBuilder->getSizeTy(), iBuilder->getBitBlockWidth() / iBuilder->getSizeTy()->getBitWidth()),
    198192            "extenders");
    199193    // Create a series of stack variables which will be promoted by mem2reg.
Note: See TracChangeset for help on using the changeset viewer.