Changeset 5006


Ignore:
Timestamp:
Apr 7, 2016, 3:46:25 PM (18 months ago)
Author:
cameron
Message:

Inverse transposition for 16 bit streams to 16-bit code units

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 edited

Legend:

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

    r4993 r5006  
    5353}
    5454
     55void generateP2S_16Kernel(Module * m, IDISA::IDISA_Builder * iBuilder, KernelBuilder * kBuilder) {
     56    for (unsigned i = 0; i < 16; ++i) {
     57        kBuilder->addInputStream(1);
     58    }
     59    kBuilder->addOutputStream(16);
     60    kBuilder->prepareFunction();
     61    Value * hi_input[8];
     62    for (unsigned j = 0; j < 8; ++j) {
     63        hi_input[j] = iBuilder->CreateBlockAlignedLoad(kBuilder->getInputStream(j));
     64    }
     65    Value * hi_bytes[8];
     66    p2s(iBuilder, hi_input, hi_bytes);
     67   
     68    Value * lo_input[8];
     69    for (unsigned j = 0; j < 8; ++j) {
     70        lo_input[j] = iBuilder->CreateBlockAlignedLoad(kBuilder->getInputStream(j+8));
     71    }
     72    Value * lo_bytes[8];
     73    p2s(iBuilder, lo_input, lo_bytes);
     74   
     75    Value * output_ptr = kBuilder->getOutputStream(0);
     76    for (unsigned j = 0; j < 8; ++j) {
     77        Value * merge0 = iBuilder->esimd_mergel(8, hi_bytes[j], lo_bytes[j]);
     78        Value * merge1 = iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]);
     79        iBuilder->CreateBlockAlignedStore(merge0, iBuilder->CreateGEP(output_ptr, std::vector<Value *>({ iBuilder->getInt32(0), iBuilder->getInt32(2*j) })));
     80        iBuilder->CreateBlockAlignedStore(merge1, iBuilder->CreateGEP(output_ptr, std::vector<Value *>({ iBuilder->getInt32(0), iBuilder->getInt32(2*j+1) })));
     81    }
     82    kBuilder->finalize();
    5583}
     84
     85}
  • icGREP/icgrep-devel/icgrep/kernels/p2s_kernel.h

    r4987 r5006  
    1616    void generateP2SKernel(llvm::Module *, IDISA::IDISA_Builder * iBuilder, KernelBuilder * kBuilder);
    1717
     18    void generateP2S_16Kernel(llvm::Module *, IDISA::IDISA_Builder * iBuilder, KernelBuilder * kBuilder);
     19
    1820}
    1921
Note: See TracChangeset for help on using the changeset viewer.