================
@@ -1066,6 +1066,19 @@ InstructionCost GCNTTIImpl::getCastInstrCost(unsigned
Opcode, Type *Dst,
Elts && Src->isIntegerTy(*Elts))
return InstructionCost(MaskUnpackCostPerElt) * *Elts *
getFullRateInstrCost();
+ // The generic code scalarizes a vector cast into element casts, which for
+ // a bitcast may pair elements of different sizes.
+ if (Src->getPrimitiveSizeInBits() == Dst->getPrimitiveSizeInBits()) {
+ // Integer and FP values share registers. A legalized vector may need its
+ // lanes repacked.
+ if (TLI->isTypeLegal(TLI->getValueType(DL, Src)) &&
+ TLI->isTypeLegal(TLI->getValueType(DL, Dst)))
+ return 0;
+ if (!Src->isVectorTy() && !Dst->isVectorTy() &&
+ getTypeLegalizationCost(Src).second.getSizeInBits() ==
+ getTypeLegalizationCost(Dst).second.getSizeInBits())
+ return 0;
----------------
arsenm wrote:
Pretty sure this ends up doing the same Type -> EVT calculation multiple times
https://github.com/llvm/llvm-project/pull/238412
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits