Changeset 6117


Ignore:
Timestamp:
Jun 26, 2018, 3:47:16 PM (3 weeks ago)
Author:
xwa163
Message:

Fix bugs of LZParabixAioKernel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/lzparabix/LZParabixAioKernel.cpp

    r6114 r6117  
    9090        b->setProcessedItemCount("byteStream", blockEnd);
    9191        b->setProducedItemCount("outputStream0", b->getScalarField("outputPos"));
    92 //        b->CallPrintInt("produced", b->getScalarField("outputPos"));
    9392        b->CreateBr(exitBlock);
    9493
     
    193192        Value* cursorI64BlockIndex = b->CreateUDiv(cursorBlockRem, b->getSize(64));
    194193        Value* cursorI64BlockRem = b->CreateURem(cursorBlockRem, b->getSize(64));
    195         Value* literalMask = b->CreateSub(b->CreateShl(b->getInt64(1), literalLength), b->getInt64(1));
     194        Value* literalMask = b->CreateSub(
     195                b->CreateSelect(b->CreateICmpEQ(literalLength, b->getInt64(0x40)), b->getInt64(0), b->CreateShl(b->getInt64(1), literalLength)),
     196                b->getInt64(1)
     197        );
    196198
    197199        std::vector<llvm::Value*> extractValues;
     200
     201        Value* oldOutputPos = b->getScalarField("outputPos");
    198202
    199203
     
    280284
    281285    void LZParabixAioKernel::storePendingOutput(const std::unique_ptr<KernelBuilder> &b) {
     286        BasicBlock* storePendingOutputBlock = b->CreateBasicBlock("storePendingOutputBlock");
     287        BasicBlock* storePendingOutputExitBlock = b->CreateBasicBlock("storePendingOutputExitBlock");
     288
     289        Value* oldOutputPos = b->getScalarField("outputPos");
     290        b->CreateCondBr(
     291                b->CreateICmpNE(b->CreateURem(oldOutputPos, b->getSize(64)), b->getSize(0)),
     292                storePendingOutputBlock,
     293                storePendingOutputExitBlock
     294        );
     295
     296        b->SetInsertPoint(storePendingOutputBlock);
    282297        this->storePendingOutput_BitStream(b);
    283298//        this->storePendingOutput_Swizzled(b);
     299        b->CreateBr(storePendingOutputExitBlock);
     300
     301        b->SetInsertPoint(storePendingOutputExitBlock);
    284302    }
    285303
Note: See TracChangeset for help on using the changeset viewer.