Changeset 6019


Ignore:
Timestamp:
May 6, 2018, 2:25:29 PM (2 weeks ago)
Author:
cameron
Message:

mvmd_compress for 64-bit fields on AVX2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.cpp

    r6017 r6019  
    319319    // Translate larger field widths to 32 bits.
    320320    if (fw > 32) {
    321         return fwCast(fw, mvmd_srl(32, a, CreateMul(shift, ConstantInt::get(shift->getType(), fw/32))));
     321        return fwCast(fw, mvmd_sll(32, a, CreateMul(shift, ConstantInt::get(shift->getType(), fw/32))));
    322322    }
    323323    if ((mBitBlockWidth == 256) && (fw == 32)) {
     
    344344
    345345llvm::Value * IDISA_AVX2_Builder::mvmd_compress(unsigned fw, llvm::Value * a, llvm::Value * select_mask) {
     346    if (mBitBlockWidth == 256 && fw == 64) {
     347        Value * PDEP_func = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_bmi_pdep_32);
     348        Value * mask = CreateZExt(select_mask, getInt32Ty());
     349        Value * mask32 = CreateMul(CreateCall(PDEP_func, {mask, getInt32(0x55)}), getInt32(3));
     350        Value * result = fwCast(fw, mvmd_compress(32, fwCast(32, a), CreateTrunc(mask32, getInt8Ty())));
     351        return result;
     352    }
    346353    if (mBitBlockWidth == 256 && fw == 32) {
    347354        Type * v1xi32Ty = VectorType::get(getInt32Ty(), 1);
     
    371378        Value * compress = CreateCall(shuf32Func, {a, shuf});
    372379        Value * field_mask = CreateTrunc(CreateSub(CreateShl(getInt32(1), field_count), getInt32(1)), getInt8Ty());
    373         Value * selectf = CreateBitCast(field_mask, v8xi1Ty);
    374         Value * result = CreateSelect(selectf, compress, ConstantVector::getNullValue(v8xi32Ty));
     380        Value * result = CreateAnd(compress, CreateSExt(CreateBitCast(field_mask, v8xi1Ty), v8xi32Ty));
    375381        return result;
    376382    }
Note: See TracChangeset for help on using the changeset viewer.