summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
diff options
context:
space:
mode:
authorSean Fertile <sfertile@ca.ibm.com>2017-05-31 18:20:17 +0000
committerSean Fertile <sfertile@ca.ibm.com>2017-05-31 18:20:17 +0000
commit457ddd311a164b31c7ef431abd4fd5dba84683f4 (patch)
tree8cd4f34cb4c634a2cd68b350b6ce6977fdfbd186 /llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
parentca77dd591edbeddc3db1cecffef15b9811602c26 (diff)
downloadbcm5719-llvm-457ddd311a164b31c7ef431abd4fd5dba84683f4.tar.gz
bcm5719-llvm-457ddd311a164b31c7ef431abd4fd5dba84683f4.zip
[PowerPC] Correctly specify the cache line size for Power 7, 8 and 9.
Fixes PPCTTIImpl::getCacheLineSize() returning the wrong cache line size for newer ppc processors. Commiting on behalf of Stefan Pintilie. Differential Revision: https://reviews.llvm.org/D33656 llvm-svn: 304317
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
index 83768da3a9a..5559cdc5fe4 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
@@ -244,9 +244,18 @@ unsigned PPCTTIImpl::getRegisterBitWidth(bool Vector) {
}
unsigned PPCTTIImpl::getCacheLineSize() {
- // This is currently only used for the data prefetch pass which is only
- // enabled for BG/Q by default.
- return CacheLineSize;
+ // Check first if the user specified a custom line size.
+ if (CacheLineSize.getNumOccurrences() > 0)
+ return CacheLineSize;
+
+ // On P7, P8 or P9 we have a cache line size of 128.
+ unsigned Directive = ST->getDarwinDirective();
+ if (Directive == PPC::DIR_PWR7 || Directive == PPC::DIR_PWR8 ||
+ Directive == PPC::DIR_PWR9)
+ return 128;
+
+ // On other processors return a default of 64 bytes.
+ return 64;
}
unsigned PPCTTIImpl::getPrefetchDistance() {
OpenPOWER on IntegriCloud