Skip to content

Commit 9503976

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 f1cc77c commit 9503976

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
@@ -1015,6 +1015,24 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
10151015
return getArithmeticInstrCost(*FOp, ICA.getReturnType(), CostKind);
10161016
break;
10171017
}
1018+
// vp int cast ops.
1019+
case Intrinsic::vp_trunc:
1020+
case Intrinsic::vp_zext:
1021+
case Intrinsic::vp_sext:
1022+
// vp float cast ops.
1023+
case Intrinsic::vp_fptoui:
1024+
case Intrinsic::vp_fptosi:
1025+
case Intrinsic::vp_uitofp:
1026+
case Intrinsic::vp_sitofp:
1027+
case Intrinsic::vp_fptrunc:
1028+
case Intrinsic::vp_fpext: {
1029+
std::optional<unsigned> FOp =
1030+
VPIntrinsic::getFunctionalOpcodeForVP(ICA.getID());
1031+
if (FOp && !ICA.getArgTypes().empty())
1032+
return getCastInstrCost(*FOp, ICA.getReturnType(), ICA.getArgTypes()[0],
1033+
TTI::CastContextHint::None, CostKind);
1034+
break;
1035+
}
10181036
}
10191037

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

0 commit comments

Comments
 (0)