summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit7e1599e100e2d5ee56ee38c3ace692a0e05f39d1 (patch)
tree035de6258aac69fc11975db649bdfe9a81ee5240 /llvm
parent098842b401a1bc1103980de182899563e63f518e (diff)
downloadbcm5719-llvm-7e1599e100e2d5ee56ee38c3ace692a0e05f39d1.tar.gz
bcm5719-llvm-7e1599e100e2d5ee56ee38c3ace692a0e05f39d1.zip
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.
llvm-svn: 171022
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Target/TargetTransformImpl.h2
-rw-r--r--llvm/include/llvm/TargetTransformInfo.h10
-rw-r--r--llvm/lib/Target/TargetTransformImpl.cpp3
3 files changed, 10 insertions, 5 deletions
diff --git a/llvm/include/llvm/Target/TargetTransformImpl.h b/llvm/include/llvm/Target/TargetTransformImpl.h
index 59b7ffc826a..f2229748be5 100644
--- a/llvm/include/llvm/Target/TargetTransformImpl.h
+++ b/llvm/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/llvm/include/llvm/TargetTransformInfo.h b/llvm/include/llvm/TargetTransformInfo.h
index 718d4bcfea9..1a5dda3bb28 100644
--- a/llvm/include/llvm/TargetTransformInfo.h
+++ b/llvm/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;
}
diff --git a/llvm/lib/Target/TargetTransformImpl.cpp b/llvm/lib/Target/TargetTransformImpl.cpp
index 3d640dc0235..a320e16c98f 100644
--- a/llvm/lib/Target/TargetTransformImpl.cpp
+++ b/llvm/lib/Target/TargetTransformImpl.cpp
@@ -208,7 +208,8 @@ unsigned VectorTargetTransformImpl::getArithmeticInstrCost(unsigned Opcode,
return 1;
}
-unsigned VectorTargetTransformImpl::getBroadcastCost(Type *Tp) const {
+unsigned VectorTargetTransformImpl::getShuffleCost(ShuffleKind Kind,
+ Type *Tp) const {
return 1;
}
OpenPOWER on IntegriCloud