[llvm] [AArch64][CostModel] Increase the cost of illegal SVE int-to-fp converts (PR #130756)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 02:39:00 PDT 2025


================
@@ -2968,6 +3010,16 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
       {ISD::UINT_TO_FP, MVT::v2f64, MVT::v2i16, 4},
       {ISD::UINT_TO_FP, MVT::v2f64, MVT::v2i32, 2},
 
+      // SVE: to nxv2f64
+      {ISD::SINT_TO_FP, MVT::nxv2f64, MVT::nxv2i8, 7},
+      {ISD::SINT_TO_FP, MVT::nxv2f64, MVT::nxv2i16, 5},
+      {ISD::SINT_TO_FP, MVT::nxv2f64, MVT::nxv2i32, 3},
----------------
sdesmalen-arm wrote:

Okay so if I understand you correctly, the cost you've encoded here includes the cost of possibly (or likely) extracting a sub-vector as part of type legalisation (like extracting a `<vscale x 4 x i16>` from a `<vscale x 8 x i16>` source operand for example, when it has to split a `<vscale x 8 x float> uitofp <vscale x 8 x 16> %in`). Ideally the code in `BaseT::getCastInstrCost` would add some cost for extracting a subvector when calculating the legalisation cost, but this doesn't really happen anywhere at the moment.

If you want to reflect these costs in this table, can you decompose the cost into a "cost of convert" + "cost of type-legalisation/extract-subvector" in that case?

https://github.com/llvm/llvm-project/pull/130756


More information about the llvm-commits mailing list