Changeset 4652 for icGREP


Ignore:
Timestamp:
Jul 9, 2015, 4:48:22 PM (4 years ago)
Author:
cameron
Message:

mergeh and mergel IDISA functions

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

Legend:

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

    r4651 r4652  
    101101}
    102102
     103Value * IDISA_Builder::esimd_mergeh(unsigned fw, Value * a, Value * b) {
     104    unsigned field_count = mBitBlockSize/fw;
     105    Value * aVec = fwCast(fw, a);
     106    Value * bVec = fwCast(fw, b);
     107    std::vector<Constant*> Idxs;
     108    for (unsigned i = field_count/2; i < field_count; i++) {
     109        Idxs.push_back(llvm_builder->getInt32(i));    // selects elements 1, 3, ... from first reg.
     110        Idxs.push_back(llvm_builder->getInt32(i + field_count)); // selects elements 1, 3, ... from second reg.
     111    }
     112    return bitBlockCast(llvm_builder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs)));
     113}
     114
     115Value * IDISA_Builder::esimd_mergel(unsigned fw, Value * a, Value * b) {
     116    unsigned field_count = mBitBlockSize/fw;
     117    Value * aVec = fwCast(fw, a);
     118    Value * bVec = fwCast(fw, b);
     119    std::vector<Constant*> Idxs;
     120    for (unsigned i = 0; i < field_count/2; i++) {
     121        Idxs.push_back(llvm_builder->getInt32(i));    // selects elements 1, 3, ... from first reg.
     122        Idxs.push_back(llvm_builder->getInt32(i + field_count)); // selects elements 1, 3, ... from second reg.
     123    }
     124    return bitBlockCast(llvm_builder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs)));
     125}
     126
     127
     128
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h

    r4651 r4652  
    4242    Value * simd_cttz(unsigned fw, Value * a);
    4343   
     44    Value * esimd_mergeh(unsigned fw, Value * a, Value * b);
     45    Value * esimd_mergel(unsigned fw, Value * a, Value * b);
     46
    4447private:
    4548    Module * mMod;
Note: See TracChangeset for help on using the changeset viewer.