Ignore:
Timestamp:
Aug 26, 2015, 1:41:38 PM (4 years ago)
Author:
cameron
Message:

Clean ups for compilation with gcc 4.8

File:
1 edited

Legend:

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

    r4733 r4750  
    6666    mCarryInPack.resize(totalPackCount);
    6767    mCarryOutPack.resize(totalPackCount);
    68     for (auto i = 0; i < totalPackCount; i++) mCarryInPack[i]=nullptr;
     68    for (unsigned i = 0; i < totalPackCount; i++) mCarryInPack[i]=nullptr;
    6969
    7070    if (Strategy == SequentialFullyPackedStrategy) {
     
    338338    }
    339339    else {
    340         Value * carry_bit = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_out_strm, mBuilder->getIntNTy(BLOCK_SIZE)), 127);
     340        Value * carry_bit = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_out_strm, mBuilder->getIntNTy(BLOCK_SIZE)), BLOCK_SIZE-1);
    341341        mCarryOutPack[posn] = mBuilder->CreateBitCast(carry_bit, mBitBlockType);
    342342        if (mCarryInfo->getWhileDepth() == 0) {
     
    352352
    353353Value * CarryManager::addCarryInCarryOut(int localIndex, Value* e1, Value* e2) {
     354#if (BLOCK_SIZE == 128)
    354355    Value * carryq_value = getCarryOpCarryIn(localIndex);
    355     #if (BLOCK_SIZE == 128)
    356356    //calculate carry through logical ops
    357357    Value* carrygen = mBuilder->CreateAnd(e1, e2, "carrygen");
     
    363363    Value* sum = mBuilder->CreateAdd(partial, mBuilder->CreateBitCast(mid_carry_in, mBitBlockType), "sum");
    364364    Value* carry_out_strm = mBuilder->CreateOr(carrygen, mBuilder->CreateAnd(carryprop, mBuilder->CreateNot(sum)));
    365 
    366     #else
    367     //BLOCK_SIZE == 256, there is no other implementation
    368     static_assert(false, "Add with carry for 256-bit bitblock requires USE_UADD_OVERFLOW");
    369     #endif         
    370365    setCarryOpCarryOut(localIndex, carry_out_strm);
    371366    return sum;
    372 }
    373 
    374 
    375 Value * CarryManager::advanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm) {
     367#else
     368    //BLOCK_SIZE == 256, there is no other implementation
     369    Value * carryq_value = getCarryOpCarryIn(localIndex);
     370    Value* carrygen = mBuilder->CreateAnd(e1, e2, "carrygen");
     371    Value* carryprop = mBuilder->CreateOr(e1, e2, "carryprop");
     372    Value * sum = iBuilder->simd_add(BLOCK_SIZE, iBuilder->simd_add(BLOCK_SIZE, e1, e2), carryq_value);
     373    Value* carry_out_strm = mBuilder->CreateOr(carrygen, mBuilder->CreateAnd(carryprop, mBuilder->CreateNot(sum)));
     374    setCarryOpCarryOut(localIndex, carry_out_strm);
     375    return sum;
     376#endif         
     377}
     378
     379
     380Value * CarryManager::advanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * strm) {
    376381    if (shift_amount == 1) {
    377382        return unitAdvanceCarryInCarryOut(localIndex, strm);
     
    415420}
    416421
    417 Value * CarryManager::shortAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm) {
     422Value * CarryManager::shortAdvanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * strm) {
    418423    unsigned posn = shortAdvancePosition(localIndex);
    419424    if (mITEMS_PER_PACK > 1) {// #ifdef PACKING
     
    456461
    457462   
    458 Value * CarryManager::longAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * carry_out) {
     463Value * CarryManager::longAdvanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * carry_out) {
    459464    unsigned carryDataIndex = longAdvanceBitBlockPosition(localIndex);
    460465    Value * advBaseIndex = mBuilder->getInt64(carryDataIndex);
     
    578583    }
    579584    else {
    580         auto localCarryIndex = localBasePack();
    581         auto localCarryPacks = mCarryInfo->getLocalCarryPackCount();
     585        unsigned localCarryIndex = localBasePack();
     586        unsigned localCarryPacks = mCarryInfo->getLocalCarryPackCount();
    582587        if (localCarryPacks > 0) {
    583588            carry_summary = mCarryOutPack[localCarryIndex];
    584             for (auto i = 1; i < localCarryPacks; i++) {
     589            for (unsigned i = 1; i < localCarryPacks; i++) {
    585590                carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[localCarryIndex+i]);
    586591            }
Note: See TracChangeset for help on using the changeset viewer.