================
@@ -1066,6 +1066,17 @@ InstructionCost GCNTTIImpl::getCastInstrCost(unsigned 
Opcode, Type *Dst,
         Elts && Src->isIntegerTy(*Elts))
       return InstructionCost(MaskUnpackCostPerElt) * *Elts *
              getFullRateInstrCost();
+    // Integer and FP values share registers. The sizes differ for the parts of
+    // a split vector, and a legalized vector may need its lanes repacked.
+    if (Src->getPrimitiveSizeInBits() == Dst->getPrimitiveSizeInBits()) {
----------------
MrSidims wrote:

Okay, I see. We may be scalarizing vector to vector cast and the check is 
preventing from estimating artificial pairs that might or might be inserted at 
the scalarization stage. Having this in mind:
1) (nitpick) I'd suggest the following layout):
```
// 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.
  /* the checks */
```
2) if I read the tests correctly - none of them are exercising the check, 
right? if so, would be nice to have one.
3) the fix now feels like a workaround, the model itself, which currently 
spells like "bitcast with different number of elements = number of element-wise 
cast", which doesn't seem right. 

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

Reply via email to