Changeset 4290


Ignore:
Timestamp:
Nov 3, 2014, 6:40:11 PM (4 years ago)
Author:
linmengl
Message:

add static_assert for 256 block size

File:
1 edited

Legend:

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

    r4289 r4290  
    876876    InsertElementInst* carry_out = InsertElementInst::Create(const_packed_5, int64_o0, const_int32_6, "carry_out", mBasicBlock);
    877877#else
     878
     879#if (BLOCK_SIZE == 128)
    878880    //calculate carry through logical ops
    879881    Value* carrygen = b.CreateAnd(e1, e2, "carrygen");
     
    886888    Value* sum = b.CreateAdd(partial, mid_carry_in, "sum");
    887889    Value* carry_out = genShiftHighbitToLow(b.CreateOr(carrygen, b.CreateAnd(carryprop, genNot(sum))), "carry_out");
     890#else
     891    //BLOCK_SIZE == 256, there is no other implementation
     892    static_assert(false, "Add with carry for 256-bit bitblock requires USE_UADD_OVERFLOW");
     893#endif
     894
    888895#endif
    889896    genCarryOutStore(carry_out, carryIdx);
     
    955962
    956963    IRBuilder<> b(mBasicBlock);
    957 #if (BLOCK_SIZE == 128)
     964
    958965    const auto advanceIdx = mAdvanceQueueIdx++;
    959966#ifdef USE_LONG_INTEGER_SHIFT
     
    966973
    967974    return result_value;
    968 #else
     975#elif (BLOCK_SIZE == 128)
    969976    if (shift_amount == 1) {
    970977        Value* advanceq_value = genAdvanceInLoad(advanceIdx);
     
    10021009        throw std::runtime_error("Shift amount >= 64 in Advance is currently unsupported.");
    10031010    }
    1004 #endif //else USE_LONG_INTEGER_SHIFT
    1005 #endif //BLOCK_SIZE == 128
    1006 
    1007 #if (BLOCK_SIZE == 256)
    1008     return genAddWithCarry(strm_value, strm_value);
    1009 #endif
    1010 
     1011#else
     1012    //BLOCK_SIZE == 256
     1013    static_assert(false, "Advance with carry on 256-bit bitblock requires long integer shifts (USE_LONG_INTEGER_SHIFT).");
     1014#endif //USE_LONG_INTEGER_SHIFT
    10111015}
    10121016
Note: See TracChangeset for help on using the changeset viewer.