summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86TargetTransformInfo.cpp
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2013-07-12 19:16:07 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2013-07-12 19:16:07 +0000
commit7251a75f6ee9ce38263be6580a235187475458ed (patch)
tree1d03dbeaf96d78842d28a8cae7111b0cb11cf7fd /lib/Target/X86/X86TargetTransformInfo.cpp
parent4a1c764264a8908aa041acf12f68cd8bcc2037b1 (diff)
downloadllvm-7251a75f6ee9ce38263be6580a235187475458ed.tar.gz
llvm-7251a75f6ee9ce38263be6580a235187475458ed.tar.bz2
llvm-7251a75f6ee9ce38263be6580a235187475458ed.tar.xz
X86 cost model: Add cost for vectorized gather/scather
radar://14351991 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetTransformInfo.cpp')
-rw-r--r--lib/Target/X86/X86TargetTransformInfo.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Target/X86/X86TargetTransformInfo.cpp b/lib/Target/X86/X86TargetTransformInfo.cpp
index 68e1a67243..3bbddadca8 100644
--- a/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -100,6 +100,8 @@ public:
unsigned Alignment,
unsigned AddressSpace) const;
+ virtual unsigned getAddressComputationCost(Type *PtrTy, bool IsComplex) const;
+
/// @}
};
@@ -598,3 +600,16 @@ unsigned X86TTI::getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
return Cost;
}
+
+unsigned X86TTI::getAddressComputationCost(Type *Ty, bool IsComplex) const {
+ // Address computations in vectorized code with non-consecutive addresses will
+ // likely result in more instructions compared to scalar code where the
+ // computation can more often be merged into the index mode. The resulting
+ // extra micro-ops can significantly decrease throughput.
+ unsigned NumVectorInstToHideOverhead = 10;
+
+ if (Ty->isVectorTy() && IsComplex)
+ return NumVectorInstToHideOverhead;
+
+ return TargetTransformInfo::getAddressComputationCost(Ty, IsComplex);
+}