1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

CostModel: initial checkin for code that estimates the cost of special shuffles.

llvm-svn: 171180
This commit is contained in:
Nadav Rotem 2012-12-28 08:19:03 +00:00
parent d5216d7ac7
commit c8ec143f05
2 changed files with 18 additions and 0 deletions

View File

@ -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;
}

View File

@ -973,6 +973,8 @@ namespace llvm {
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const;
unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, int Index) const;
};
}