Ignore:
Timestamp:
Oct 23, 2014, 7:00:28 PM (5 years ago)
Author:
cameron
Message:

log 2 lower bound technique; VARIABLE_ADVANCE ifdef

File:
1 edited

Legend:

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

    r4260 r4261  
    830830
    831831Value* PabloCompiler::genAdvanceWithCarry(Value* strm_value, int shift_amount) {
     832#ifndef VARIABLE_ADVANCE
    832833        if (shift_amount != 1) {
    833834                throw std::runtime_error("Shift amount != 1 in Advance is currently unsupported.");
    834835        }
    835        
     836#endif
     837
    836838    IRBuilder<> b(mBasicBlock);
    837839#if (BLOCK_SIZE == 128)
    838840    const auto carryIdx = mCarryQueueIdx++;
     841#ifndef VARIABLE_ADVANCE
    839842    Value* carryq_value = genCarryInLoad(carryIdx);
    840843    Value* srli_1_value = b.CreateLShr(strm_value, 63);
     
    851854
    852855    Value* carry_out = genShiftHighbitToLow(strm_value, "carry_out");
     856#endif
     857#ifdef VARIABLE_ADVANCE
     858    Value* carryq_longint = b.CreateBitCast(genCarryInLoad(carryIdx), IntegerType::get(mMod->getContext(), BLOCK_SIZE));
     859    Value* strm_longint = b.CreateBitCast(strm_value, IntegerType::get(mMod->getContext(), BLOCK_SIZE));
     860    Value* adv_longint = b.CreateOr(b.CreateShl(strm_longint, shift_amount), carryq_longint, "advance");
     861    Value* result_value = b.CreateBitCast(adv_longint, mXi64Vect);
     862    Value* carry_out = b.CreateBitCast(b.CreateLShr(strm_longint, BLOCK_SIZE - shift_amount, "advance_out"), mXi64Vect);
     863#endif
    853864    //CarryQ - carry out:
    854865    genCarryOutStore(carry_out, carryIdx);
    855 
     866       
    856867    return result_value;
    857868#endif
Note: See TracChangeset for help on using the changeset viewer.