Skip to content

Commit 7c3dd12

Browse files
committed
[RISCV][TTI] Add cost of typebased binary VP intrisic with functionalOPC
This patch add the instruction cost for type based binary VP intrinsic instructions. The cost of type based binary VP intrinsics will as same as their non-VP counterpart.
1 parent e16697c commit 7c3dd12

File tree

3 files changed

+359
-252
lines changed

3 files changed

+359
-252
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,32 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
959959
return Cost * LT.first;
960960
break;
961961
}
962+
// vp integer arithmetic ops.
963+
case Intrinsic::vp_add:
964+
case Intrinsic::vp_and:
965+
case Intrinsic::vp_ashr:
966+
case Intrinsic::vp_lshr:
967+
case Intrinsic::vp_mul:
968+
case Intrinsic::vp_or:
969+
case Intrinsic::vp_sdiv:
970+
case Intrinsic::vp_shl:
971+
case Intrinsic::vp_srem:
972+
case Intrinsic::vp_sub:
973+
case Intrinsic::vp_udiv:
974+
case Intrinsic::vp_urem:
975+
case Intrinsic::vp_xor:
976+
// vp float arithmetic ops.
977+
case Intrinsic::vp_fadd:
978+
case Intrinsic::vp_fsub:
979+
case Intrinsic::vp_fmul:
980+
case Intrinsic::vp_fdiv:
981+
case Intrinsic::vp_frem: {
982+
std::optional<unsigned> FOp =
983+
VPIntrinsic::getFunctionalOpcodeForVP(ICA.getID());
984+
if (FOp)
985+
return getArithmeticInstrCost(*FOp, ICA.getReturnType(), CostKind);
986+
break;
987+
}
962988
}
963989

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

0 commit comments

Comments
 (0)