[PATCH] D59787: [ARM] WIP: implement TTI:getMemcpyCost
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 11:12:33 PDT 2019
SjoerdMeijer created this revision.
Herald added subscribers: kristof.beyls, javed.absar.
https://reviews.llvm.org/D59787
Files:
lib/Analysis/TargetTransformInfo.cpp
lib/Target/ARM/ARMTargetTransformInfo.cpp
lib/Target/ARM/ARMTargetTransformInfo.h
Index: lib/Target/ARM/ARMTargetTransformInfo.h
===================================================================
--- lib/Target/ARM/ARMTargetTransformInfo.h
+++ lib/Target/ARM/ARMTargetTransformInfo.h
@@ -161,6 +161,8 @@
int getAddressComputationCost(Type *Val, ScalarEvolution *SE,
const SCEV *Ptr);
+ int getMemcpyCost(const Instruction *I);
+
int getArithmeticInstrCost(
unsigned Opcode, Type *Ty,
TTI::OperandValueKind Op1Info = TTI::OK_AnyValue,
Index: lib/Target/ARM/ARMTargetTransformInfo.cpp
===================================================================
--- lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -401,6 +401,25 @@
return 1;
}
+int ARMTTIImpl::getMemcpyCost(const Instruction *I) {
+ std::vector<EVT> MemOps;
+ const Function *F = I->getParent()->getParent();
+ getTLI()->findOptimalMemOpLowering(MemOps,
+ 100 /*Limit*/,
+ 32 /*Size*/,
+ 4 /*DstAlign*/,
+ 4 /*SrcAlign*/,
+ false /*IsMemset*/,
+ false /*ZeroMemset*/,
+ false /*MemcpyStrSrc*/,
+ false /*AllowOverlap*/,
+ 4 /*DstAS*/,
+ 4 /*SrcAS*/,
+ *F);
+ return MemOps.size() * 2;
+}
+
+
int ARMTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index,
Type *SubTp) {
if (Kind == TTI::SK_Broadcast) {
Index: lib/Analysis/TargetTransformInfo.cpp
===================================================================
--- lib/Analysis/TargetTransformInfo.cpp
+++ lib/Analysis/TargetTransformInfo.cpp
@@ -584,6 +584,12 @@
return Cost;
}
+int TargetTransformInfo::getMemcpyCost(const Instruction *I) const {
+ int Cost = TTIImpl->getMemcpyCost(I);
+ assert(Cost >= 0 && "TTI should not produce negative costs!");
+ return Cost;
+}
+
int TargetTransformInfo::getArithmeticReductionCost(unsigned Opcode, Type *Ty,
bool IsPairwiseForm) const {
int Cost = TTIImpl->getArithmeticReductionCost(Opcode, Ty, IsPairwiseForm);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59787.192164.patch
Type: text/x-patch
Size: 2428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190325/ae9dbba4/attachment.bin>
More information about the llvm-commits
mailing list