Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,37 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
return getCmpSelInstrCost(Instruction::Select, ICA.getReturnType(),
ICA.getArgTypes()[0], CmpInst::BAD_ICMP_PREDICATE,
CostKind);
case Intrinsic::vp_reduce_add:
case Intrinsic::vp_reduce_fadd:
case Intrinsic::vp_reduce_mul:
case Intrinsic::vp_reduce_fmul:
case Intrinsic::vp_reduce_and:
case Intrinsic::vp_reduce_or:
case Intrinsic::vp_reduce_xor: {
std::optional<Intrinsic::ID> RedID =
VPIntrinsic::getFunctionalIntrinsicIDForVP(ICA.getID());
assert(RedID.has_value());
unsigned RedOp = getArithmeticReductionInstruction(*RedID);
return getArithmeticReductionCost(RedOp,
cast<VectorType>(ICA.getArgTypes()[1]),
ICA.getFlags(), CostKind);
}
case Intrinsic::vp_reduce_smax:
case Intrinsic::vp_reduce_smin:
case Intrinsic::vp_reduce_umax:
case Intrinsic::vp_reduce_umin:
case Intrinsic::vp_reduce_fmax:
case Intrinsic::vp_reduce_fmaximum:
case Intrinsic::vp_reduce_fmin:
case Intrinsic::vp_reduce_fminimum: {
std::optional<Intrinsic::ID> RedID =
VPIntrinsic::getFunctionalIntrinsicIDForVP(ICA.getID());
assert(RedID.has_value());
Intrinsic::ID MinMaxID = getMinMaxReductionIntrinsicOp(*RedID);
return getMinMaxReductionCost(MinMaxID,
cast<VectorType>(ICA.getArgTypes()[1]),
ICA.getFlags(), CostKind);
}
}

if (ST->hasVInstructions() && RetTy->isVectorTy()) {
Expand Down
125 changes: 125 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-add.ll

Large diffs are not rendered by default.

134 changes: 134 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-and.ll

Large diffs are not rendered by default.

373 changes: 373 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-fadd.ll

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-fmaximum.ll

Large diffs are not rendered by default.

88 changes: 88 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-fminimum.ll

Large diffs are not rendered by default.

349 changes: 349 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-fmul.ll

Large diffs are not rendered by default.

252 changes: 251 additions & 1 deletion llvm/test/Analysis/CostModel/RISCV/reduce-max.ll

Large diffs are not rendered by default.

250 changes: 250 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-min.ll

Large diffs are not rendered by default.

134 changes: 134 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-or.ll

Large diffs are not rendered by default.

201 changes: 201 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-scalable-fp.ll

Large diffs are not rendered by default.

342 changes: 342 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-scalable-int.ll

Large diffs are not rendered by default.

125 changes: 125 additions & 0 deletions llvm/test/Analysis/CostModel/RISCV/reduce-xor.ll

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll

Large diffs are not rendered by default.

Loading