diff options
author | Paul Redmond <paul.redmond@intel.com> | 2012-12-09 20:42:17 +0000 |
---|---|---|
committer | Paul Redmond <paul.redmond@intel.com> | 2012-12-09 20:42:17 +0000 |
commit | 880166684e5af0f5b4bfe26870b9f7813e537354 (patch) | |
tree | 51c6a6d48732a0ddf166bb34ac207b59b172d403 /lib/Target | |
parent | 855d0255d0bc388da7554d05f8cf184e26f5a00d (diff) |
LoopVectorize: support vectorizing intrinsic calls
- added function to VectorTargetTransformInfo to query cost of intrinsics
- vectorize trivially vectorizable intrinsic calls such as sin, cos, log, etc.
Reviewed by: Nadav
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169711 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/TargetTransformImpl.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Target/TargetTransformImpl.cpp b/lib/Target/TargetTransformImpl.cpp index 2df72630bb..7f9fdfc938 100644 --- a/lib/Target/TargetTransformImpl.cpp +++ b/lib/Target/TargetTransformImpl.cpp @@ -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; |