mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-05 02:16:46 +00:00
CostModel: We have API for checking the costs of known shuffles. This patch adds
support for the insert-subvector and extract-subvector kinds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171027 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
94d7ab7da4
commit
1e1c5f37c3
@ -71,7 +71,8 @@ public:
|
||||
|
||||
virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty) const;
|
||||
|
||||
virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp) const;
|
||||
virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp,
|
||||
int Index) const;
|
||||
|
||||
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
|
||||
Type *Src) const;
|
||||
|
@ -158,8 +158,10 @@ public:
|
||||
virtual ~VectorTargetTransformInfo() {}
|
||||
|
||||
enum ShuffleKind {
|
||||
Broadcast, // Broadcast element 0 to all other elements.
|
||||
Reverse // Reverse the order of the vector.
|
||||
Broadcast, // Broadcast element 0 to all other elements.
|
||||
Reverse, // Reverse the order of the vector.
|
||||
InsertSubvector, // InsertSubvector. Index indicates start offset.
|
||||
ExtractSubvector // ExtractSubvector Index indicates start offset.
|
||||
};
|
||||
|
||||
/// Returns the expected cost of arithmetic ops, such as mul, xor, fsub, etc.
|
||||
@ -168,7 +170,10 @@ public:
|
||||
}
|
||||
|
||||
/// Returns the cost of a shuffle instruction of kind Kind and of type Tp.
|
||||
virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp) const {
|
||||
/// The index parameter is used by some of the shuffle kinds to add
|
||||
/// additional information.
|
||||
virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp,
|
||||
int Index) const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,8 @@ unsigned VectorTargetTransformImpl::getArithmeticInstrCost(unsigned Opcode,
|
||||
}
|
||||
|
||||
unsigned VectorTargetTransformImpl::getShuffleCost(ShuffleKind Kind,
|
||||
Type *Tp) const {
|
||||
Type *Tp,
|
||||
int Index) const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user