diff options
author | Nadav Rotem <nrotem@apple.com> | 2012-12-23 17:31:23 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2012-12-23 17:31:23 +0000 |
commit | cf9999d9d50e5b8a228903a8a3d2c26b9773e8bd (patch) | |
tree | 18b4b392c7f2902528232d6bfd56ad1eba6752cc /llvm/lib/Target/TargetTransformImpl.cpp | |
parent | 28691400dd5305eb70f6c74cdb2f9ff5d86c1172 (diff) | |
download | bcm5719-llvm-cf9999d9d50e5b8a228903a8a3d2c26b9773e8bd.tar.gz bcm5719-llvm-cf9999d9d50e5b8a228903a8a3d2c26b9773e8bd.zip |
CostModel: Change the default target-independent implementation for finding
the cost of arithmetic functions. We now assume that the cost of arithmetic
operations that are marked as Legal or Promote is low, but ops that are
marked as custom are higher.
llvm-svn: 171002
Diffstat (limited to 'llvm/lib/Target/TargetTransformImpl.cpp')
-rw-r--r-- | llvm/lib/Target/TargetTransformImpl.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Target/TargetTransformImpl.cpp b/llvm/lib/Target/TargetTransformImpl.cpp index 1f568506d9a..3d640dc0235 100644 --- a/llvm/lib/Target/TargetTransformImpl.cpp +++ b/llvm/lib/Target/TargetTransformImpl.cpp @@ -179,12 +179,22 @@ unsigned VectorTargetTransformImpl::getArithmeticInstrCost(unsigned Opcode, std::pair<unsigned, MVT> LT = getTypeLegalizationCost(Ty); - if (!TLI->isOperationExpand(ISD, LT.second)) { - // The operation is legal. Assume it costs 1. Multiply - // by the type-legalization overhead. + if (TLI->isOperationLegalOrPromote(ISD, LT.second)) { + // The operation is legal. Assume it costs 1. + // If the type is split to multiple registers, assume that thre is some + // overhead to this. + // TODO: Once we have extract/insert subvector cost we need to use them. + if (LT.first > 1) + return LT.first * 2; return LT.first * 1; } + if (!TLI->isOperationExpand(ISD, LT.second)) { + // If the operation is custom lowered then assume + // thare the code is twice as expensive. + return LT.first * 2; + } + // Else, assume that we need to scalarize this op. if (Ty->isVectorTy()) { unsigned Num = Ty->getVectorNumElements(); |