Changeset 4709


Ignore:
Timestamp:
Jul 30, 2015, 3:16:09 PM (4 years ago)
Author:
cameron
Message:

Fix masking for short advance to use uint64_t

File:
1 edited

Legend:

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

    r4708 r4709  
    265265        return pack;
    266266    }
    267     unsigned mask = (1 << bitCount) - 1;
    268     return mBuilder->CreateAnd(pack, mBuilder->getInt64(mask << lo_bit));
     267    uint64_t mask = ((((uint64_t) 1) << bitCount) - 1) << lo_bit;
     268    return mBuilder->CreateAnd(pack, mBuilder->getInt64(mask));
    269269}
    270270   
     
    281281    unsigned packOffset = carryBit_pos % PACK_SIZE;
    282282    unsigned rshift = PACK_SIZE - packOffset - carryBitCount;
     283    uint64_t mask = ((((uint64_t) 1) << carryBitCount) - 1)  << packOffset;
     284    //std::cerr << "extractAndSaveCarryOutBits: packIndex =" << packIndex << ", packOffset = " << packOffset << ", mask = " << mask << std::endl;
    283285    Value * field = iBuilder->mvmd_extract(PACK_SIZE, bitblock, BLOCK_SIZE/PACK_SIZE - 1);
    284286    //Value * field = maskSelectBitRange(field, PACK_SIZE - carryBitCount, carryBitCount);
     
    287289    }
    288290    if (packOffset != 0) {
    289         field = mBuilder->CreateAnd(field, mBuilder->getInt64(((1<<carryBitCount) - 1) << packOffset));
     291        field = mBuilder->CreateAnd(field, mBuilder->getInt64(mask));
    290292    }
    291293    if (mCarryOutPack[packIndex] == nullptr) {
     
    401403#ifdef PACKING
    402404    extractAndSaveCarryOutBits(strm, posn, shift_amount);
     405    //std::cerr << "shortAdvanceCarryInCarryOut: posn = " << posn << ", shift_amount = " << shift_amount << std::endl;
    403406    Value* carry_longint = mBuilder->CreateZExt(getCarryInBits(posn, shift_amount), mBuilder->getIntNTy(BLOCK_SIZE));
    404407    Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(BLOCK_SIZE));
Note: See TracChangeset for help on using the changeset viewer.