Ignore:
Timestamp:
Apr 26, 2017, 10:12:11 AM (2 years ago)
Author:
cameron
Message:

Add bit manipulation instructions to CBuilder

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 edited

Legend:

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

    r5419 r5427  
    9898            // The loop body is entered if we have more matches to process.
    9999            iBuilder->SetInsertPoint(processMatchesEntry);
    100             Value * prior_breaks = iBuilder->CreateAnd(makeForwardZeroesMask(phiMatchWord), phiRecordBreaks);
     100            Value * prior_breaks = iBuilder->CreateAnd(iBuilder->CreateMaskToLowestBitExclusive(phiMatchWord), phiRecordBreaks);
    101101            // Within the loop we have a conditional block that is executed if there are any prior record breaks.
    102102            Value * prior_breaks_cond = iBuilder->CreateICmpNE(prior_breaks, ConstantInt::getNullValue(sizeTy));
     
    142142            }
    143143
    144             Value * remaining_matches = resetLowestBit(phiMatchWord);
     144            Value * remaining_matches = iBuilder->CreateResetLowestBit(phiMatchWord);
    145145            phiMatchWord->addIncoming(remaining_matches, loop_final_block);
    146146
     
    187187    setScalarField("LineNum", phiFinalRecordNum);
    188188    setProcessedItemCount("InputStream", phiFinalRecordStart);
    189 }
    190 
    191 inline Value * ScanMatchKernel::makeForwardZeroesMask(Value * const value) const {
    192     return iBuilder->CreateAnd(iBuilder->CreateSub(value, ConstantInt::get(value->getType(), 1)), iBuilder->CreateNot(value));
    193 }
    194 
    195 inline Value * ScanMatchKernel::resetLowestBit(Value * const value) const {
    196     return iBuilder->CreateAnd(iBuilder->CreateSub(value, ConstantInt::get(value->getType(), 1)), value);
    197189}
    198190
  • icGREP/icgrep-devel/icgrep/kernels/scanmatchgen.h

    r5411 r5427  
    2121    void generateDoBlockMethod() override;
    2222private:
    23     llvm::Value * makeForwardZeroesMask(llvm::Value * const value) const;
    24     llvm::Value * resetLowestBit(llvm::Value * const value) const;
    25 private:
    2623    const GrepType      mGrepType;
    2724};
Note: See TracChangeset for help on using the changeset viewer.