Changeset 4837 for icGREP/icgrepdevel/icgrep/pablo/carry_manager.cpp
 Timestamp:
 Oct 16, 2015, 10:49:26 AM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

icGREP/icgrepdevel/icgrep/pablo/carry_manager.cpp
r4828 r4837 287 287 return mCarryInPack[packIndex]; 288 288 } 289 289 290 290 void CarryManager::storeCarryPack(unsigned packIndex) { 291 mBuilder>CreateAlignedStore(m CarryOutPack[packIndex], mCarryPackPtr[packIndex], mPACK_SIZE/8);291 mBuilder>CreateAlignedStore(mPackBuilder>bitCast(mCarryOutPack[packIndex]), mCarryPackPtr[packIndex], mPACK_SIZE/8); 292 292 } 293 293 … … 302 302 } 303 303 uint64_t mask = ((((uint64_t) 1) << bitCount)  1) << lo_bit; 304 return m Builder>CreateAnd(pack, mBuilder>getInt64(mask));304 return mPackBuilder>simd_and(pack, mBuilder>getInt64(mask)); 305 305 } 306 306 … … 331 331 } 332 332 else { 333 mCarryOutPack[packIndex] = m Builder>CreateOr(mCarryOutPack[packIndex], field);333 mCarryOutPack[packIndex] = mPackBuilder>simd_or(mCarryOutPack[packIndex], field); 334 334 } 335 335 } 336 336 337 337 Value * CarryManager::pack2bitblock(Value * pack) { 338 return mBuilder>CreateBitCast(mBuilder>CreateZExt(pack, mBuilder>getIntNTy(mBITBLOCK_WIDTH)), mBitBlockType);338 return iBuilder>bitCast(mBuilder>CreateZExt(pack, mBuilder>getIntNTy(mBITBLOCK_WIDTH))); 339 339 } 340 340 … … 371 371 Value * carryq_value = getCarryOpCarryIn(localIndex); 372 372 //calculate carry through logical ops 373 Value* carrygen = mBuilder>CreateAnd(e1, e2, "carrygen");374 Value* carryprop = mBuilder>CreateOr(e1, e2, "carryprop");373 Value* carrygen = iBuilder>simd_and(e1, e2); 374 Value* carryprop = iBuilder>simd_or(e1, e2); 375 375 Value* digitsum = iBuilder>simd_add(64, e1, e2); 376 376 Value* partial = iBuilder>simd_add(64, digitsum, carryq_value); 377 Value* digitcarry = mBuilder>CreateOr(carrygen, mBuilder>CreateAnd(carryprop, mBuilder>CreateNot(partial)));377 Value* digitcarry = iBuilder>simd_or(carrygen, iBuilder>simd_and(carryprop, mBuilder>CreateNot(partial))); 378 378 Value* mid_carry_in = iBuilder>simd_slli(128, mBuilder>CreateLShr(digitcarry, 63), 64); 379 379 Value* sum = iBuilder>simd_add(64, partial, mBuilder>CreateBitCast(mid_carry_in, mBitBlockType)); 380 Value* carry_out_strm = mBuilder>CreateOr(carrygen, mBuilder>CreateAnd(carryprop, mBuilder>CreateNot(sum)));380 Value* carry_out_strm = iBuilder>simd_or(carrygen, iBuilder>simd_and(carryprop, mBuilder>CreateNot(sum))); 381 381 setCarryOpCarryOut(localIndex, carry_out_strm); 382 382 return sum; … … 384 384 else { 385 385 Value * carryq_value = getCarryOpCarryIn(localIndex); 386 Value* carrygen = mBuilder>CreateAnd(e1, e2, "carrygen");387 Value* carryprop = mBuilder>CreateOr(e1, e2, "carryprop");386 Value* carrygen = iBuilder>simd_and(e1, e2); 387 Value* carryprop = iBuilder>simd_or(e1, e2); 388 388 Value * sum = iBuilder>simd_add(mBITBLOCK_WIDTH, iBuilder>simd_add(mBITBLOCK_WIDTH, e1, e2), carryq_value); 389 Value* carry_out_strm = mBuilder>CreateOr(carrygen, mBuilder>CreateAnd(carryprop, mBuilder>CreateNot(sum)));389 Value* carry_out_strm = iBuilder>simd_or(carrygen, iBuilder>simd_and(carryprop, mBuilder>CreateNot(sum))); 390 390 setCarryOpCarryOut(localIndex, carry_out_strm); 391 391 return sum; … … 425 425 if (mBITBLOCK_WIDTH == 128) { 426 426 Value * ahead64 = iBuilder>mvmd_dslli(64, carry_in, strm, 1); 427 result_value = mBuilder>CreateOr(iBuilder>simd_srli(64, ahead64, 63), iBuilder>simd_slli(64, strm, 1));427 result_value = iBuilder>simd_or(iBuilder>simd_srli(64, ahead64, 63), iBuilder>simd_slli(64, strm, 1)); 428 428 } 429 429 else { … … 553 553 PHINode * phi_out = mBuilder>CreatePHI(mCarryPackType, 2); 554 554 phi_out>addIncoming(mPackBuilder>allZeroes(),ifEntryBlock); 555 phi_out>addIncoming(m CarryOutPack[index],ifBodyFinalBlock);555 phi_out>addIncoming(mPackBuilder>bitCast(mCarryOutPack[index]), ifBodyFinalBlock); 556 556 mCarryOutPack[index] = phi_out; 557 557 } … … 568 568 PHINode * ifPack_phi = mBuilder>CreatePHI(mCarryPackType, 2, "ifPack"); 569 569 ifPack_phi>addIncoming(mCarryInfo>ifEntryPack, ifEntryBlock); 570 ifPack_phi>addIncoming(m CarryOutPack[ifPackIndex], ifBodyFinalBlock);570 ifPack_phi>addIncoming(mPackBuilder>bitCast(mCarryOutPack[ifPackIndex]), ifBodyFinalBlock); 571 571 mCarryOutPack[ifPackIndex] = ifPack_phi; 572 572 return; … … 579 579 PHINode * summary_phi = mBuilder>CreatePHI(mCarryPackType, 2, "summary"); 580 580 summary_phi>addIncoming(mPackBuilder>allZeroes(), ifEntryBlock); 581 summary_phi>addIncoming(m CarryOutPack[summaryIndex], ifBodyFinalBlock);581 summary_phi>addIncoming(mPackBuilder>bitCast(mCarryOutPack[summaryIndex]), ifBodyFinalBlock); 582 582 mCarryOutPack[summaryIndex] = summary_phi; 583 583 } … … 593 593 PHINode * summary_phi = mBuilder>CreatePHI(mCarryPackType, 2, "summary"); 594 594 summary_phi>addIncoming(mPackBuilder>allZeroes(), ifEntryBlock); 595 summary_phi>addIncoming(m CarryOutPack[carrySummaryIndex], ifBodyFinalBlock);595 summary_phi>addIncoming(mPackBuilder>bitCast(mCarryOutPack[carrySummaryIndex]), ifBodyFinalBlock); 596 596 mCarryOutPack[carrySummaryIndex] = summary_phi; 597 597 } … … 618 618 carry_summary = mCarryOutPack[localCarryIndex]; 619 619 for (unsigned i = 1; i < localCarryPacks; i++) { 620 carry_summary = m Builder>CreateOr(carry_summary, mCarryOutPack[localCarryIndex+i]);620 carry_summary = mPackBuilder>simd_or(carry_summary, mCarryOutPack[localCarryIndex+i]); 621 621 } 622 622 } … … 626 626 enterScope(inner_blk); 627 627 if (blockHasCarries()) { 628 carry_summary = m Builder>CreateOr(carry_summary, mCarryOutPack[summaryPackIndex()]);628 carry_summary = mPackBuilder>simd_or(carry_summary, mCarryOutPack[summaryPackIndex()]); 629 629 } 630 630 leaveScope(); … … 634 634 enterScope(inner_blk); 635 635 if (blockHasCarries()) { 636 carry_summary = m Builder>CreateOr(carry_summary, mCarryOutPack[summaryPackIndex()]);636 carry_summary = mPackBuilder>simd_or(carry_summary, mCarryOutPack[summaryPackIndex()]); 637 637 } 638 638 leaveScope(); … … 685 685 #endif 686 686 PHINode * phi = mCarryOutAccumPhis[index]; 687 Value * carryOut = m Builder>CreateOr(phi, mCarryOutPack[currentScopeBase+index]);688 phi>addIncoming( carryOut, whileBodyFinalBlock);687 Value * carryOut = mPackBuilder>simd_or(phi, mCarryOutPack[currentScopeBase+index]); 688 phi>addIncoming(mPackBuilder>bitCast(carryOut), whileBodyFinalBlock); 689 689 mCarryOutPack[currentScopeBase+index] = carryOut; 690 690 } … … 729 729 } 730 730 mBuilder>CreateAlignedStore(countSoFar, countPtr, 8); 731 return mBuilder>CreateBitCast(mBuilder>CreateZExt(countSoFar, mBuilder>getIntNTy(mBITBLOCK_WIDTH)), mBitBlockType);731 return iBuilder>bitCast(mBuilder>CreateZExt(countSoFar, mBuilder>getIntNTy(mBITBLOCK_WIDTH))); 732 732 } 733 733
Note: See TracChangeset
for help on using the changeset viewer.