[LLVMdev] AVX2 Cost Table in X86TargetTransformInfo

Nadav Rotem nrotem at apple.com
Mon May 4 09:27:06 PDT 2015


> On May 4, 2015, at 2:36 AM, suyog sarda <sardask01 at gmail.com> wrote:
> 
> Hi all,
> 
> I have a query regarding Cost Table for AVX2 in TargetTransformInfo. 
> 
> The table consist of entries for shift and div operations only. There are no entries for ADD, SUB and MUL for AVX2 cost table. Those entries are present in Cost Table for AVX. 

Most of the cost information is inferred from the TargetLowering tables (where operations are marked as Legal, Custom, etc.)  Only exceptional instructions need to be recorded in the TargetTransformInfo cost tables. 

> 
> The reason for query is - when my sub target feature is AVX2, in SLP Vectorization,  while calculating scalar cost of ADD, it doesn't see the entry in cost table and falls back to default implementation returning cost 1. While for AVX, it finds the ADD in cost table and returns 4 as scalar cost.

> 
> I am suspecting this is something specific to architecture difference between AVX and AVX2. I am naive to architecture specifics in this case. 

I assume that this is integer ADD, because AVX1 only supported floating point arithmetic on 256bit vectors, while AVX2 added support for 256bit integer arithmetic. So, it makes sense that the cost that AVX1 gives this operation is much higher. 


> 
> I would be glad if someone clarifies on this.
> 
> Thanks.
> 
> Regards,
> Suyog Sarda    





More information about the llvm-dev mailing list