Ignore:
Timestamp:
Dec 14, 2015, 2:01:49 PM (3 years ago)
Author:
cameron
Message:

Move AVX2 specific IDISA function implementations into subclassed builder

File:
1 edited

Legend:

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

    r4891 r4892  
    148148}
    149149
    150 Value * IDISA_Builder:: esimd_bitspread(unsigned fw, Value * bitmask) {
     150Value * IDISA_Builder::esimd_bitspread(unsigned fw, Value * bitmask) {
    151151    unsigned field_count = mBitBlockWidth/fw;
    152152    Type * field_type = mLLVMBuilder->getIntNTy(fw);
     
    193193}
    194194
    195 #if (BLOCK_SIZE==256)
    196 #define SIGNMASK_AVX2
    197 #endif
    198 
    199195Value * IDISA_Builder::hsimd_signmask(unsigned fw, Value * a) {
    200 #ifdef SIGNMASK_AVX2
    201     if (fw == 64) {
    202         Value * signmask_f64func = Intrinsic::getDeclaration(mMod, Intrinsic::x86_avx_movmsk_pd_256);
    203         Type * bitBlock_f64type = VectorType::get(mLLVMBuilder->getDoubleTy(), mBitBlockWidth/64);
    204         Value * a_as_pd = mLLVMBuilder->CreateBitCast(a, bitBlock_f64type);
    205         Value * mask = mLLVMBuilder->CreateCall(signmask_f64func, std::vector<Value *>({a_as_pd}));
    206         return mask;
    207     }
    208     else if (fw == 32) {
    209         Value * signmask_f32func = Intrinsic::getDeclaration(mMod, Intrinsic::x86_avx_movmsk_ps_256);
    210         Type * bitBlock_f32type = VectorType::get(mLLVMBuilder->getFloatTy(), mBitBlockWidth/32);
    211         Value * a_as_ps = mLLVMBuilder->CreateBitCast(a, bitBlock_f32type);
    212         Value * mask = mLLVMBuilder->CreateCall(signmask_f32func, std::vector<Value *>({a_as_ps}));
    213         return mask;
    214     }
    215 #endif
    216196    Value * mask = mLLVMBuilder->CreateICmpSLT(fwCast(fw, a), ConstantAggregateZero::get(fwVectorType(fw)));
    217     return mLLVMBuilder->CreateBitCast(mask, mLLVMBuilder->getIntNTy(mBitBlockWidth/fw));
     197    return mLLVMBuilder->CreateZExt(mLLVMBuilder->CreateBitCast(mask, mLLVMBuilder->getIntNTy(mBitBlockWidth/fw)), mLLVMBuilder->getInt32Ty());
    218198}
    219199
Note: See TracChangeset for help on using the changeset viewer.