Ignore:
Timestamp:
Aug 5, 2016, 8:57:51 PM (3 years ago)
Author:
cameron
Message:

bitblock_advance

File:
1 edited

Legend:

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

    r5115 r5117  
    1414#include <llvm/IR/CallingConv.h>
    1515#include <llvm/IR/Function.h>
    16 
    17 #define DSSLI_FIELDWIDTH 64
     16#include <iostream>
     17
    1818
    1919namespace pablo {
     
    117117    Value * const carryIn = getCarryPack(index);
    118118    assert (index < mCarryOutPack.size());
    119     mCarryOutPack[index] = value;
     119    std::pair<Value *, Value *> adv = iBuilder->bitblock_advance(value, carryIn, shiftAmount);
     120    mCarryOutPack[index] = std::get<0>(adv);
    120121    if (mCarryInfo->getWhileDepth() == 0) {
    121122        storeCarryOut(index);
    122123    }
    123     if (LLVM_UNLIKELY((shiftAmount % 8) == 0)) { // Use a single whole-byte shift, if possible.
    124         result = iBuilder->mvmd_dslli(8, value, carryIn, (iBuilder->getBitBlockWidth() / 8) - (shiftAmount / 8));
    125     } else if (LLVM_LIKELY(shiftAmount < DSSLI_FIELDWIDTH)) {
    126         Value * ahead = iBuilder->mvmd_dslli(DSSLI_FIELDWIDTH, value, carryIn, iBuilder->getBitBlockWidth() / DSSLI_FIELDWIDTH - 1);
    127         result = iBuilder->simd_or(iBuilder->simd_srli(DSSLI_FIELDWIDTH, ahead, DSSLI_FIELDWIDTH - shiftAmount), iBuilder->simd_slli(DSSLI_FIELDWIDTH, value, shiftAmount));
    128     } else {
    129         Value* advanceq_longint = iBuilder->CreateBitCast(carryIn, iBuilder->getIntNTy(mBitBlockWidth));
    130         Value* strm_longint = iBuilder->CreateBitCast(value, iBuilder->getIntNTy(mBitBlockWidth));
    131         Value* adv_longint = iBuilder->CreateOr(iBuilder->CreateShl(strm_longint, shiftAmount), iBuilder->CreateLShr(advanceq_longint, mBitBlockWidth - shiftAmount), "advance");
    132         result = iBuilder->CreateBitCast(adv_longint, mBitBlockType);
    133     }
    134124    if (LLVM_LIKELY(hasSummary())) {
    135125        addToSummary(value);
    136126    }
    137     return result;
     127    return std::get<1>(adv);
    138128}
    139129
Note: See TracChangeset for help on using the changeset viewer.