Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
27 changes: 27 additions & 0 deletions llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,33 @@ 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;
Value *ImmValue = *(ICA.getInst()->arg_begin() + 2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getInst()->getArgOperand(2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

auto *Imm = cast<ConstantInt>(ImmValue);
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;
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No else if the if body returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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

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