Skip to content
Draft
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
18 changes: 18 additions & 0 deletions llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,22 @@ bool LoongArchTTIImpl::shouldExpandReduction(const IntrinsicInst *II) const {
}
}

InstructionCost LoongArchTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args,
const Instruction *CxtI) const {

Kind = improveShuffleKindFromMask(Kind, Mask, SrcTy, Index, SubTp);
switch (Kind) {
default:
return BaseT::getShuffleCost(Kind, DstTy, SrcTy, Mask, CostKind, Index,
SubTp, Args, CxtI);
// case TTI::SK_Broadcast:
// case TTI::SK_Reverse:
case TTI::SK_Transpose:
return 1;
}
}

// TODO: Implement more hooks to provide TTI machinery for LoongArch.
5 changes: 5 additions & 0 deletions llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {
bool enableWritePrefetching() const override;

bool shouldExpandReduction(const IntrinsicInst *II) const override;
InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const override;

// TODO: Implement more hooks to provide TTI machinery for LoongArch.
};
Expand Down