Skip to content

Commit 0718bac

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 e32a693 commit 0718bac

File tree

2 files changed

+164
-146
lines changed

2 files changed

+164
-146
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,24 @@ 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+
// vp float cast ops.
1014+
case Intrinsic::vp_fptoui:
1015+
case Intrinsic::vp_fptosi:
1016+
case Intrinsic::vp_uitofp:
1017+
case Intrinsic::vp_sitofp:
1018+
case Intrinsic::vp_fptrunc:
1019+
case Intrinsic::vp_fpext: {
1020+
std::optional<unsigned> FOp =
1021+
VPIntrinsic::getFunctionalOpcodeForVP(ICA.getID());
1022+
if (FOp && !ICA.getArgTypes().empty())
1023+
return getCastInstrCost(*FOp, ICA.getReturnType(), ICA.getArgTypes()[0],
1024+
TTI::CastContextHint::None, CostKind);
1025+
break;
1026+
}
10091027
}
10101028

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

0 commit comments

Comments
 (0)