[PATCH] D21156: [X86] Add costs for SSE zext/sext to v4i64 to TTI

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 10:04:49 PDT 2016


mkuper added a comment.

Because BasicTTIImpl::getCastInstrCost() doesn't even try to use it for vector sexts/zexts. It just assumes scalarization.

This is the case we fall into:

  // If we are converting vectors and the operation is illegal, or
  // if the vectors are legalized to different types, estimate the
  // scalarization costs.
  unsigned Num = Dst->getVectorNumElements();
  unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
      Opcode, Dst->getScalarType(), Src->getScalarType());
  
  // Return the cost of multiple scalar invocation plus the cost of
  // inserting and extracting the values.
  return getScalarizationOverhead(Dst, true, true) + Num * Cost;

Changing this (and the other two places where we have the same logic) to use getTypeLegalizationCost() and query getCastInstrCost() for the legalized type was what I meant above.


http://reviews.llvm.org/D21156





More information about the llvm-commits mailing list