Change the codegen Cost Model API for shuffeles. This patch removes the API for broad...
authorNadav Rotem <nrotem@apple.com>
Mon, 24 Dec 2012 08:57:47 +0000 (08:57 +0000)
committerNadav Rotem <nrotem@apple.com>
Mon, 24 Dec 2012 08:57:47 +0000 (08:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171022 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetTransformImpl.h
include/llvm/TargetTransformInfo.h
lib/Target/TargetTransformImpl.cpp

index 59b7ffc826ac8941bae4b1f5ba5e3a56e82bec20..f2229748be5ec27696e94f4ec80a3778f0ad4cc1 100644 (file)
@@ -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;
index 718d4bcfea98a0167aaad24feac8fe6bff373ef5..1a5dda3bb2836aa71e48d9dbfbefea526ae5bdfa 100644 (file)
@@ -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;
   }
 
index 3d640dc02352acf2c106af8e161d024471bae989..a320e16c98fae230d32b2370a3ac2031d73e62bc 100644 (file)
@@ -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;
 }