Ignore:
Timestamp:
Oct 18, 2015, 1:59:31 PM (4 years ago)
Author:
cameron
Message:

Improved shifts

File:
1 edited

Legend:

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

    r4843 r4845  
    1212
    1313namespace IDISA {
    14 
    15 Value * IDISA_Builder::bitBlockCast(Value * a) {
    16     return a->getType() == mBitBlockType ? a : mLLVMBuilder->CreateBitCast(a, mBitBlockType);
    17 }
    1814
    1915VectorType * IDISA_Builder::fwVectorType(unsigned fw) {
     
    3733                                                   /*Initializer=*/ regNameData);
    3834    Value * regStrPtr = mLLVMBuilder->CreateGEP(regStrVar, std::vector<Value *>({mLLVMBuilder->getInt64(0), mLLVMBuilder->getInt32(0)}));
    39     mLLVMBuilder->CreateCall(mPrintRegisterFunction, std::vector<Value *>({regStrPtr, bitblockValue}));
     35    mLLVMBuilder->CreateCall(mPrintRegisterFunction, std::vector<Value *>({regStrPtr, bitCast(bitblockValue)}));
    4036}
    4137
     
    182178    Value * bVec = fwCast(fw, b);
    183179    std::vector<Constant*> Idxs;
    184     for (unsigned i = shift; i < field_count + shift; i++) {
    185         Idxs.push_back(mLLVMBuilder->getInt32(i));
    186     }
    187     return mLLVMBuilder->CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
     180    for (unsigned i = 0; i < field_count; i++) {
     181        Idxs.push_back(mLLVMBuilder->getInt32(i + shift));
     182    }
     183    return mLLVMBuilder->CreateShuffleVector(bVec, aVec, ConstantVector::get(Idxs));
    188184}
    189185
     
    194190
    195191Value * IDISA_Builder::simd_and(Value * a, Value * b) {
    196     return a->getType() == b->getType() ? mLLVMBuilder->CreateAnd(a, b) : mLLVMBuilder->CreateAnd(bitBlockCast(a), bitBlockCast(b));
     192    return a->getType() == b->getType() ? mLLVMBuilder->CreateAnd(a, b) : mLLVMBuilder->CreateAnd(bitCast(a), bitCast(b));
    197193}
    198194
    199195Value * IDISA_Builder::simd_or(Value * a, Value * b) {
    200     return a->getType() == b->getType() ? mLLVMBuilder->CreateOr(a, b) : mLLVMBuilder->CreateOr(bitBlockCast(a), bitBlockCast(b));
     196    return a->getType() == b->getType() ? mLLVMBuilder->CreateOr(a, b) : mLLVMBuilder->CreateOr(bitCast(a), bitCast(b));
    201197}
    202198   
    203199Value * IDISA_Builder::simd_xor(Value * a, Value * b) {
    204     return a->getType() == b->getType() ? mLLVMBuilder->CreateXor(a, b) : mLLVMBuilder->CreateXor(bitBlockCast(a), bitBlockCast(b));
     200    return a->getType() == b->getType() ? mLLVMBuilder->CreateXor(a, b) : mLLVMBuilder->CreateXor(bitCast(a), bitCast(b));
    205201}
    206202
Note: See TracChangeset for help on using the changeset viewer.