Ignore:
Timestamp:
Aug 31, 2014, 3:55:56 PM (5 years ago)
Author:
cameron
Message:

#ifdefs for experimental options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/llvm_gen.cpp

    r4096 r4117  
    11481148}
    11491149
     1150#ifdef USE_UADD_OVERFLOW
    11501151SumWithOverflowPack LLVM_Generator::genUaddOverflow(Value* int128_e1, Value* int128_e2) {
    11511152    std::vector<Value*> struct_res_params;
     
    11701171    return ret;
    11711172}
    1172 
     1173#endif
    11731174
    11741175Value* LLVM_Generator::genAddWithCarry(Value* e1, Value* e2) {
     
    11811182    Value* carryq_value = genCarryInLoad(mptr_carry_q, this_carry_idx);
    11821183
     1184#ifdef USE_UADD_OVERFLOW
    11831185    //new code chunk, use llvm.uadd.with.overflow.i128
    11841186    CastInst* int128_e1 = new BitCastInst(e1, IntegerType::get(mMod->getContext(), 128), "e1_128", mBasicBlock);
     
    12041206    return ret_sum;
    12051207    //new code chunk ends
    1206 
     1208#endif
     1209#ifndef USE_UADD_OVERFLOW
    12071210    //Old code chunk, calculate carry through logical ops
    1208     //Value* carrygen = b.CreateAnd(e1, e2, "carrygen");
    1209     //Value* carryprop = b.CreateOr(e1, e2, "carryprop");
    1210     //Value* digitsum = b.CreateAdd(e1, e2, "digitsum");
    1211     //Value* partial = b.CreateAdd(digitsum, carryq_value, "partial");
    1212     //Value* digitcarry = b.CreateOr(carrygen, b.CreateAnd(carryprop, genNot(partial)));
    1213     //Value* mid_carry_in = genShiftLeft64(b.CreateLShr(digitcarry, 63), "mid_carry_in");
    1214 
    1215     //Value* sum = b.CreateAdd(partial, mid_carry_in, "sum");
    1216     //Value* carry_out = genShiftRight127(b.CreateOr(carrygen, b.CreateAnd(carryprop, genNot(sum))), "carry_out");
    1217     //Value* void_1 = genCarryOutStore(carry_out, mptr_carry_q, this_carry_idx);
    1218 
    1219     //return sum;
     1211    Value* carrygen = b.CreateAnd(e1, e2, "carrygen");
     1212    Value* carryprop = b.CreateOr(e1, e2, "carryprop");
     1213    Value* digitsum = b.CreateAdd(e1, e2, "digitsum");
     1214    Value* partial = b.CreateAdd(digitsum, carryq_value, "partial");
     1215    Value* digitcarry = b.CreateOr(carrygen, b.CreateAnd(carryprop, genNot(partial)));
     1216    Value* mid_carry_in = genShiftLeft64(b.CreateLShr(digitcarry, 63), "mid_carry_in");
     1217
     1218    Value* sum = b.CreateAdd(partial, mid_carry_in, "sum");
     1219    Value* carry_out = genShiftRight127(b.CreateOr(carrygen, b.CreateAnd(carryprop, genNot(sum))), "carry_out");
     1220    Value* void_1 = genCarryOutStore(carry_out, mptr_carry_q, this_carry_idx);
     1221
     1222    return sum;
    12201223    //Old code chunk ends
     1224#endif
    12211225}
    12221226
Note: See TracChangeset for help on using the changeset viewer.