Changeset 4837


Ignore:
Timestamp:
Oct 16, 2015, 10:49:26 AM (2 years ago)
Author:
cameron
Message:

Encapsulation of bitblock and carry pack construction

Location:
icGREP/icgrep-devel/icgrep
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.cpp

    r4827 r4837  
    1414
    1515Value * IDISA_Builder::bitBlockCast(Value * a) {
    16     return mLLVMBuilder->CreateBitCast(a, mBitBlockType);
     16    return a->getType() == mBitBlockType ? a : mLLVMBuilder->CreateBitCast(a, mBitBlockType);
    1717}
    1818
     
    2323
    2424Value * IDISA_Builder::fwCast(unsigned fw, Value * a) {
    25     return mLLVMBuilder->CreateBitCast(a, fwVectorType(fw));
     25    return a->getType() == fwVectorType(fw) ? a : mLLVMBuilder->CreateBitCast(a, fwVectorType(fw));
    2626}
    2727
    2828Value * IDISA_Builder::simd_add(unsigned fw, Value * a, Value * b) {
    29     return bitBlockCast(mLLVMBuilder->CreateAdd(fwCast(fw, a), fwCast(fw, b)));
     29    return mLLVMBuilder->CreateAdd(fwCast(fw, a), fwCast(fw, b));
    3030}
    3131
    3232Value * IDISA_Builder::simd_sub(unsigned fw, Value * a, Value * b) {
    33     return bitBlockCast(mLLVMBuilder->CreateSub(fwCast(fw, a), fwCast(fw, b)));
     33    return mLLVMBuilder->CreateSub(fwCast(fw, a), fwCast(fw, b));
    3434}
    3535
    3636Value * IDISA_Builder::simd_mult(unsigned fw, Value * a, Value * b) {
    37     return bitBlockCast(mLLVMBuilder->CreateMul(fwCast(fw, a), fwCast(fw, b)));
     37    return mLLVMBuilder->CreateMul(fwCast(fw, a), fwCast(fw, b));
    3838}
    3939
    4040Value * IDISA_Builder::simd_eq(unsigned fw, Value * a, Value * b) {
    41     return bitBlockCast(mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpEQ(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw)));
     41    return mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpEQ(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw));
    4242}
    4343
    4444Value * IDISA_Builder::simd_gt(unsigned fw, Value * a, Value * b) {
    45     return bitBlockCast(mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpSGT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw)));
     45    return mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpSGT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw));
    4646}
    4747
    4848Value * IDISA_Builder::simd_ugt(unsigned fw, Value * a, Value * b) {
    49     return bitBlockCast(mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpUGT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw)));
     49    return mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpUGT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw));
    5050}
    5151
    5252Value * IDISA_Builder::simd_lt(unsigned fw, Value * a, Value * b) {
    53     return bitBlockCast(mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpSLT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw)));
     53    return mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpSLT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw));
    5454}
    5555
    5656Value * IDISA_Builder::simd_ult(unsigned fw, Value * a, Value * b) {
    57     return bitBlockCast(mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpULT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw)));
     57    return mLLVMBuilder->CreateSExt(mLLVMBuilder->CreateICmpULT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw));
    5858}
    5959
     
    6161    Value * aVec = fwCast(fw, a);
    6262    Value * bVec = fwCast(fw, b);
    63     return bitBlockCast(mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpSGT(aVec, bVec), aVec, bVec));
     63    return mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpSGT(aVec, bVec), aVec, bVec);
    6464}
    6565
     
    6767    Value * aVec = fwCast(fw, a);
    6868    Value * bVec = fwCast(fw, b);
    69     return bitBlockCast(mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpUGT(aVec, bVec), aVec, bVec));
     69    return mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpUGT(aVec, bVec), aVec, bVec);
    7070}
    7171
     
    7373    Value * aVec = fwCast(fw, a);
    7474    Value * bVec = fwCast(fw, b);
    75     return bitBlockCast(mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpSLT(aVec, bVec), aVec, bVec));
     75    return mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpSLT(aVec, bVec), aVec, bVec);
    7676}
    7777
     
    7979    Value * aVec = fwCast(fw, a);
    8080    Value * bVec = fwCast(fw, b);
    81     return bitBlockCast(mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpULT(aVec, bVec), aVec, bVec));
     81    return mLLVMBuilder->CreateSelect(mLLVMBuilder->CreateICmpULT(aVec, bVec), aVec, bVec);
    8282}
    8383
    8484Value * IDISA_Builder::simd_slli(unsigned fw, Value * a, unsigned shift) {
    85     return bitBlockCast(mLLVMBuilder->CreateShl(fwCast(fw, a), shift));
     85    return mLLVMBuilder->CreateShl(fwCast(fw, a), shift);
    8686}
    8787
    8888Value * IDISA_Builder::simd_srli(unsigned fw, Value * a, unsigned shift) {
    89     return bitBlockCast(mLLVMBuilder->CreateLShr(fwCast(fw, a), shift));
     89    return mLLVMBuilder->CreateLShr(fwCast(fw, a), shift);
    9090}
    9191
    9292Value * IDISA_Builder::simd_srai(unsigned fw, Value * a, unsigned shift) {
    93     return bitBlockCast(mLLVMBuilder->CreateAShr(fwCast(fw, a), shift));
     93    return mLLVMBuilder->CreateAShr(fwCast(fw, a), shift);
    9494}
    9595
     
    9797    Value * cttzFunc = Intrinsic::getDeclaration(mMod, Intrinsic::cttz, fwVectorType(fw));
    9898    Value * rslt = mLLVMBuilder->CreateCall(cttzFunc, std::vector<Value *>({fwCast(fw, a), ConstantInt::get(mLLVMBuilder->getInt1Ty(), 0)}));
    99     return bitBlockCast(rslt);
     99    return rslt;
    100100}
    101101
     
    103103    Value * ctpopFunc = Intrinsic::getDeclaration(mMod, Intrinsic::ctpop, fwVectorType(fw));
    104104    Value * rslt = mLLVMBuilder->CreateCall(ctpopFunc, std::vector<Value *>({fwCast(fw, a)}));
    105     return bitBlockCast(rslt);
     105    return rslt;
    106106}
    107107
     
    115115        Idxs.push_back(mLLVMBuilder->getInt32(i + field_count)); // selects elements from second reg.
    116116    }
    117     return bitBlockCast(mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs)));
     117    return mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
    118118}
    119119
     
    127127        Idxs.push_back(mLLVMBuilder->getInt32(i + field_count)); // selects elements from second reg.
    128128    }
    129     return bitBlockCast(mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs)));
     129    return mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
    130130}
    131131
     
    138138        Idxs.push_back(mLLVMBuilder->getInt32(2*i));
    139139    }
    140     return bitBlockCast(mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs)));
     140    return mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
    141141}
    142142
     
    149149        Idxs.push_back(mLLVMBuilder->getInt32(2*i+1));
    150150    }
    151     return bitBlockCast(mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs)));
     151    return mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
    152152}
    153153
     
    170170        Idxs.push_back(mLLVMBuilder->getInt32(i));
    171171    }
    172     return bitBlockCast(mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs)));
     172    return mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
    173173}
    174174
     
    178178}
    179179
     180Value * IDISA_Builder::simd_and(Value * a, Value * b) {
     181    return a->getType() == b->getType() ? mLLVMBuilder->CreateAnd(a, b) : mLLVMBuilder->CreateAnd(bitBlockCast(a), bitBlockCast(b));
    180182}
     183
     184Value * IDISA_Builder::simd_or(Value * a, Value * b) {
     185    return a->getType() == b->getType() ? mLLVMBuilder->CreateOr(a, b) : mLLVMBuilder->CreateOr(bitBlockCast(a), bitBlockCast(b));
     186}
     187   
     188Value * IDISA_Builder::simd_xor(Value * a, Value * b) {
     189    return a->getType() == b->getType() ? mLLVMBuilder->CreateXor(a, b) : mLLVMBuilder->CreateXor(bitBlockCast(a), bitBlockCast(b));
     190}
     191
     192Value * IDISA_Builder::simd_not(Value * a) {
     193    return simd_xor(a, Constant::getAllOnesValue(a->getType()));
     194}
     195
     196}
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h

    r4827 r4837  
    3636   
    3737    Type * getBitBlockType() { return mBitBlockType;}
     38    Value * bitCast(Value * a) {return a->getType() == mBitBlockType ? a : mLLVMBuilder->CreateBitCast(a, mBitBlockType);}
    3839    int getBitBlockWidth() { return mBitBlockWidth;}
     40   
     41   
    3942    Constant * allZeroes() {return mZeroInitializer;}
    4043    Constant * allOnes() {return mOneInitializer;}
     
    7275   
    7376    Value * bitblock_any(Value * a);
    74 
    75 
     77    Value * simd_and(Value * a, Value * b);
     78    Value * simd_or(Value * a, Value * b);
     79    Value * simd_xor(Value * a, Value * b);
     80    Value * simd_not(Value * a);
     81   
    7682private:
    7783    Module * mMod;
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4828 r4837  
    287287    return mCarryInPack[packIndex];
    288288}
    289 
     289   
    290290void CarryManager::storeCarryPack(unsigned packIndex) {
    291     mBuilder->CreateAlignedStore(mCarryOutPack[packIndex], mCarryPackPtr[packIndex], mPACK_SIZE/8);
     291    mBuilder->CreateAlignedStore(mPackBuilder->bitCast(mCarryOutPack[packIndex]), mCarryPackPtr[packIndex], mPACK_SIZE/8);
    292292}
    293293
     
    302302    }
    303303    uint64_t mask = ((((uint64_t) 1) << bitCount) - 1) << lo_bit;
    304     return mBuilder->CreateAnd(pack, mBuilder->getInt64(mask));
     304    return mPackBuilder->simd_and(pack, mBuilder->getInt64(mask));
    305305}
    306306   
     
    331331    }
    332332    else {
    333         mCarryOutPack[packIndex] = mBuilder->CreateOr(mCarryOutPack[packIndex], field);
     333        mCarryOutPack[packIndex] = mPackBuilder->simd_or(mCarryOutPack[packIndex], field);
    334334    }
    335335}
    336336
    337337Value * 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)));
    339339}
    340340   
     
    371371        Value * carryq_value = getCarryOpCarryIn(localIndex);
    372372        //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);
    375375        Value* digitsum = iBuilder->simd_add(64, e1, e2);
    376376        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)));
    378378        Value* mid_carry_in = iBuilder->simd_slli(128, mBuilder->CreateLShr(digitcarry, 63), 64);
    379379        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)));
    381381        setCarryOpCarryOut(localIndex, carry_out_strm);
    382382        return sum;
     
    384384    else {
    385385        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);
    388388        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)));
    390390        setCarryOpCarryOut(localIndex, carry_out_strm);
    391391        return sum;
     
    425425    if (mBITBLOCK_WIDTH == 128) {
    426426        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));
    428428    }
    429429    else {
     
    553553            PHINode * phi_out = mBuilder->CreatePHI(mCarryPackType, 2);
    554554            phi_out->addIncoming(mPackBuilder->allZeroes(),ifEntryBlock);
    555             phi_out->addIncoming(mCarryOutPack[index],ifBodyFinalBlock);
     555            phi_out->addIncoming(mPackBuilder->bitCast(mCarryOutPack[index]), ifBodyFinalBlock);
    556556            mCarryOutPack[index] = phi_out;
    557557        }
     
    568568            PHINode * ifPack_phi = mBuilder->CreatePHI(mCarryPackType, 2, "ifPack");
    569569            ifPack_phi->addIncoming(mCarryInfo->ifEntryPack, ifEntryBlock);
    570             ifPack_phi->addIncoming(mCarryOutPack[ifPackIndex], ifBodyFinalBlock);
     570            ifPack_phi->addIncoming(mPackBuilder->bitCast(mCarryOutPack[ifPackIndex]), ifBodyFinalBlock);
    571571            mCarryOutPack[ifPackIndex] = ifPack_phi;
    572572            return;
     
    579579        PHINode * summary_phi = mBuilder->CreatePHI(mCarryPackType, 2, "summary");
    580580        summary_phi->addIncoming(mPackBuilder->allZeroes(), ifEntryBlock);
    581         summary_phi->addIncoming(mCarryOutPack[summaryIndex], ifBodyFinalBlock);
     581        summary_phi->addIncoming(mPackBuilder->bitCast(mCarryOutPack[summaryIndex]), ifBodyFinalBlock);
    582582        mCarryOutPack[summaryIndex] = summary_phi;
    583583    }
     
    593593    PHINode * summary_phi = mBuilder->CreatePHI(mCarryPackType, 2, "summary");
    594594    summary_phi->addIncoming(mPackBuilder->allZeroes(), ifEntryBlock);
    595     summary_phi->addIncoming(mCarryOutPack[carrySummaryIndex], ifBodyFinalBlock);
     595    summary_phi->addIncoming(mPackBuilder->bitCast(mCarryOutPack[carrySummaryIndex]), ifBodyFinalBlock);
    596596    mCarryOutPack[carrySummaryIndex] = summary_phi;
    597597}
     
    618618            carry_summary = mCarryOutPack[localCarryIndex];
    619619            for (unsigned i = 1; i < localCarryPacks; i++) {
    620                 carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[localCarryIndex+i]);
     620                carry_summary = mPackBuilder->simd_or(carry_summary, mCarryOutPack[localCarryIndex+i]);
    621621            }
    622622        }
     
    626626                enterScope(inner_blk);
    627627                if (blockHasCarries()) {
    628                   carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[summaryPackIndex()]);
     628                  carry_summary = mPackBuilder->simd_or(carry_summary, mCarryOutPack[summaryPackIndex()]);
    629629                }
    630630                leaveScope();
     
    634634                enterScope(inner_blk);
    635635                if (blockHasCarries()) {
    636                     carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[summaryPackIndex()]);
     636                    carry_summary = mPackBuilder->simd_or(carry_summary, mCarryOutPack[summaryPackIndex()]);
    637637                }
    638638                leaveScope();
     
    685685#endif
    686686        PHINode * phi = mCarryOutAccumPhis[index];
    687         Value * carryOut = mBuilder->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);
    689689        mCarryOutPack[currentScopeBase+index] = carryOut;
    690690    }
     
    729729    }
    730730    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)));
    732732}
    733733
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4827 r4837  
    5959, mBuilder(nullptr)
    6060, mCarryManager(nullptr)
    61 , mBitBlockType(VectorType::get(IntegerType::get(getGlobalContext(), 64), BLOCK_SIZE / 64))
     61    , mBitBlockType(VectorType::get(IntegerType::get(getGlobalContext(), 64), BLOCK_SIZE/64))
    6262, iBuilder(mBitBlockType)
    6363, mInputType(nullptr)
     
    236236        if (t1 == mBitBlockType) {
    237237            if (t2 == mBitBlockType) {
    238                 return iBuilder.bitblock_any(mBuilder->CreateOr(e1, e2));
     238                return iBuilder.bitblock_any(iBuilder.simd_or(e1, e2));
    239239            }
    240240            else {
     
    438438    }
    439439    else if (const And * pablo_and = dyn_cast<And>(stmt)) {
    440         expr = mBuilder->CreateAnd(compileExpression(pablo_and->getExpr1()), compileExpression(pablo_and->getExpr2()), "and");
     440        expr = iBuilder.simd_and(compileExpression(pablo_and->getExpr1()), compileExpression(pablo_and->getExpr2()));
    441441    }
    442442    else if (const Or * pablo_or = dyn_cast<Or>(stmt)) {
    443         expr = mBuilder->CreateOr(compileExpression(pablo_or->getExpr1()), compileExpression(pablo_or->getExpr2()), "or");
     443        expr = iBuilder.simd_or(compileExpression(pablo_or->getExpr1()), compileExpression(pablo_or->getExpr2()));
    444444    }
    445445    else if (const Xor * pablo_xor = dyn_cast<Xor>(stmt)) {
    446         expr = mBuilder->CreateXor(compileExpression(pablo_xor->getExpr1()), compileExpression(pablo_xor->getExpr2()), "xor");
     446        expr = iBuilder.simd_xor(compileExpression(pablo_xor->getExpr1()), compileExpression(pablo_xor->getExpr2()));
    447447    }
    448448    else if (const Sel * sel = dyn_cast<Sel>(stmt)) {
    449449        Value* ifMask = compileExpression(sel->getCondition());
    450         Value* ifTrue = mBuilder->CreateAnd(ifMask, compileExpression(sel->getTrueExpr()));
    451         Value* ifFalse = mBuilder->CreateAnd(mBuilder->CreateNot(ifMask), compileExpression(sel->getFalseExpr()));
    452         expr = mBuilder->CreateOr(ifTrue, ifFalse);
     450        Value* ifTrue = iBuilder.simd_and(ifMask, compileExpression(sel->getTrueExpr()));
     451        Value* ifFalse = iBuilder.simd_and(iBuilder.simd_not(ifMask), compileExpression(sel->getFalseExpr()));
     452        expr = iBuilder.simd_or(ifTrue, ifFalse);
    453453    }
    454454    else if (const Not * pablo_not = dyn_cast<Not>(stmt)) {
    455         expr = mBuilder->CreateNot(compileExpression(pablo_not->getExpr()));
     455        expr = iBuilder.simd_not(compileExpression(pablo_not->getExpr()));
    456456    }
    457457    else if (const Advance * adv = dyn_cast<Advance>(stmt)) {
     
    469469        Value * marker = compileExpression(mstar->getMarker());
    470470        Value * cc = compileExpression(mstar->getCharClass());
    471         Value * marker_and_cc = mBuilder->CreateAnd(marker, cc);
     471        Value * marker_and_cc = iBuilder.simd_and(marker, cc);
    472472        unsigned carry_index = mstar->getLocalCarryIndex();
    473473        Value * sum = mCarryManager->addCarryInCarryOut(carry_index, marker_and_cc, cc);
    474         expr = mBuilder->CreateOr(mBuilder->CreateXor(sum, cc), marker, "matchstar");
     474        expr = iBuilder.simd_or(iBuilder.simd_xor(sum, cc), marker);
    475475    }
    476476    else if (const Mod64MatchStar * mstar = dyn_cast<Mod64MatchStar>(stmt)) {
    477477        Value * marker = compileExpression(mstar->getMarker());
    478478        Value * cc = compileExpression(mstar->getCharClass());
    479         Value * marker_and_cc = mBuilder->CreateAnd(marker, cc);
     479        Value * marker_and_cc = iBuilder.simd_and(marker, cc);
    480480        Value * sum = iBuilder.simd_add(64, marker_and_cc, cc);
    481         expr = mBuilder->CreateOr(mBuilder->CreateXor(sum, cc), marker, "matchstar64");
     481        expr = iBuilder.simd_or(iBuilder.simd_xor(sum, cc), marker);
    482482    }
    483483    else if (const ScanThru * sthru = dyn_cast<ScanThru>(stmt)) {
     
    486486        unsigned carry_index = sthru->getLocalCarryIndex();
    487487        Value * sum = mCarryManager->addCarryInCarryOut(carry_index, marker_expr, cc_expr);
    488         expr = mBuilder->CreateAnd(sum, mBuilder->CreateNot(cc_expr), "scanthru");
     488        expr = iBuilder.simd_and(sum, iBuilder.simd_not(cc_expr));
    489489    }
    490490    else if (const Mod64ScanThru * sthru = dyn_cast<Mod64ScanThru>(stmt)) {
     
    492492        Value * cc_expr = compileExpression(sthru->getScanThru());
    493493        Value * sum = iBuilder.simd_add(64, marker_expr, cc_expr);
    494         expr = mBuilder->CreateAnd(sum, mBuilder->CreateNot(cc_expr), "scanthru64");
     494        expr = iBuilder.simd_and(sum, iBuilder.simd_not(cc_expr));
    495495    }
    496496    else if (const Count * c = dyn_cast<Count>(stmt)) {
     
    539539    Value* indices[] = {mBuilder->getInt64(0), mBuilder->getInt32(index)};
    540540    Value* gep = mBuilder->CreateGEP(mOutputAddressPtr, indices);
     541    if (marker->getType() != mBitBlockType) {
     542        marker = mBuilder->CreateBitCast(marker, mBitBlockType);
     543    }
    541544    mBuilder->CreateAlignedStore(marker, gep, iBuilder.getBitBlockWidth()/8, false);
    542545}
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h

    r4821 r4837  
    115115    CarryManager *                      mCarryManager;
    116116
    117     VectorType* const                   mBitBlockType;
     117    Type* const                   mBitBlockType;
    118118    IDISA::IDISA_Builder                iBuilder;
    119119    PointerType*                        mInputType;
Note: See TracChangeset for help on using the changeset viewer.