Changeset 6058


Ignore:
Timestamp:
May 23, 2018, 2:19:46 PM (3 months ago)
Author:
cameron
Message:

Small fixes

Location:
icGREP/icgrep-devel/icgrep
Files:
3 edited

Legend:

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

    r6056 r6058  
    539539
    540540llvm::Value * IDISA_AVX512F_Builder::mvmd_shuffle(unsigned fw, llvm::Value * a, llvm::Value * shuffle_table) {
    541     Type * fwTy = getIntNTy(fw);
    542541    const unsigned fieldCount = mBitBlockWidth/fw;
    543542    if (mBitBlockWidth == 512 && fw == 32) {
    544543        Value * permuteFunc = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_avx512_mask_vpermt2var_d_512);
    545         Constant * mask = Constant::getIntegerValue(fwTy, APInt::getLowBitsSet(fw, fieldCount));
     544        Constant * mask = ConstantInt::getAllOnesValue(getIntNTy(fieldCount));
    546545        return CreateCall(permuteFunc, {fwCast(fw, shuffle_table), fwCast(fw, a), fwCast(fw, a), mask});
    547546    }
    548547    if (mBitBlockWidth == 512 && fw == 64) {
    549548        Value * permuteFunc = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_avx512_mask_vpermt2var_q_512);
    550         Constant * mask = Constant::getIntegerValue(fwTy, APInt::getLowBitsSet(fw, fieldCount));
     549        Constant * mask = ConstantInt::getAllOnesValue(getIntNTy(fieldCount));
    551550        return CreateCall(permuteFunc, {fwCast(fw, shuffle_table), fwCast(fw, a), fwCast(fw, a), mask});
    552551    }
    553552    if (mBitBlockWidth == 512 && fw == 16 && hostCPUFeatures.hasAVX512BW) {
    554553        Value * permuteFunc = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_avx512_maskz_vpermt2var_hi_512);
    555         Constant * mask = Constant::getIntegerValue(fwTy, APInt::getLowBitsSet(fw, fieldCount));
     554        Constant * mask = ConstantInt::getAllOnesValue(getIntNTy(fieldCount));
    556555        return CreateCall(permuteFunc, {fwCast(fw, shuffle_table), fwCast(fw, a), fwCast(fw, a), mask});
    557556    }
     
    560559
    561560llvm::Value * IDISA_AVX512F_Builder::mvmd_shuffle2(unsigned fw, Value * a, Value * b, llvm::Value * shuffle_table) {
    562     Type * fwTy = getIntNTy(fw);
    563561    const unsigned fieldCount = mBitBlockWidth/fw;
    564562    if (mBitBlockWidth == 512 && fw == 32) {
    565563        Value * permuteFunc = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_avx512_mask_vpermt2var_d_512);
    566         Constant * mask = Constant::getIntegerValue(fwTy, APInt::getLowBitsSet(fw, fieldCount));
     564        Constant * mask = ConstantInt::getAllOnesValue(getIntNTy(fieldCount));
    567565        return CreateCall(permuteFunc, {fwCast(fw, shuffle_table), fwCast(fw, a), fwCast(fw, b), mask});
    568566    }
    569567    if (mBitBlockWidth == 512 && fw == 64) {
    570568        Value * permuteFunc = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_avx512_mask_vpermt2var_q_512);
    571         Constant * mask = Constant::getIntegerValue(fwTy, APInt::getLowBitsSet(fw, fieldCount));
     569        Constant * mask = ConstantInt::getAllOnesValue(getIntNTy(fieldCount));
    572570        return CreateCall(permuteFunc, {fwCast(fw, shuffle_table), fwCast(fw, a), fwCast(fw, b), mask});
    573571    }
    574572    if (mBitBlockWidth == 512 && fw == 16 && hostCPUFeatures.hasAVX512BW) {
    575573        Value * permuteFunc = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_avx512_maskz_vpermt2var_hi_512);
    576         Constant * mask = Constant::getIntegerValue(fwTy, APInt::getLowBitsSet(fw, fieldCount));
     574        Constant * mask = ConstantInt::getAllOnesValue(getIntNTy(fieldCount));
    577575        return CreateCall(permuteFunc, {fwCast(fw, shuffle_table), fwCast(fw, a), fwCast(fw, b), mask});
    578576    }
     
    638636            indices[i] = ConstantInt::get(fwTy, i + fieldCount - shift);
    639637        }
    640         Constant * mask = Constant::getIntegerValue(fwTy, APInt::getLowBitsSet(fw, fieldCount));
     638        Constant * mask = ConstantInt::getAllOnesValue(getIntNTy(fieldCount));
    641639        Value * args[4] = {ConstantVector::get({indices, fieldCount}), fwCast(fw, b), fwCast(fw, a), mask};
    642640        return bitCast(CreateCall(permute_func, args));
  • icGREP/icgrep-devel/icgrep/idisa_test.cpp

    r6056 r6058  
    299299    }
    300300    kb->storeOutputStreamBlock("expected_result", ZeroConst, expectedBlock);
    301     Value * failures = kb->simd_ugt(mTestFw, kb->CreateXor(resultBlock, expectedBlock), kb->allZeroes());
     301    Value * failures = kb->simd_ugt(mTestFw, kb->simd_xor(resultBlock, expectedBlock), kb->allZeroes());
    302302    Value * anyFailure = kb->bitblock_any(failures);
    303303    Value * failure_count = kb->CreateUDiv(kb->bitblock_popcount(failures), kb->getSize(mTestFw));
  • icGREP/icgrep-devel/icgrep/kernels/hex_convert.cpp

    r6053 r6058  
    4343        //b->CallPrintInt("binary_pack ptr", b->CreateGEP(outputStreamBasePtr, b->CreateUDiv(packNumPhi, TWO)));
    4444        Value * binary_pack = b->bitCast(b->hsimd_packl(8, base_val[0], base_val[1]));
    45         b->storeOutputStreamBlock("binary_data", ZERO, b->getInt32(i), binary_pack);
     45        b->storeOutputStreamBlock("binary_data", ZERO, b->getSize(i), binary_pack);
    4646    }
    4747}
Note: See TracChangeset for help on using the changeset viewer.