[llvm-commits] [llvm] r171027 - 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 02:04:03 PST 2012


Author: nadav
Date: Mon Dec 24 04:04:03 2012
New Revision: 171027

URL: http://llvm.org/viewvc/llvm-project?rev=171027&view=rev
Log:
CostModel: We have API for checking the costs of known shuffles. This patch adds
support for the insert-subvector and extract-subvector kinds.


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=171027&r1=171026&r2=171027&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetTransformImpl.h (original)
+++ llvm/trunk/include/llvm/Target/TargetTransformImpl.h Mon Dec 24 04:04:03 2012
@@ -71,7 +71,8 @@
 
   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;

Modified: llvm/trunk/include/llvm/TargetTransformInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TargetTransformInfo.h?rev=171027&r1=171026&r2=171027&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TargetTransformInfo.h (original)
+++ llvm/trunk/include/llvm/TargetTransformInfo.h Mon Dec 24 04:04:03 2012
@@ -158,8 +158,10 @@
   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 @@
   }
 
   /// 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;
   }
 

Modified: llvm/trunk/lib/Target/TargetTransformImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetTransformImpl.cpp?rev=171027&r1=171026&r2=171027&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetTransformImpl.cpp (original)
+++ llvm/trunk/lib/Target/TargetTransformImpl.cpp Mon Dec 24 04:04:03 2012
@@ -209,7 +209,8 @@
 }
 
 unsigned VectorTargetTransformImpl::getShuffleCost(ShuffleKind Kind,
-                                                   Type *Tp) const {
+                                                   Type *Tp,
+                                                   int Index) const {
   return 1;
 }
 





More information about the llvm-commits mailing list