Changeset 4117 for icGREP/icgrepdevel/icgrep/llvm_gen.cpp
 Timestamp:
 Aug 31, 2014, 3:55:56 PM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

icGREP/icgrepdevel/icgrep/llvm_gen.cpp
r4096 r4117 1148 1148 } 1149 1149 1150 #ifdef USE_UADD_OVERFLOW 1150 1151 SumWithOverflowPack LLVM_Generator::genUaddOverflow(Value* int128_e1, Value* int128_e2) { 1151 1152 std::vector<Value*> struct_res_params; … … 1170 1171 return ret; 1171 1172 } 1172 1173 #endif 1173 1174 1174 1175 Value* LLVM_Generator::genAddWithCarry(Value* e1, Value* e2) { … … 1181 1182 Value* carryq_value = genCarryInLoad(mptr_carry_q, this_carry_idx); 1182 1183 1184 #ifdef USE_UADD_OVERFLOW 1183 1185 //new code chunk, use llvm.uadd.with.overflow.i128 1184 1186 CastInst* int128_e1 = new BitCastInst(e1, IntegerType::get(mMod>getContext(), 128), "e1_128", mBasicBlock); … … 1204 1206 return ret_sum; 1205 1207 //new code chunk ends 1206 1208 #endif 1209 #ifndef USE_UADD_OVERFLOW 1207 1210 //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; 1220 1223 //Old code chunk ends 1224 #endif 1221 1225 } 1222 1226
Note: See TracChangeset
for help on using the changeset viewer.