[llvm-commits] [llvm] r171022 - in /llvm/trunk: include/llvm/Target/TargetTransformImpl.h include/llvm/TargetTransformInfo.h lib/Target/TargetTransformImpl.cpp

Nadav Rotem nrotem at apple.com
Mon Dec 24 00:57:47 PST 2012


Author: nadav
Date: Mon Dec 24 02:57:47 2012
New Revision: 171022

URL: http://llvm.org/viewvc/llvm-project?rev=171022&view=rev
Log:
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.


Modified:
    llvm/trunk/include/llvm/Target/TargetTransformImpl.h
    llvm/trunk/include/llvm/TargetTransformInfo.h
    llvm/trunk/lib/Target/TargetTransformImpl.cpp

Modified: llvm/trunk/include/llvm/Target/TargetTransformImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetTransformImpl.h?rev=171022&r1=171021&r2=171022&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetTransformImpl.h (original)
+++ llvm/trunk/include/llvm/Target/TargetTransformImpl.h Mon Dec 24 02:57:47 2012
@@ -71,7 +71,7 @@
 
   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;

Modified: llvm/trunk/include/llvm/TargetTransformInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TargetTransformInfo.h?rev=171022&r1=171021&r2=171022&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TargetTransformInfo.h (original)
+++ llvm/trunk/include/llvm/TargetTransformInfo.h Mon Dec 24 02:57:47 2012
@@ -157,14 +157,18 @@
 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;
   }
 

Modified: llvm/trunk/lib/Target/TargetTransformImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetTransformImpl.cpp?rev=171022&r1=171021&r2=171022&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetTransformImpl.cpp (original)
+++ llvm/trunk/lib/Target/TargetTransformImpl.cpp Mon Dec 24 02:57:47 2012
@@ -208,7 +208,8 @@
   return 1;
 }
 
-unsigned VectorTargetTransformImpl::getBroadcastCost(Type *Tp) const {
+unsigned VectorTargetTransformImpl::getShuffleCost(ShuffleKind Kind,
+                                                   Type *Tp) const {
   return 1;
 }
 





More information about the llvm-commits mailing list