Skip to content

Commit 21558b7

Browse files
committed
[RISCV][TTI] Add cost of typebased cast VPIntrinsics with functionalOPC.
This patch make the instrudction cost of typebased cast VP intrinsics that will be same as their non-VP counterpart.
1 parent 2fbce40 commit 21558b7

File tree

2 files changed

+300
-146
lines changed

2 files changed

+300
-146
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,26 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
10061006
return getArithmeticInstrCost(*FOp, ICA.getReturnType(), CostKind);
10071007
break;
10081008
}
1009+
// vp int cast ops.
1010+
case Intrinsic::vp_trunc:
1011+
case Intrinsic::vp_zext:
1012+
case Intrinsic::vp_sext:
1013+
case Intrinsic::vp_ptrtoint:
1014+
case Intrinsic::vp_inttoptr:
1015+
// vp float cast ops.
1016+
case Intrinsic::vp_fptoui:
1017+
case Intrinsic::vp_fptosi:
1018+
case Intrinsic::vp_uitofp:
1019+
case Intrinsic::vp_sitofp:
1020+
case Intrinsic::vp_fptrunc:
1021+
case Intrinsic::vp_fpext: {
1022+
std::optional<unsigned> FOp =
1023+
VPIntrinsic::getFunctionalOpcodeForVP(ICA.getID());
1024+
if (FOp && !ICA.getArgTypes().empty())
1025+
return getCastInstrCost(*FOp, ICA.getReturnType(), ICA.getArgTypes()[0],
1026+
TTI::CastContextHint::None, CostKind);
1027+
break;
1028+
}
10091029
}
10101030

10111031
if (ST->hasVInstructions() && RetTy->isVectorTy()) {

0 commit comments

Comments
 (0)