Skip to content

Commit 80b4451

Browse files
authored
[RISCV][TTI] Add instruction cost for vp.select. (#109381)
This patch make instruction cost for vp.select the same as its non-vp counterpart.
1 parent c3d3cef commit 80b4451

File tree

2 files changed

+232
-100
lines changed

2 files changed

+232
-100
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,13 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
11161116
*FOp, ICA.getArgTypes()[0], UI->getPointerAlignment(),
11171117
UI->getOperand(1)->getType()->getPointerAddressSpace(), CostKind);
11181118
}
1119+
case Intrinsic::vp_select: {
1120+
Intrinsic::ID IID = ICA.getID();
1121+
std::optional<unsigned> FOp = VPIntrinsic::getFunctionalOpcodeForVP(IID);
1122+
assert(FOp.has_value());
1123+
return getCmpSelInstrCost(*FOp, ICA.getReturnType(), ICA.getArgTypes()[0],
1124+
CmpInst::BAD_ICMP_PREDICATE, CostKind);
1125+
}
11191126
}
11201127

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

0 commit comments

Comments
 (0)