Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,30 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
: RISCV::VMV_V_X,
LT.second, CostKind);
}
case Intrinsic::experimental_vp_splice: {
auto LT = getTypeLegalizationCost(RetTy);
SmallVector<unsigned, 2> Opcodes;
auto *Imm = cast<ConstantInt>(ICA.getInst()->getArgOperand(2));
if (Imm->isNegative())
Opcodes = {RISCV::VSLIDEDOWN_VI, RISCV::VSLIDEUP_VX};
else
Opcodes = {RISCV::VSLIDEDOWN_VX, RISCV::VSLIDEUP_VI};

if (!ST->hasVInstructions())
return InstructionCost::getInvalid();

if (LT.second.getScalarType() == MVT::i1) {
unsigned AddOpcodes[8] = {
RISCV::VMV1R_V, RISCV::VMV1R_V, RISCV::VMV_V_I, RISCV::VMERGE_VIM,
RISCV::VMV_V_I, RISCV::VMV1R_V, RISCV::VMERGE_VIM, RISCV::VMSNE_VI};
return LT.first *
(getRISCVInstructionCost(Opcodes, LT.second, CostKind) +
getRISCVInstructionCost(AddOpcodes, LT.second, CostKind)) +
1;
}

return LT.first * getRISCVInstructionCost(Opcodes, LT.second, CostKind) + 1;
}
}

if (ST->hasVInstructions() && RetTy->isVectorTy()) {
Expand Down
Loading
Loading