Ignore:
Timestamp:
Oct 16, 2015, 11:53:10 AM (4 years ago)
Author:
cameron
Message:

Clean-up and encapsulate if/summary test in carry_manager

File:
1 edited

Legend:

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

    r4837 r4838  
    231231}
    232232
    233     Value * PabloCompiler::genBitTest2(Value * e1, Value * e2) {
    234         Type * t1 = e1->getType();
    235         Type * t2 = e2->getType();
    236         if (t1 == mBitBlockType) {
    237             if (t2 == mBitBlockType) {
    238                 return iBuilder.bitblock_any(iBuilder.simd_or(e1, e2));
    239             }
    240             else {
    241                 Value * m1 = mBuilder->CreateZExt(iBuilder.hsimd_signmask(16, e1), t2);
    242                 return mBuilder->CreateICmpNE(mBuilder->CreateOr(m1, e2), ConstantInt::get(t2, 0));
    243             }
    244         }
    245         else if (t2 == mBitBlockType) {
    246             Value * m2 = mBuilder->CreateZExt(iBuilder.hsimd_signmask(16, e2), t1);
    247             return mBuilder->CreateICmpNE(mBuilder->CreateOr(e1, m2), ConstantInt::get(t1, 0));
    248         }
    249         else {
    250             return mBuilder->CreateICmpNE(mBuilder->CreateOr(e1, e2), ConstantInt::get(t1, 0));
    251         }
    252     }
    253    
    254233void PabloCompiler::compileIf(const If * ifStatement) {       
    255234    //
     
    280259   
    281260    mCarryManager->enterScope(&ifBody);
    282     if (mCarryManager->blockHasCarries()) {
    283         // load the summary variable
    284         Value* last_if_pending_data = mCarryManager->getCarrySummaryExpr();
    285         mBuilder->CreateCondBr(genBitTest2(if_test_value, last_if_pending_data), ifBodyBlock, ifEndBlock);
    286 
    287     }
    288     else {
    289         mBuilder->CreateCondBr(iBuilder.bitblock_any(if_test_value), ifBodyBlock, ifEndBlock);
    290     }
     261    mBuilder->CreateCondBr(mCarryManager->generateBitBlockOrSummaryTest(if_test_value), ifBodyBlock, ifEndBlock);
     262   
    291263    // Entry processing is complete, now handle the body of the if.
    292264    mBuilder->SetInsertPoint(ifBodyBlock);
Note: See TracChangeset for help on using the changeset viewer.