diff options
author | Nadav Rotem <nrotem@apple.com> | 2012-12-24 10:04:03 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2012-12-24 10:04:03 +0000 |
commit | 3ee6b10dd4ff2c4b60b46aa5564257e57a0d7a3c (patch) | |
tree | 6de4b3eb461c0ca545a65126a84f401ccb02fe61 | |
parent | 517afbff01608dee1013b1e0f54e145686309573 (diff) | |
download | bcm5719-llvm-3ee6b10dd4ff2c4b60b46aa5564257e57a0d7a3c.tar.gz bcm5719-llvm-3ee6b10dd4ff2c4b60b46aa5564257e57a0d7a3c.zip |
CostModel: We have API for checking the costs of known shuffles. This patch adds
support for the insert-subvector and extract-subvector kinds.
llvm-svn: 171027
-rw-r--r-- | llvm/include/llvm/Target/TargetTransformImpl.h | 3 | ||||
-rw-r--r-- | llvm/include/llvm/TargetTransformInfo.h | 11 | ||||
-rw-r--r-- | llvm/lib/Target/TargetTransformImpl.cpp | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/llvm/include/llvm/Target/TargetTransformImpl.h b/llvm/include/llvm/Target/TargetTransformImpl.h index f2229748be5..3b6ed1abd3d 100644 --- a/llvm/include/llvm/Target/TargetTransformImpl.h +++ b/llvm/include/llvm/Target/TargetTransformImpl.h @@ -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; diff --git a/llvm/include/llvm/TargetTransformInfo.h b/llvm/include/llvm/TargetTransformInfo.h index 1a5dda3bb28..c97c7e4b0d7 100644 --- a/llvm/include/llvm/TargetTransformInfo.h +++ b/llvm/include/llvm/TargetTransformInfo.h @@ -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; } diff --git a/llvm/lib/Target/TargetTransformImpl.cpp b/llvm/lib/Target/TargetTransformImpl.cpp index a320e16c98f..235a8fc76a6 100644 --- a/llvm/lib/Target/TargetTransformImpl.cpp +++ b/llvm/lib/Target/TargetTransformImpl.cpp @@ -209,7 +209,8 @@ unsigned VectorTargetTransformImpl::getArithmeticInstrCost(unsigned Opcode, } unsigned VectorTargetTransformImpl::getShuffleCost(ShuffleKind Kind, - Type *Tp) const { + Type *Tp, + int Index) const { return 1; } |