Skip to content

Commit eaac532

Browse files
lukel97arcbbb
andcommitted
[RISCV] Add cost for @llvm.experimental.vp.splat
This is split off from llvm#115274. There doesn't seem to be an easy way to share this with getShuffleCost since that requires passing in a real insert_element operand to get it to recognise it's a scalar splat. There's no tests for i1 vectors, since we can't lower vp splats of them yet and currently crash. Co-authored-by: Shih-Po Hung <[email protected]>
1 parent 7ca219a commit eaac532

File tree

2 files changed

+69
-64
lines changed

2 files changed

+69
-64
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,11 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
11551155
return getCmpSelInstrCost(Instruction::Select, ICA.getReturnType(),
11561156
ICA.getArgTypes()[0], CmpInst::BAD_ICMP_PREDICATE,
11571157
CostKind);
1158+
case Intrinsic::experimental_vp_splat: {
1159+
auto LT = getTypeLegalizationCost(RetTy);
1160+
return LT.first *
1161+
getRISCVInstructionCost(RISCV::VMV_V_X, LT.second, CostKind);
1162+
}
11581163
case Intrinsic::vp_reduce_add:
11591164
case Intrinsic::vp_reduce_fadd:
11601165
case Intrinsic::vp_reduce_mul:

0 commit comments

Comments
 (0)