Skip to content

Commit

Permalink
[RISCV][VP] support vp.reduce.mul by ExpandVectorPredication
Browse files Browse the repository at this point in the history
Most of VP intrinsics are implemented in RISC-V backends, but
vp.reduce.mul (element length > 1) does not yet. Legalizes vp.reduce.mul
using ExpandVectorPredication Pass.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D139721
  • Loading branch information
inclyc committed Dec 17, 2022
1 parent 8086323 commit 0359c19
Show file tree
Hide file tree
Showing 2 changed files with 467 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
TargetTransformInfo::VPLegalization
getVPLegalizationStrategy(const VPIntrinsic &PI) const {
using VPLegalization = TargetTransformInfo::VPLegalization;
if (PI.getIntrinsicID() == Intrinsic::vp_reduce_mul &&
cast<VectorType>(PI.getArgOperand(1)->getType())
->getElementType()
->getIntegerBitWidth() != 1)
return VPLegalization(VPLegalization::Discard, VPLegalization::Convert);
return VPLegalization(VPLegalization::Legal, VPLegalization::Legal);
}

Expand Down
Loading

0 comments on commit 0359c19

Please sign in to comment.