Add a subtype parameter to VTTI::getShuffleCost
authorHal Finkel <hfinkel@anl.gov>
Thu, 3 Jan 2013 02:34:09 +0000 (02:34 +0000)
committerHal Finkel <hfinkel@anl.gov>
Thu, 3 Jan 2013 02:34:09 +0000 (02:34 +0000)
In order to cost subvector insertion and extraction, we need to know
the type of the subvector being extracted.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171453 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 3b6ed1abd3d9b5cc46367fda7a18e79238f2b5a9..bbdb4f1dc24a37e2becc46b0ccf3c8535ccab228 100644 (file)
@@ -72,7 +72,7 @@ public:
   virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty) const;
 
   virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp,
-                                  int Index) const;
+                                  int Index, Type *SubTp) const;
 
   virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
                                     Type *Src) const;
index 6336afcffe8acff17af53cc25cc4b342c9fd03dd..1dc2b07ddfdfd17dfaadc135447b262d11bbf464 100644 (file)
@@ -170,10 +170,10 @@ public:
   }
 
   /// Returns the cost of a shuffle instruction of kind Kind and of type Tp.
-  /// The index parameter is used by some of the shuffle kinds to add
-  /// additional information.
+  /// The index and subtype parameters are used by some of the shuffle kinds
+  /// to add additional information.
   virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp,
-                                  int Index = 0) const {
+                                  int Index = 0, Type *SubTp = 0) const {
     return 1;
   }
 
index d7c221ee1fd70485dc9aa2435e7956bcc44ce859..f8c588934fecf7598cee9f33bb9fd08d0ef8a35b 100644 (file)
@@ -209,8 +209,7 @@ unsigned VectorTargetTransformImpl::getArithmeticInstrCost(unsigned Opcode,
 }
 
 unsigned VectorTargetTransformImpl::getShuffleCost(ShuffleKind Kind,
-                                                   Type *Tp,
-                                                   int Index) const {
+                                  Type *Tp, int Index, Type *SubTp) const {
   return 1;
 }
 
index 4afc0d81979b96380160ad67763f6c2c1815aff6..eca63f80ae0d4335bd17296a7e3a9469c1263820 100644 (file)
@@ -18303,10 +18303,11 @@ unsigned X86VectorTargetTransformInfo::getCastInstrCost(unsigned Opcode,
 
 
 unsigned X86VectorTargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Tp,
-                                                      int Index) const {
+                                                      int Index,
+                                                      Type *SubTp) const {
   // We only estimate the cost of reverse shuffles.
   if (Kind != Reverse)
-    return VectorTargetTransformImpl::getShuffleCost(Kind, Tp, Index);
+    return VectorTargetTransformImpl::getShuffleCost(Kind, Tp, Index, SubTp);
 
   std::pair<unsigned, MVT> LT = getTypeLegalizationCost(Tp);
   unsigned Cost = 1;
index 1b4b5eb65da2a1c83add48412e2114dc6f06a5f7..2e2fc2a234f598a91e13fb8ad0e5b70f27cf147d 100644 (file)
@@ -974,7 +974,8 @@ namespace llvm {
     virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
                                       Type *Src) const;
 
-    unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, int Index) const;
+    unsigned getShuffleCost(ShuffleKind Kind,
+                            Type *Tp, int Index, Type *SubTp) const;
   };
 }