Ignore:
Timestamp:
Apr 11, 2018, 5:48:08 PM (12 months ago)
Author:
nmedfort
Message:

Updated LZ4SwizzledMatchCopy + minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/lz4/lz4_index_builder.cpp

    r5961 r5967  
    429429
    430430        Value* startShiftAmount = iBuilder->CreateSub(SIZE_8, startRemain);
     431        startShiftAmount = iBuilder->CreateZExtOrTrunc(startShiftAmount, startValue->getType());
    431432        startValue = iBuilder->CreateLShr(iBuilder->CreateShl(startValue, startShiftAmount), startShiftAmount);
    432433
     
    441442        Value* endPtr = iBuilder->CreateGEP(rawOutputPtr, iBuilder->CreateURem(endBytePos, outputBufferBytes));
    442443        Value* endValue = iBuilder->CreateLoad(endPtr);
     444        endRemain = iBuilder->CreateZExtOrTrunc(endRemain, endValue->getType());
    443445        endValue = iBuilder->CreateShl(iBuilder->CreateLShr(endValue, endRemain), endRemain);
    444446        iBuilder->CreateStore(endValue, endPtr);
     
    469471
    470472        Value* SIZE_0 = iBuilder->getSize(0);
     473        Value* SIZE_1 = iBuilder->getSize(1);
    471474        Value* SIZE_8 = iBuilder->getSize(8);
    472         Value* INT8_0 = iBuilder->getInt8(0);
    473         Value* INT8_1 = iBuilder->getInt8(1);
     475//        Value* INT8_0 = iBuilder->getInt8(0);
     476//        Value* INT8_1 = iBuilder->getInt8(1);
    474477        Type* INT8_PTR_TY = iBuilder->getInt8PtrTy();
    475478
     
    493496        Value* targetPtr = iBuilder->CreateGEP(rawOutputPtr, iBuilder->CreateURem(startBytePos, outputBufferBytes));
    494497        Value* targetValue = iBuilder->CreateLoad(targetPtr);
    495         targetValue = iBuilder->CreateOr(iBuilder->CreateSub(
    496                 iBuilder->CreateShl(INT8_1, endRemain),
    497                 iBuilder->CreateShl(INT8_1, startRemain)
    498         ), targetValue);
     498        Value* rangeMask = iBuilder->CreateSub(iBuilder->CreateShl(SIZE_1, endRemain), iBuilder->CreateShl(SIZE_1, startRemain));
     499        rangeMask = iBuilder->CreateZExtOrTrunc(rangeMask, targetValue->getType());
     500        targetValue = iBuilder->CreateOr(rangeMask, targetValue);
     501
    499502//        targetValue = iBuilder->CreateNot(iBuilder->CreateLShr(iBuilder->CreateShl(iBuilder->CreateNot(targetValue), startShiftAmount), startShiftAmount));
    500503//        targetValue = iBuilder->CreateShl(iBuilder->CreateLShr(targetValue, endRemain), endRemain);
     
    514517        Value* startPtr = iBuilder->CreateGEP(rawOutputPtr, iBuilder->CreateURem(startBytePos, outputBufferBytes));
    515518        Value* startValue = iBuilder->CreateLoad(startPtr);
    516         startValue = iBuilder->CreateNot(iBuilder->CreateLShr(iBuilder->CreateShl(iBuilder->CreateNot(startValue), startShiftAmount), startShiftAmount));
     519
     520        Value* startShiftAmount2 = iBuilder->CreateZExtOrTrunc(startShiftAmount, startValue->getType());
     521        startValue = iBuilder->CreateNot(iBuilder->CreateLShr(iBuilder->CreateShl(iBuilder->CreateNot(startValue), startShiftAmount2), startShiftAmount2));
    517522
    518523        iBuilder->CreateStore(startValue, startPtr);
     
    526531        Value* endPtr = iBuilder->CreateGEP(rawOutputPtr, iBuilder->CreateURem(endBytePos, outputBufferBytes));
    527532        Value* endValue = iBuilder->CreateLoad(endPtr);
    528         endValue = iBuilder->CreateNot(iBuilder->CreateShl(iBuilder->CreateLShr(iBuilder->CreateNot(endValue), endRemain), endRemain));
     533        Value* endRemain2 = iBuilder->CreateZExtOrTrunc(endRemain, endValue->getType());
     534        endValue = iBuilder->CreateNot(iBuilder->CreateShl(iBuilder->CreateLShr(iBuilder->CreateNot(endValue), endRemain2), endRemain2));
    529535        iBuilder->CreateStore(endValue, endPtr);
    530536        iBuilder->CreateBr(memsetBlock);
Note: See TracChangeset for help on using the changeset viewer.