summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-04-12 21:15:03 +0000
committerNadav Rotem <nrotem@apple.com>2013-04-12 21:15:03 +0000
commit87a0af6e1b46abd3efa4ceb70186f6af5bc22c13 (patch)
tree05adc2f493baff34f624811be5dcf634a567a5e7 /llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
parent4da0ab1d6873333bc5a73b62a7f19a62770703e3 (diff)
downloadbcm5719-llvm-87a0af6e1b46abd3efa4ceb70186f6af5bc22c13.tar.gz
bcm5719-llvm-87a0af6e1b46abd3efa4ceb70186f6af5bc22c13.zip
CostModel: increase the default cost of supported floating point operations from 1 to two. Fixed a few tests that changes because now the cost of one insert + a vector operation on two doubles is lower than two scalar operations on doubles.
llvm-svn: 179413
Diffstat (limited to 'llvm/lib/CodeGen/BasicTargetTransformInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/BasicTargetTransformInfo.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
index 012ff8ad833..499571fcac6 100644
--- a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
+++ b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
@@ -204,20 +204,23 @@ unsigned BasicTTI::getArithmeticInstrCost(unsigned Opcode, Type *Ty,
std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(Ty);
+ bool IsFloat = Ty->getScalarType()->isFloatingPointTy();
+ unsigned OpCost = (IsFloat ? 2 : 1);
+
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;
+ return LT.first * 2 * OpCost;
+ return LT.first * 1 * OpCost;
}
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;
+ return LT.first * 2 * OpCost;
}
// Else, assume that we need to scalarize this op.
@@ -230,7 +233,7 @@ unsigned BasicTTI::getArithmeticInstrCost(unsigned Opcode, Type *Ty,
}
// We don't know anything about this scalar instruction.
- return 1;
+ return OpCost;
}
unsigned BasicTTI::getShuffleCost(ShuffleKind Kind, Type *Tp, int Index,
OpenPOWER on IntegriCloud