[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
Wed Dec 26 13:47:44 PST 2012


Hi Hal,

The length of the vector should be a part of the 'Type' argument.  The extracted vector starts at index and ends at index+len, much like the SelectionDAG extract_subvector.

Thanks,
Nadav

On Dec 26, 2012, at 1:45 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> ----- Original Message -----
>> From: "Nadav Rotem" <nrotem at apple.com>
>> To: llvm-commits at cs.uiuc.edu
>> Sent: Monday, December 24, 2012 4:04:03 AM
>> Subject: [llvm-commits] [llvm] r171027 - in /llvm/trunk: include/llvm/Target/TargetTransformImpl.h
>> include/llvm/TargetTransformInfo.h lib/Target/TargetTransformImpl.cpp
>> 
>> 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.
>>   };
> 
> Are these subvector insert and extract from the indicated index to the end of the vector? Should we add a length so that we have both the starting offset and length of the subvector?
> 
> Thanks again,
> Hal
> 
>> 
>>   /// 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;
>> }
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> 
> 
> -- 
> Hal Finkel
> Postdoctoral Appointee
> Leadership Computing Facility
> Argonne National Laboratory




More information about the llvm-commits mailing list