Changeset 5121


Ignore:
Timestamp:
Aug 9, 2016, 8:27:23 AM (3 years ago)
Author:
cameron
Message:

New IDISA bitblock functions: bitblock_set_bit, bitblock_mask_from

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

Legend:

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

    r5117 r5121  
    385385}
    386386
     387Value * IDISA_Builder::bitblock_mask_from(Value * pos) {
     388    Type * bitBlockInt = getIntNTy(getBitBlockWidth());
     389    return bitCast(CreateShl(ConstantInt::getAllOnesValue(bitBlockInt), CreateZExt(pos, bitBlockInt)));
     390   
     391}
     392Value * IDISA_Builder::bitblock_set_bit(Value * pos) {
     393    Type * bitBlockInt = getIntNTy(getBitBlockWidth());
     394    return bitCast(CreateShl(ConstantInt::get(bitBlockInt, 1), CreateZExt(pos, bitBlockInt)));
     395}
     396
     397
    387398Value * IDISA_Builder::simd_and(Value * a, Value * b) {
    388399    return a->getType() == b->getType() ? CreateAnd(a, b) : CreateAnd(bitCast(a), bitCast(b));
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h

    r5115 r5121  
    124124    // full shift producing {shiftout, shifted}
    125125    virtual std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift);
    126    
     126    virtual Value * bitblock_mask_from(Value * pos);
     127    virtual Value * bitblock_set_bit(Value * pos);
    127128   
    128129    Value * simd_and(Value * a, Value * b);
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r5104 r5121  
    356356        expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
    357357    } else if (const InFile * e = dyn_cast<InFile>(stmt)) {
    358         Value * EOFmark = mKernelBuilder->getScalarField(mSelf, "EOFmark");
    359         Value * infileMask = iBuilder->simd_add(iBuilder->getBitBlockWidth(), EOFmark, iBuilder->allOnes());
    360         expr = iBuilder->simd_and(compileExpression(e->getExpr()), infileMask);
     358        Value * EOFmask = mKernelBuilder->getScalarField(mSelf, "EOFmask");
     359        expr = iBuilder->simd_xor(compileExpression(e->getExpr()), EOFmask);
    361360    } else if (const AtEOF * e = dyn_cast<AtEOF>(stmt)) {
    362         Value * EOFmark = mKernelBuilder->getScalarField(mSelf, "EOFmark");
    363                 expr = iBuilder->simd_and(compileExpression(e->getExpr()), EOFmark);
     361        Value * EOFbit = mKernelBuilder->getScalarField(mSelf, "EOFbit");
     362                expr = iBuilder->simd_and(compileExpression(e->getExpr()), EOFbit);
    364363    } else if (const Count * c = dyn_cast<Count>(stmt)) {
    365364        Value * const to_count = compileExpression(c->getExpr());
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5106 r5121  
    2424                    {},
    2525                    {},
    26                     {ScalarBinding{builder->getBitBlockType(), "EOFmark"}}),
     26                    {ScalarBinding{builder->getBitBlockType(), "EOFbit"}, ScalarBinding{builder->getBitBlockType(), "EOFmask"}}),
    2727    mPabloFunction(function) {
    2828    unsigned output_streams = function->getNumOfResults();
     
    4242                    {},
    4343                    {},
    44                     {ScalarBinding{builder->getBitBlockType(), "EOFmark"}}),
     44                    {ScalarBinding{builder->getBitBlockType(), "EOFbit"}, ScalarBinding{builder->getBitBlockType(), "EOFmask"}}),
    4545    mPabloFunction(function) {
    4646    unsigned output_streams = function->getNumOfResults();
     
    8989    }
    9090    // Standard Pablo convention for final block processing: set a bit marking
    91     // the position just past EOF.
    92     Type * bitBlockInt = iBuilder->getIntNTy(iBuilder->getBitBlockWidth());
    93     Value * EOFmark = iBuilder->CreateShl(ConstantInt::get(bitBlockInt, 1), iBuilder->CreateZExt(remaining, bitBlockInt));
    94     setScalarField(self, "EOFmark", iBuilder->CreateBitCast(EOFmark, iBuilder->getBitBlockType()));
     91    // the position just past EOF, as well as a mask marking all positions past EOF.
     92    setScalarField(self, "EOFbit", iBuilder->bitblock_set_bit(remaining));
     93    setScalarField(self, "EOFmask", iBuilder->bitblock_mask_from(remaining));
    9594    iBuilder->CreateCall(doBlockFunction, doBlockArgs);
    9695    iBuilder->CreateRetVoid();
Note: See TracChangeset for help on using the changeset viewer.