summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86ISelLowering.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-12-28 08:19:03 +0000
committerNadav Rotem <nrotem@apple.com>2012-12-28 08:19:03 +0000
commitae34b4280ebde6217706902e8a27bb858765a61c (patch)
tree95b5705d9253667a4efec2489bd1ba61695fe03f /lib/Target/X86/X86ISelLowering.cpp
parent40ef8b75487ad9f98a93b1dbf283a25658ef8a1e (diff)
downloadllvm-ae34b4280ebde6217706902e8a27bb858765a61c.tar.gz
llvm-ae34b4280ebde6217706902e8a27bb858765a61c.tar.bz2
llvm-ae34b4280ebde6217706902e8a27bb858765a61c.tar.xz
CostModel: initial checkin for code that estimates the cost of special shuffles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index e5122abd4b..5d495a68ed 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -18237,3 +18237,19 @@ unsigned X86VectorTargetTransformInfo::getCastInstrCost(unsigned Opcode,
return VectorTargetTransformImpl::getCastInstrCost(Opcode, Dst, Src);
}
+
+unsigned X86VectorTargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Tp,
+ int Index) const {
+ // We only estimate the cost of reverse shuffles.
+ if (Kind != Reverse)
+ return VectorTargetTransformImpl::getShuffleCost(Kind, Tp, Index);
+
+ std::pair<unsigned, MVT> LT = getTypeLegalizationCost(Tp);
+ unsigned Cost = 1;
+ if (LT.second.getSizeInBits() > 128)
+ Cost = 3; // Extract + insert + copy.
+
+ // Multiple by the number of parts.
+ return Cost * LT.first;
+}
+