aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/TargetTransformImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/TargetTransformImpl.cpp')
-rw-r--r--lib/Target/TargetTransformImpl.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Target/TargetTransformImpl.cpp b/lib/Target/TargetTransformImpl.cpp
index b36e6f858f..7f9fdfc938 100644
--- a/lib/Target/TargetTransformImpl.cpp
+++ b/lib/Target/TargetTransformImpl.cpp
@@ -283,7 +283,7 @@ unsigned VectorTargetTransformImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
}
unsigned VectorTargetTransformImpl::getCFInstrCost(unsigned Opcode) const {
- return 1;
+ return 0;
}
unsigned VectorTargetTransformImpl::getCmpSelInstrCost(unsigned Opcode,
@@ -347,6 +347,25 @@ VectorTargetTransformImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
}
unsigned
+VectorTargetTransformImpl::getIntrinsicInstrCost(Intrinsic::ID, Type *RetTy,
+ ArrayRef<Type*> Tys) const {
+ // assume that we need to scalarize this intrinsic.
+ unsigned ScalarizationCost = 0;
+ unsigned ScalarCalls = 1;
+ if (RetTy->isVectorTy()) {
+ ScalarizationCost = getScalarizationOverhead(RetTy, true, false);
+ ScalarCalls = std::max(ScalarCalls, RetTy->getVectorNumElements());
+ }
+ for (unsigned i = 0, ie = Tys.size(); i != ie; ++i) {
+ if (Tys[i]->isVectorTy()) {
+ ScalarizationCost += getScalarizationOverhead(Tys[i], false, true);
+ ScalarCalls = std::max(ScalarCalls, RetTy->getVectorNumElements());
+ }
+ }
+ return ScalarCalls + ScalarizationCost;
+}
+
+unsigned
VectorTargetTransformImpl::getNumberOfParts(Type *Tp) const {
std::pair<unsigned, MVT> LT = getTypeLegalizationCost(Tp);
return LT.first;