summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-12-24 08:57:47 +0000
committerNadav Rotem <nrotem@apple.com>2012-12-24 08:57:47 +0000
commitdaf7b5c8f2889ddb923544565f07518d504aa574 (patch)
tree90a68a445b4fc9804160e769d7f61c00cbfc5cc7 /include
parent3a19999413b18304d1a00cbdbe73fc43ea9cb75f (diff)
downloadllvm-daf7b5c8f2889ddb923544565f07518d504aa574.tar.gz
llvm-daf7b5c8f2889ddb923544565f07518d504aa574.tar.bz2
llvm-daf7b5c8f2889ddb923544565f07518d504aa574.tar.xz
Change the codegen Cost Model API for shuffeles. This patch removes the API for broadcast and adds a more general API that accepts an enum of known shuffles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171022 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Target/TargetTransformImpl.h2
-rw-r--r--include/llvm/TargetTransformInfo.h10
2 files changed, 8 insertions, 4 deletions
diff --git a/include/llvm/Target/TargetTransformImpl.h b/include/llvm/Target/TargetTransformImpl.h
index 59b7ffc826..f2229748be 100644
--- a/include/llvm/Target/TargetTransformImpl.h
+++ b/include/llvm/Target/TargetTransformImpl.h
@@ -71,7 +71,7 @@ public:
virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty) const;
- virtual unsigned getBroadcastCost(Type *Tp) const;
+ virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp) const;
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const;
diff --git a/include/llvm/TargetTransformInfo.h b/include/llvm/TargetTransformInfo.h
index 718d4bcfea..1a5dda3bb2 100644
--- a/include/llvm/TargetTransformInfo.h
+++ b/include/llvm/TargetTransformInfo.h
@@ -157,14 +157,18 @@ class VectorTargetTransformInfo {
public:
virtual ~VectorTargetTransformInfo() {}
+ enum ShuffleKind {
+ Broadcast, // Broadcast element 0 to all other elements.
+ Reverse // Reverse the order of the vector.
+ };
+
/// Returns the expected cost of arithmetic ops, such as mul, xor, fsub, etc.
virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty) const {
return 1;
}
- /// Returns the cost of a vector broadcast of a scalar at place zero to a
- /// vector of type 'Tp'.
- virtual unsigned getBroadcastCost(Type *Tp) const {
+ /// Returns the cost of a shuffle instruction of kind Kind and of type Tp.
+ virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp) const {
return 1;
}