diff options
author | Stefan Pintilie <stefanp@ca.ibm.com> | 2018-03-07 16:53:09 +0000 |
---|---|---|
committer | Stefan Pintilie <stefanp@ca.ibm.com> | 2018-03-07 16:53:09 +0000 |
commit | f8438e8e591880d7857161a7cc83655c3fd076ef (patch) | |
tree | 53ce71e5b0c78defa02e7101561ede6addc90706 /llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp | |
parent | 984ab0f1e66d247d7073323d28b1f9d5676af983 (diff) | |
download | bcm5719-llvm-f8438e8e591880d7857161a7cc83655c3fd076ef.tar.gz bcm5719-llvm-f8438e8e591880d7857161a7cc83655c3fd076ef.zip |
[PowerPC] LSR tunings for PowerPC
The purpose of this patch is to have LSR generate better code on Power.
This is done by overriding isLSRCostLess.
Differential Revision: https://reviews.llvm.org/D40855
llvm-svn: 326906
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp index 226c75f704f..d35a8fecaff 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -256,6 +256,19 @@ bool PPCTTIImpl::enableInterleavedAccessVectorization() { return true; } +bool PPCTTIImpl::isLSRCostLess(TargetTransformInfo::LSRCost &C1, + TargetTransformInfo::LSRCost &C2) { + // This is mainly the default cost calculation. The only difference + // is that now the number of instructions is the most important + // metric. + return std::tie(C1.Insns, C1.NumRegs, C1.AddRecCost, + C1.NumIVMuls, C1.NumBaseAdds, + C1.ScaleCost, C1.ImmCost, C1.SetupCost) < + std::tie(C2.Insns, C2.NumRegs, C2.AddRecCost, + C2.NumIVMuls, C2.NumBaseAdds, + C2.ScaleCost, C2.ImmCost, C2.SetupCost); +} + unsigned PPCTTIImpl::getNumberOfRegisters(bool Vector) { if (Vector && !ST->hasAltivec() && !ST->hasQPX()) return 0; |