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

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 12 05:28:59 PDT 2025


https://github.com/huntergr-arm updated https://github.com/llvm/llvm-project/pull/130756

>From 8f23b433f0e32d2133c52b1fae78dbacfa070672 Mon Sep 17 00:00:00 2001
From: Graham Hunter <graham.hunter at arm.com>
Date: Wed, 5 Mar 2025 14:34:54 +0000
Subject: [PATCH 1/2] [AArch64][CostModel] Increase the cost of illegal SVE
 int-to-fp converts

If a scalable vector uitofp or sitofp effectively extend the size of each
element as part of the conversion, the AArch64 backend will need to plant
multiple unpacks before converting.
---
 .../AArch64/AArch64TargetTransformInfo.cpp    |  15 +
 .../Analysis/CostModel/AArch64/sve-itofp.ll   | 268 ++++++++++++++++++
 2 files changed, 283 insertions(+)
 create mode 100644 llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll

diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 7cec8a17dfaaa..8091fb8f990bf 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -3144,6 +3144,21 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
       {ISD::SIGN_EXTEND, MVT::nxv8i32, MVT::nxv8i16, 2},
       {ISD::SIGN_EXTEND, MVT::nxv8i64, MVT::nxv8i16, 6},
       {ISD::SIGN_EXTEND, MVT::nxv4i64, MVT::nxv4i32, 2},
+
+      // Add cost for extending and converting to illegal -too wide- scalable
+      // Extending one size (e.g. i32 -> f64) takes 2 unpacks and 2 fcvts, while
+      // extending twice (e.g. i16 -> f64) takes 6 unpacks and 4 fcvts.
+      {ISD::SINT_TO_FP, MVT::nxv16f16, MVT::nxv16i8, 12},
+      {ISD::SINT_TO_FP, MVT::nxv16f32, MVT::nxv16i8, 22},
+      {ISD::SINT_TO_FP, MVT::nxv8f32, MVT::nxv8i16, 12},
+      {ISD::SINT_TO_FP, MVT::nxv8f64, MVT::nxv8i16, 22},
+      {ISD::SINT_TO_FP, MVT::nxv4f64, MVT::nxv4i32, 12},
+
+      {ISD::UINT_TO_FP, MVT::nxv16f16, MVT::nxv16i8, 12},
+      {ISD::UINT_TO_FP, MVT::nxv16f32, MVT::nxv16i8, 22},
+      {ISD::UINT_TO_FP, MVT::nxv8f32, MVT::nxv8i16, 12},
+      {ISD::UINT_TO_FP, MVT::nxv8f64, MVT::nxv8i16, 22},
+      {ISD::UINT_TO_FP, MVT::nxv4f64, MVT::nxv4i32, 12},
   };
 
   // We have to estimate a cost of fixed length operation upon
diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll
new file mode 100644
index 0000000000000..12fd6411255f2
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll
@@ -0,0 +1,268 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple aarch64-linux-gnu -mattr=+sve -o - -S < %s | FileCheck %s
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-unknown-linux-gnu"
+
+define void @sve-itofp() {
+; CHECK-LABEL: 'sve-itofp'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si8_to_f16 = sitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui8_to_f16 = uitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si16_to_f16 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui16_to_f16 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si32_to_f16 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui32_to_f16 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si64_to_f16 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui64_to_f16 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si8_to_f32 = sitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui8_to_f32 = uitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si16_to_f32 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui16_to_f32 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si32_to_f32 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui32_to_f32 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si64_to_f32 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui64_to_f32 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si8_to_f64 = sitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui8_to_f64 = uitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si16_to_f64 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui16_to_f64 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si32_to_f64 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui32_to_f64 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si64_to_f64 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui64_to_f64 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si8_to_f16 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui8_to_f16 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si16_to_f16 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui16_to_f16 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si32_to_f16 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui32_to_f16 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si64_to_f16 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui64_to_f16 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si8_to_f32 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui8_to_f32 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si16_to_f32 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui16_to_f32 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si32_to_f32 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui32_to_f32 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si64_to_f32 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui64_to_f32 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si8_to_f64 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui8_to_f64 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si16_to_f64 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui16_to_f64 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si32_to_f64 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui32_to_f64 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si64_to_f64 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui64_to_f64 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si8_to_f16 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui8_to_f16 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si16_to_f16 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui16_to_f16 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si32_to_f16 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui32_to_f16 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si64_to_f16 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui64_to_f16 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si8_to_f32 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui8_to_f32 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si16_to_f32 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui16_to_f32 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si32_to_f32 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui32_to_f32 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si64_to_f32 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui64_to_f32 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si8_to_f64 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui8_to_f64 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si16_to_f64 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui16_to_f64 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv4si32_to_f64 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv4ui32_to_f64 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv4si64_to_f64 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv4ui64_to_f64 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8si8_to_f16 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8ui8_to_f16 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8si16_to_f16 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8ui16_to_f16 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8si32_to_f16 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8ui32_to_f16 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8si64_to_f16 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8ui64_to_f16 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8si8_to_f32 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8ui8_to_f32 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv8si16_to_f32 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv8ui16_to_f32 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv8si32_to_f32 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv8ui32_to_f32 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv8si64_to_f32 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv8ui64_to_f32 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8si8_to_f64 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8ui8_to_f64 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv8si16_to_f64 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv8ui16_to_f64 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv8si32_to_f64 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv8ui32_to_f64 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv8si64_to_f64 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv8ui64_to_f64 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16si8_to_f16 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16ui8_to_f16 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv16si16_to_f16 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv16ui16_to_f16 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv16si32_to_f16 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv16ui32_to_f16 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv16si64_to_f16 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv16ui64_to_f16 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv16si8_to_f32 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv16ui8_to_f32 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv16si16_to_f32 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv16ui16_to_f32 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv16si32_to_f32 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv16ui32_to_f32 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16si64_to_f32 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16ui64_to_f32 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %nv16si8_to_f64 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %nv16ui8_to_f64 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 44 for instruction: %nv16si16_to_f64 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 44 for instruction: %nv16ui16_to_f64 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %nv16si32_to_f64 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %nv16ui32_to_f64 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %nv16si64_to_f64 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %nv16ui64_to_f64 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+
+  %nv1si8_to_f16  = sitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
+  %nv1ui8_to_f16  = uitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
+  %nv1si16_to_f16 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
+  %nv1ui16_to_f16 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
+  %nv1si32_to_f16 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
+  %nv1ui32_to_f16 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
+  %nv1si64_to_f16 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
+  %nv1ui64_to_f16 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
+
+  %nv1si8_to_f32  = sitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
+  %nv1ui8_to_f32  = uitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
+  %nv1si16_to_f32 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
+  %nv1ui16_to_f32 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
+  %nv1si32_to_f32 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
+  %nv1ui32_to_f32 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
+  %nv1si64_to_f32 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
+  %nv1ui64_to_f32 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
+
+  %nv1si8_to_f64  = sitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
+  %nv1ui8_to_f64  = uitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
+  %nv1si16_to_f64 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
+  %nv1ui16_to_f64 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
+  %nv1si32_to_f64 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
+  %nv1ui32_to_f64 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
+  %nv1si64_to_f64 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
+  %nv1ui64_to_f64 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
+
+  %nv2si8_to_f16  = sitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
+  %nv2ui8_to_f16  = uitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
+  %nv2si16_to_f16 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x half>
+  %nv2ui16_to_f16 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x half>
+  %nv2si32_to_f16 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x half>
+  %nv2ui32_to_f16 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x half>
+  %nv2si64_to_f16 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x half>
+  %nv2ui64_to_f16 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x half>
+
+  %nv2si8_to_f32  = sitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
+  %nv2ui8_to_f32  = uitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
+  %nv2si16_to_f32 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
+  %nv2ui16_to_f32 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
+  %nv2si32_to_f32 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x float>
+  %nv2ui32_to_f32 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x float>
+  %nv2si64_to_f32 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x float>
+  %nv2ui64_to_f32 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x float>
+
+  %nv2si8_to_f64  = sitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
+  %nv2ui8_to_f64  = uitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
+  %nv2si16_to_f64 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
+  %nv2ui16_to_f64 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
+  %nv2si32_to_f64 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
+  %nv2ui32_to_f64 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
+  %nv2si64_to_f64 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x double>
+  %nv2ui64_to_f64 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x double>
+
+  %nv4si8_to_f16  = sitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
+  %nv4ui8_to_f16  = uitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
+  %nv4si16_to_f16 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x half>
+  %nv4ui16_to_f16 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x half>
+  %nv4si32_to_f16 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x half>
+  %nv4ui32_to_f16 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x half>
+  %nv4si64_to_f16 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x half>
+  %nv4ui64_to_f16 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x half>
+
+  %nv4si8_to_f32  = sitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
+  %nv4ui8_to_f32  = uitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
+  %nv4si16_to_f32 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
+  %nv4ui16_to_f32 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
+  %nv4si32_to_f32 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x float>
+  %nv4ui32_to_f32 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x float>
+  %nv4si64_to_f32 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x float>
+  %nv4ui64_to_f32 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x float>
+
+  %nv4si8_to_f64  = sitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
+  %nv4ui8_to_f64  = uitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
+  %nv4si16_to_f64 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
+  %nv4ui16_to_f64 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
+  %nv4si32_to_f64 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
+  %nv4ui32_to_f64 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
+  %nv4si64_to_f64 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x double>
+  %nv4ui64_to_f64 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x double>
+
+  %nv8si8_to_f16  = sitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
+  %nv8ui8_to_f16  = uitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
+  %nv8si16_to_f16 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x half>
+  %nv8ui16_to_f16 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x half>
+  %nv8si32_to_f16 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x half>
+  %nv8ui32_to_f16 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x half>
+  %nv8si64_to_f16 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x half>
+  %nv8ui64_to_f16 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x half>
+
+  %nv8si8_to_f32  = sitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
+  %nv8ui8_to_f32  = uitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
+  %nv8si16_to_f32 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
+  %nv8ui16_to_f32 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
+  %nv8si32_to_f32 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x float>
+  %nv8ui32_to_f32 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x float>
+  %nv8si64_to_f32 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x float>
+  %nv8ui64_to_f32 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x float>
+
+  %nv8si8_to_f64  = sitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
+  %nv8ui8_to_f64  = uitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
+  %nv8si16_to_f64 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
+  %nv8ui16_to_f64 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
+  %nv8si32_to_f64 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
+  %nv8ui32_to_f64 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
+  %nv8si64_to_f64 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x double>
+  %nv8ui64_to_f64 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x double>
+
+  %nv16si8_to_f16  = sitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
+  %nv16ui8_to_f16  = uitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
+  %nv16si16_to_f16 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x half>
+  %nv16ui16_to_f16 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x half>
+  %nv16si32_to_f16 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x half>
+  %nv16ui32_to_f16 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x half>
+  %nv16si64_to_f16 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x half>
+  %nv16ui64_to_f16 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x half>
+
+  %nv16si8_to_f32  = sitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
+  %nv16ui8_to_f32  = uitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
+  %nv16si16_to_f32 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
+  %nv16ui16_to_f32 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
+  %nv16si32_to_f32 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x float>
+  %nv16ui32_to_f32 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x float>
+  %nv16si64_to_f32 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x float>
+  %nv16ui64_to_f32 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x float>
+
+  %nv16si8_to_f64  = sitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
+  %nv16ui8_to_f64  = uitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
+  %nv16si16_to_f64 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
+  %nv16ui16_to_f64 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
+  %nv16si32_to_f64 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
+  %nv16ui32_to_f64 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
+  %nv16si64_to_f64 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x double>
+  %nv16ui64_to_f64 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x double>
+
+  ret void
+}

>From 55541fb4c43d3f5f9b3418a6dbd718a94d3988cd Mon Sep 17 00:00:00 2001
From: Graham Hunter <graham.hunter at arm.com>
Date: Wed, 12 Mar 2025 12:10:43 +0000
Subject: [PATCH 2/2] Use pseudo-legalization from base getCastInstrCost

---
 .../AArch64/AArch64TargetTransformInfo.cpp    |  67 ++++--
 .../Analysis/CostModel/AArch64/sve-cast.ll    | 200 +++++++++---------
 .../Analysis/CostModel/AArch64/sve-itofp.ll   | 147 +++++--------
 3 files changed, 200 insertions(+), 214 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 8091fb8f990bf..b33299fcad00d 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -2936,6 +2936,30 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
       {ISD::UINT_TO_FP, MVT::v4f32, MVT::v4i32, 1},
       {ISD::UINT_TO_FP, MVT::v2f64, MVT::v2i64, 1},
 
+      // SVE: to nxv2f16
+      {ISD::SINT_TO_FP, MVT::nxv2f16, MVT::nxv2i8, 3},
+      {ISD::SINT_TO_FP, MVT::nxv2f16, MVT::nxv2i16, 1},
+      {ISD::SINT_TO_FP, MVT::nxv2f16, MVT::nxv2i32, 1},
+      {ISD::SINT_TO_FP, MVT::nxv2f16, MVT::nxv2i64, 1},
+      {ISD::UINT_TO_FP, MVT::nxv2f16, MVT::nxv2i8, 3},
+      {ISD::UINT_TO_FP, MVT::nxv2f16, MVT::nxv2i16, 1},
+      {ISD::UINT_TO_FP, MVT::nxv2f16, MVT::nxv2i32, 1},
+      {ISD::UINT_TO_FP, MVT::nxv2f16, MVT::nxv2i64, 1},
+
+      // SVE: to nxv4f16
+      {ISD::SINT_TO_FP, MVT::nxv4f16, MVT::nxv4i8, 3},
+      {ISD::SINT_TO_FP, MVT::nxv4f16, MVT::nxv4i16, 1},
+      {ISD::SINT_TO_FP, MVT::nxv4f16, MVT::nxv4i32, 1},
+      {ISD::UINT_TO_FP, MVT::nxv4f16, MVT::nxv4i8, 3},
+      {ISD::UINT_TO_FP, MVT::nxv4f16, MVT::nxv4i16, 1},
+      {ISD::UINT_TO_FP, MVT::nxv4f16, MVT::nxv4i32, 1},
+
+      // SVE: to nxv8f16
+      {ISD::SINT_TO_FP, MVT::nxv8f16, MVT::nxv8i8, 3},
+      {ISD::SINT_TO_FP, MVT::nxv8f16, MVT::nxv8i16, 1},
+      {ISD::UINT_TO_FP, MVT::nxv8f16, MVT::nxv8i8, 3},
+      {ISD::UINT_TO_FP, MVT::nxv8f16, MVT::nxv8i16, 1},
+
       // Complex: to v2f32
       {ISD::SINT_TO_FP, MVT::v2f32, MVT::v2i8, 3},
       {ISD::SINT_TO_FP, MVT::v2f32, MVT::v2i16, 3},
@@ -2944,12 +2968,30 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
       {ISD::UINT_TO_FP, MVT::v2f32, MVT::v2i16, 3},
       {ISD::UINT_TO_FP, MVT::v2f32, MVT::v2i64, 2},
 
+      // SVE: to nxv2f32
+      {ISD::SINT_TO_FP, MVT::nxv2f32, MVT::nxv2i8, 5},
+      {ISD::SINT_TO_FP, MVT::nxv2f32, MVT::nxv2i16, 3},
+      {ISD::SINT_TO_FP, MVT::nxv2f32, MVT::nxv2i32, 1},
+      {ISD::SINT_TO_FP, MVT::nxv2f32, MVT::nxv2i64, 1},
+      {ISD::UINT_TO_FP, MVT::nxv2f32, MVT::nxv2i8, 5},
+      {ISD::UINT_TO_FP, MVT::nxv2f32, MVT::nxv2i16, 3},
+      {ISD::UINT_TO_FP, MVT::nxv2f32, MVT::nxv2i32, 1},
+      {ISD::UINT_TO_FP, MVT::nxv2f32, MVT::nxv2i64, 1},
+
       // Complex: to v4f32
       {ISD::SINT_TO_FP, MVT::v4f32, MVT::v4i8, 4},
       {ISD::SINT_TO_FP, MVT::v4f32, MVT::v4i16, 2},
       {ISD::UINT_TO_FP, MVT::v4f32, MVT::v4i8, 3},
       {ISD::UINT_TO_FP, MVT::v4f32, MVT::v4i16, 2},
 
+      // SVE: to nxv4f32
+      {ISD::SINT_TO_FP, MVT::nxv4f32, MVT::nxv4i8, 5},
+      {ISD::SINT_TO_FP, MVT::nxv4f32, MVT::nxv4i16, 3},
+      {ISD::SINT_TO_FP, MVT::nxv4f32, MVT::nxv4i32, 1},
+      {ISD::UINT_TO_FP, MVT::nxv4f32, MVT::nxv4i8, 5},
+      {ISD::UINT_TO_FP, MVT::nxv4f32, MVT::nxv4i16, 3},
+      {ISD::SINT_TO_FP, MVT::nxv4f32, MVT::nxv4i32, 1},
+
       // Complex: to v8f32
       {ISD::SINT_TO_FP, MVT::v8f32, MVT::v8i8, 10},
       {ISD::SINT_TO_FP, MVT::v8f32, MVT::v8i16, 4},
@@ -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},
+      {ISD::SINT_TO_FP, MVT::nxv2f64, MVT::nxv2i64, 1},
+      {ISD::UINT_TO_FP, MVT::nxv2f64, MVT::nxv2i8, 7},
+      {ISD::UINT_TO_FP, MVT::nxv2f64, MVT::nxv2i16, 5},
+      {ISD::UINT_TO_FP, MVT::nxv2f64, MVT::nxv2i32, 3},
+      {ISD::UINT_TO_FP, MVT::nxv2f64, MVT::nxv2i64, 1},
+
       // Complex: to v4f64
       {ISD::SINT_TO_FP, MVT::v4f64, MVT::v4i32, 4},
       {ISD::UINT_TO_FP, MVT::v4f64, MVT::v4i32, 4},
@@ -3144,21 +3196,6 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
       {ISD::SIGN_EXTEND, MVT::nxv8i32, MVT::nxv8i16, 2},
       {ISD::SIGN_EXTEND, MVT::nxv8i64, MVT::nxv8i16, 6},
       {ISD::SIGN_EXTEND, MVT::nxv4i64, MVT::nxv4i32, 2},
-
-      // Add cost for extending and converting to illegal -too wide- scalable
-      // Extending one size (e.g. i32 -> f64) takes 2 unpacks and 2 fcvts, while
-      // extending twice (e.g. i16 -> f64) takes 6 unpacks and 4 fcvts.
-      {ISD::SINT_TO_FP, MVT::nxv16f16, MVT::nxv16i8, 12},
-      {ISD::SINT_TO_FP, MVT::nxv16f32, MVT::nxv16i8, 22},
-      {ISD::SINT_TO_FP, MVT::nxv8f32, MVT::nxv8i16, 12},
-      {ISD::SINT_TO_FP, MVT::nxv8f64, MVT::nxv8i16, 22},
-      {ISD::SINT_TO_FP, MVT::nxv4f64, MVT::nxv4i32, 12},
-
-      {ISD::UINT_TO_FP, MVT::nxv16f16, MVT::nxv16i8, 12},
-      {ISD::UINT_TO_FP, MVT::nxv16f32, MVT::nxv16i8, 22},
-      {ISD::UINT_TO_FP, MVT::nxv8f32, MVT::nxv8i16, 12},
-      {ISD::UINT_TO_FP, MVT::nxv8f64, MVT::nxv8i16, 22},
-      {ISD::UINT_TO_FP, MVT::nxv4f64, MVT::nxv4i32, 12},
   };
 
   // We have to estimate a cost of fixed length operation upon
diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-cast.ll b/llvm/test/Analysis/CostModel/AArch64/sve-cast.ll
index 0b051169a1b36..92e9fa8b19252 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-cast.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-cast.ll
@@ -903,82 +903,82 @@ define i32 @casts_no_users() {
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r169 = fptosi <16 x double> undef to <16 x i64>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r170 = uitofp <2 x i1> undef to <2 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r171 = sitofp <2 x i1> undef to <2 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r172 = uitofp <2 x i8> undef to <2 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r173 = sitofp <2 x i8> undef to <2 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r174 = uitofp <2 x i16> undef to <2 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r175 = sitofp <2 x i16> undef to <2 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r172 = uitofp <2 x i8> undef to <2 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r173 = sitofp <2 x i8> undef to <2 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r174 = uitofp <2 x i16> undef to <2 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r175 = sitofp <2 x i16> undef to <2 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r176 = uitofp <2 x i32> undef to <2 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r177 = sitofp <2 x i32> undef to <2 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r178 = uitofp <2 x i64> undef to <2 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r179 = sitofp <2 x i64> undef to <2 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r180 = uitofp <2 x i1> undef to <2 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r181 = sitofp <2 x i1> undef to <2 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r182 = uitofp <2 x i8> undef to <2 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r183 = sitofp <2 x i8> undef to <2 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r184 = uitofp <2 x i16> undef to <2 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r185 = sitofp <2 x i16> undef to <2 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r186 = uitofp <2 x i32> undef to <2 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r187 = sitofp <2 x i32> undef to <2 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r182 = uitofp <2 x i8> undef to <2 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r183 = sitofp <2 x i8> undef to <2 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r184 = uitofp <2 x i16> undef to <2 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r185 = sitofp <2 x i16> undef to <2 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r186 = uitofp <2 x i32> undef to <2 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r187 = sitofp <2 x i32> undef to <2 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r188 = uitofp <2 x i64> undef to <2 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r189 = sitofp <2 x i64> undef to <2 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r190 = uitofp <4 x i1> undef to <4 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r191 = sitofp <4 x i1> undef to <4 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r192 = uitofp <4 x i8> undef to <4 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r193 = sitofp <4 x i8> undef to <4 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r194 = uitofp <4 x i16> undef to <4 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r195 = sitofp <4 x i16> undef to <4 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r192 = uitofp <4 x i8> undef to <4 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r193 = sitofp <4 x i8> undef to <4 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r194 = uitofp <4 x i16> undef to <4 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r195 = sitofp <4 x i16> undef to <4 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r196 = uitofp <4 x i32> undef to <4 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r197 = sitofp <4 x i32> undef to <4 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r198 = uitofp <4 x i64> undef to <4 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r199 = sitofp <4 x i64> undef to <4 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r200 = uitofp <4 x i1> undef to <4 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r201 = sitofp <4 x i1> undef to <4 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r202 = uitofp <4 x i8> undef to <4 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r203 = sitofp <4 x i8> undef to <4 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r204 = uitofp <4 x i16> undef to <4 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r205 = sitofp <4 x i16> undef to <4 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r206 = uitofp <4 x i32> undef to <4 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r207 = sitofp <4 x i32> undef to <4 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %r202 = uitofp <4 x i8> undef to <4 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %r203 = sitofp <4 x i8> undef to <4 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r204 = uitofp <4 x i16> undef to <4 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r205 = sitofp <4 x i16> undef to <4 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r206 = uitofp <4 x i32> undef to <4 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r207 = sitofp <4 x i32> undef to <4 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r208 = uitofp <4 x i64> undef to <4 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r209 = sitofp <4 x i64> undef to <4 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r210 = uitofp <8 x i1> undef to <8 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r211 = sitofp <8 x i1> undef to <8 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r212 = uitofp <8 x i8> undef to <8 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r213 = sitofp <8 x i8> undef to <8 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r214 = uitofp <8 x i16> undef to <8 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r215 = sitofp <8 x i16> undef to <8 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r212 = uitofp <8 x i8> undef to <8 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r213 = sitofp <8 x i8> undef to <8 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r214 = uitofp <8 x i16> undef to <8 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r215 = sitofp <8 x i16> undef to <8 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r216 = uitofp <8 x i32> undef to <8 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r217 = sitofp <8 x i32> undef to <8 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r218 = uitofp <8 x i64> undef to <8 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r219 = sitofp <8 x i64> undef to <8 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r220 = uitofp <8 x i1> undef to <8 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r221 = sitofp <8 x i1> undef to <8 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r222 = uitofp <8 x i8> undef to <8 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r223 = sitofp <8 x i8> undef to <8 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r224 = uitofp <8 x i16> undef to <8 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r225 = sitofp <8 x i16> undef to <8 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r226 = uitofp <8 x i16> undef to <8 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r227 = sitofp <8 x i16> undef to <8 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %r222 = uitofp <8 x i8> undef to <8 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %r223 = sitofp <8 x i8> undef to <8 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r224 = uitofp <8 x i16> undef to <8 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r225 = sitofp <8 x i16> undef to <8 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r226 = uitofp <8 x i16> undef to <8 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r227 = sitofp <8 x i16> undef to <8 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r228 = uitofp <8 x i64> undef to <8 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r229 = sitofp <8 x i64> undef to <8 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r230 = uitofp <16 x i1> undef to <16 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r231 = sitofp <16 x i1> undef to <16 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r232 = uitofp <16 x i8> undef to <16 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r233 = sitofp <16 x i8> undef to <16 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r234 = uitofp <16 x i16> undef to <16 x float>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r235 = sitofp <16 x i16> undef to <16 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r232 = uitofp <16 x i8> undef to <16 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r233 = sitofp <16 x i8> undef to <16 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %r234 = uitofp <16 x i16> undef to <16 x float>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %r235 = sitofp <16 x i16> undef to <16 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r236 = uitofp <16 x i32> undef to <16 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r237 = sitofp <16 x i32> undef to <16 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r238 = uitofp <16 x i64> undef to <16 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r239 = sitofp <16 x i64> undef to <16 x float>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r240 = uitofp <16 x i1> undef to <16 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r241 = sitofp <16 x i1> undef to <16 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r242 = uitofp <16 x i8> undef to <16 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r243 = sitofp <16 x i8> undef to <16 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r244 = uitofp <16 x i16> undef to <16 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r245 = sitofp <16 x i16> undef to <16 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r246 = uitofp <16 x i16> undef to <16 x double>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r247 = sitofp <16 x i16> undef to <16 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 56 for instruction: %r242 = uitofp <16 x i8> undef to <16 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 56 for instruction: %r243 = sitofp <16 x i8> undef to <16 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %r244 = uitofp <16 x i16> undef to <16 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %r245 = sitofp <16 x i16> undef to <16 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %r246 = uitofp <16 x i16> undef to <16 x double>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %r247 = sitofp <16 x i16> undef to <16 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r248 = uitofp <16 x i64> undef to <16 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r249 = sitofp <16 x i64> undef to <16 x double>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
@@ -1146,52 +1146,52 @@ define i32 @casts_no_users() {
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r199 = sitofp <4 x i64> undef to <4 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r200 = uitofp <4 x i1> undef to <4 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r201 = sitofp <4 x i1> undef to <4 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r202 = uitofp <4 x i8> undef to <4 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r203 = sitofp <4 x i8> undef to <4 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r204 = uitofp <4 x i16> undef to <4 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r205 = sitofp <4 x i16> undef to <4 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r206 = uitofp <4 x i32> undef to <4 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r207 = sitofp <4 x i32> undef to <4 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r202 = uitofp <4 x i8> undef to <4 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r203 = sitofp <4 x i8> undef to <4 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r204 = uitofp <4 x i16> undef to <4 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r205 = sitofp <4 x i16> undef to <4 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r206 = uitofp <4 x i32> undef to <4 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r207 = sitofp <4 x i32> undef to <4 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r208 = uitofp <4 x i64> undef to <4 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r209 = sitofp <4 x i64> undef to <4 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r210 = uitofp <8 x i1> undef to <8 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r211 = sitofp <8 x i1> undef to <8 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r212 = uitofp <8 x i8> undef to <8 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r213 = sitofp <8 x i8> undef to <8 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r214 = uitofp <8 x i16> undef to <8 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r215 = sitofp <8 x i16> undef to <8 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r212 = uitofp <8 x i8> undef to <8 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r213 = sitofp <8 x i8> undef to <8 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r214 = uitofp <8 x i16> undef to <8 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r215 = sitofp <8 x i16> undef to <8 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r216 = uitofp <8 x i32> undef to <8 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r217 = sitofp <8 x i32> undef to <8 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r218 = uitofp <8 x i64> undef to <8 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r219 = sitofp <8 x i64> undef to <8 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r220 = uitofp <8 x i1> undef to <8 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r221 = sitofp <8 x i1> undef to <8 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r222 = uitofp <8 x i8> undef to <8 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r223 = sitofp <8 x i8> undef to <8 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r224 = uitofp <8 x i16> undef to <8 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r225 = sitofp <8 x i16> undef to <8 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r226 = uitofp <8 x i16> undef to <8 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r227 = sitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %r222 = uitofp <8 x i8> undef to <8 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %r223 = sitofp <8 x i8> undef to <8 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r224 = uitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r225 = sitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r226 = uitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r227 = sitofp <8 x i16> undef to <8 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r228 = uitofp <8 x i64> undef to <8 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r229 = sitofp <8 x i64> undef to <8 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r230 = uitofp <16 x i1> undef to <16 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r231 = sitofp <16 x i1> undef to <16 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r232 = uitofp <16 x i8> undef to <16 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r233 = sitofp <16 x i8> undef to <16 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r234 = uitofp <16 x i16> undef to <16 x float>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r235 = sitofp <16 x i16> undef to <16 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r232 = uitofp <16 x i8> undef to <16 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %r233 = sitofp <16 x i8> undef to <16 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r234 = uitofp <16 x i16> undef to <16 x float>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r235 = sitofp <16 x i16> undef to <16 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r236 = uitofp <16 x i32> undef to <16 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r237 = sitofp <16 x i32> undef to <16 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r238 = uitofp <16 x i64> undef to <16 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r239 = sitofp <16 x i64> undef to <16 x float>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r240 = uitofp <16 x i1> undef to <16 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r241 = sitofp <16 x i1> undef to <16 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r242 = uitofp <16 x i8> undef to <16 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r243 = sitofp <16 x i8> undef to <16 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r244 = uitofp <16 x i16> undef to <16 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r245 = sitofp <16 x i16> undef to <16 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r246 = uitofp <16 x i16> undef to <16 x double>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r247 = sitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %r242 = uitofp <16 x i8> undef to <16 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %r243 = sitofp <16 x i8> undef to <16 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r244 = uitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r245 = sitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r246 = uitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %r247 = sitofp <16 x i16> undef to <16 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r248 = uitofp <16 x i64> undef to <16 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r249 = sitofp <16 x i64> undef to <16 x double>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
@@ -1359,52 +1359,52 @@ define i32 @casts_no_users() {
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r199 = sitofp <4 x i64> undef to <4 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r200 = uitofp <4 x i1> undef to <4 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r201 = sitofp <4 x i1> undef to <4 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r202 = uitofp <4 x i8> undef to <4 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r203 = sitofp <4 x i8> undef to <4 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r204 = uitofp <4 x i16> undef to <4 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r205 = sitofp <4 x i16> undef to <4 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r206 = uitofp <4 x i32> undef to <4 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r207 = sitofp <4 x i32> undef to <4 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r202 = uitofp <4 x i8> undef to <4 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r203 = sitofp <4 x i8> undef to <4 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r204 = uitofp <4 x i16> undef to <4 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r205 = sitofp <4 x i16> undef to <4 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r206 = uitofp <4 x i32> undef to <4 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r207 = sitofp <4 x i32> undef to <4 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r208 = uitofp <4 x i64> undef to <4 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r209 = sitofp <4 x i64> undef to <4 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r210 = uitofp <8 x i1> undef to <8 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r211 = sitofp <8 x i1> undef to <8 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r212 = uitofp <8 x i8> undef to <8 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r213 = sitofp <8 x i8> undef to <8 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r214 = uitofp <8 x i16> undef to <8 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r215 = sitofp <8 x i16> undef to <8 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r212 = uitofp <8 x i8> undef to <8 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r213 = sitofp <8 x i8> undef to <8 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r214 = uitofp <8 x i16> undef to <8 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r215 = sitofp <8 x i16> undef to <8 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r216 = uitofp <8 x i32> undef to <8 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r217 = sitofp <8 x i32> undef to <8 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r218 = uitofp <8 x i64> undef to <8 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r219 = sitofp <8 x i64> undef to <8 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r220 = uitofp <8 x i1> undef to <8 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r221 = sitofp <8 x i1> undef to <8 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r222 = uitofp <8 x i8> undef to <8 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r223 = sitofp <8 x i8> undef to <8 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r224 = uitofp <8 x i16> undef to <8 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r225 = sitofp <8 x i16> undef to <8 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r226 = uitofp <8 x i16> undef to <8 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r227 = sitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r222 = uitofp <8 x i8> undef to <8 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r223 = sitofp <8 x i8> undef to <8 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r224 = uitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r225 = sitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r226 = uitofp <8 x i16> undef to <8 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r227 = sitofp <8 x i16> undef to <8 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r228 = uitofp <8 x i64> undef to <8 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r229 = sitofp <8 x i64> undef to <8 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r230 = uitofp <16 x i1> undef to <16 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r231 = sitofp <16 x i1> undef to <16 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r232 = uitofp <16 x i8> undef to <16 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r233 = sitofp <16 x i8> undef to <16 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r234 = uitofp <16 x i16> undef to <16 x float>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r235 = sitofp <16 x i16> undef to <16 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r232 = uitofp <16 x i8> undef to <16 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r233 = sitofp <16 x i8> undef to <16 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r234 = uitofp <16 x i16> undef to <16 x float>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r235 = sitofp <16 x i16> undef to <16 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r236 = uitofp <16 x i32> undef to <16 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r237 = sitofp <16 x i32> undef to <16 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r238 = uitofp <16 x i64> undef to <16 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r239 = sitofp <16 x i64> undef to <16 x float>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r240 = uitofp <16 x i1> undef to <16 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r241 = sitofp <16 x i1> undef to <16 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r242 = uitofp <16 x i8> undef to <16 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r243 = sitofp <16 x i8> undef to <16 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r244 = uitofp <16 x i16> undef to <16 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r245 = sitofp <16 x i16> undef to <16 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r246 = uitofp <16 x i16> undef to <16 x double>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r247 = sitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r242 = uitofp <16 x i8> undef to <16 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %r243 = sitofp <16 x i8> undef to <16 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r244 = uitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r245 = sitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r246 = uitofp <16 x i16> undef to <16 x double>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %r247 = sitofp <16 x i16> undef to <16 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r248 = uitofp <16 x i64> undef to <16 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r249 = sitofp <16 x i64> undef to <16 x double>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
@@ -2209,8 +2209,8 @@ define void @fp16cast() {
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %r159 = fptosi <16 x half> undef to <16 x i64>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r250 = uitofp <8 x i1> undef to <8 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r251 = sitofp <8 x i1> undef to <8 x half>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r252 = uitofp <8 x i8> undef to <8 x half>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r253 = sitofp <8 x i8> undef to <8 x half>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r252 = uitofp <8 x i8> undef to <8 x half>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r253 = sitofp <8 x i8> undef to <8 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r254 = uitofp <8 x i16> undef to <8 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r255 = sitofp <8 x i16> undef to <8 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r256 = uitofp <8 x i32> undef to <8 x half>
@@ -2219,8 +2219,8 @@ define void @fp16cast() {
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r259 = sitofp <8 x i64> undef to <8 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r260 = uitofp <16 x i1> undef to <16 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r261 = sitofp <16 x i1> undef to <16 x half>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
-; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
+; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r264 = uitofp <16 x i16> undef to <16 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r265 = sitofp <16 x i16> undef to <16 x half>
 ; SVE128-NO-NEON-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r266 = uitofp <16 x i32> undef to <16 x half>
@@ -2292,8 +2292,8 @@ define void @fp16cast() {
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r259 = sitofp <8 x i64> undef to <8 x half>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r260 = uitofp <16 x i1> undef to <16 x half>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r261 = sitofp <16 x i1> undef to <16 x half>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
-; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
+; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r264 = uitofp <16 x i16> undef to <16 x half>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r265 = sitofp <16 x i16> undef to <16 x half>
 ; FIXED-MIN-256-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %r266 = uitofp <16 x i32> undef to <16 x half>
@@ -2365,8 +2365,8 @@ define void @fp16cast() {
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r259 = sitofp <8 x i64> undef to <8 x half>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r260 = uitofp <16 x i1> undef to <16 x half>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r261 = sitofp <16 x i1> undef to <16 x half>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
-; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
+; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r264 = uitofp <16 x i16> undef to <16 x half>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r265 = sitofp <16 x i16> undef to <16 x half>
 ; FIXED-MIN-2048-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r266 = uitofp <16 x i32> undef to <16 x half>
diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll
index 12fd6411255f2..6b124a3537d64 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-itofp.ll
@@ -6,156 +6,105 @@ target triple = "aarch64-unknown-linux-gnu"
 
 define void @sve-itofp() {
 ; CHECK-LABEL: 'sve-itofp'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si8_to_f16 = sitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui8_to_f16 = uitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si16_to_f16 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui16_to_f16 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si32_to_f16 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui32_to_f16 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si64_to_f16 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui64_to_f16 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si8_to_f32 = sitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui8_to_f32 = uitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si16_to_f32 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui16_to_f32 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si32_to_f32 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui32_to_f32 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si64_to_f32 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui64_to_f32 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si8_to_f64 = sitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui8_to_f64 = uitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si16_to_f64 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui16_to_f64 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si32_to_f64 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui32_to_f64 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1si64_to_f64 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv1ui64_to_f64 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si8_to_f16 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui8_to_f16 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv2si8_to_f16 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv2ui8_to_f16 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si16_to_f16 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui16_to_f16 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si32_to_f16 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui32_to_f16 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si64_to_f16 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui64_to_f16 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si8_to_f32 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui8_to_f32 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si16_to_f32 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui16_to_f32 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %nv2si8_to_f32 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %nv2ui8_to_f32 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv2si16_to_f32 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv2ui16_to_f32 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si32_to_f32 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui32_to_f32 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si64_to_f32 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui64_to_f32 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si8_to_f64 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui8_to_f64 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si16_to_f64 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui16_to_f64 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si32_to_f64 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui32_to_f64 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv2si8_to_f64 = sitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv2ui8_to_f64 = uitofp <vscale x 2 x i8> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %nv2si16_to_f64 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %nv2ui16_to_f64 = uitofp <vscale x 2 x i16> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv2si32_to_f64 = sitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv2ui32_to_f64 = uitofp <vscale x 2 x i32> undef to <vscale x 2 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2si64_to_f64 = sitofp <vscale x 2 x i64> undef to <vscale x 2 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv2ui64_to_f64 = uitofp <vscale x 2 x i64> undef to <vscale x 2 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si8_to_f16 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui8_to_f16 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si8_to_f16 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui8_to_f16 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si16_to_f16 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui16_to_f16 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si32_to_f16 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui32_to_f16 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si64_to_f16 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui64_to_f16 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si8_to_f32 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui8_to_f32 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si16_to_f32 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui16_to_f32 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %nv4si8_to_f32 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %nv4ui8_to_f32 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si16_to_f32 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui16_to_f32 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4si32_to_f32 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv4ui32_to_f32 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si64_to_f32 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui64_to_f32 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si8_to_f64 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui8_to_f64 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4si16_to_f64 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv4ui16_to_f64 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv4si32_to_f64 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv4ui32_to_f64 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %nv4si8_to_f64 = sitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %nv4ui8_to_f64 = uitofp <vscale x 4 x i8> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %nv4si16_to_f64 = sitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %nv4ui16_to_f64 = uitofp <vscale x 4 x i16> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv4si32_to_f64 = sitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv4ui32_to_f64 = uitofp <vscale x 4 x i32> undef to <vscale x 4 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv4si64_to_f64 = sitofp <vscale x 4 x i64> undef to <vscale x 4 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv4ui64_to_f64 = uitofp <vscale x 4 x i64> undef to <vscale x 4 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8si8_to_f16 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8ui8_to_f16 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8si8_to_f16 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8ui8_to_f16 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8si16_to_f16 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %nv8ui16_to_f16 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8si32_to_f16 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8ui32_to_f16 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8si64_to_f16 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8ui64_to_f16 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8si8_to_f32 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %nv8ui8_to_f32 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv8si16_to_f32 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv8ui16_to_f32 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %nv8si8_to_f32 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %nv8ui8_to_f32 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8si16_to_f32 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8ui16_to_f32 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv8si32_to_f32 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv8ui32_to_f32 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv8si64_to_f32 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv8ui64_to_f32 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8si8_to_f64 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv8ui8_to_f64 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv8si16_to_f64 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv8ui16_to_f64 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv8si32_to_f64 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv8ui32_to_f64 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 31 for instruction: %nv8si8_to_f64 = sitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 31 for instruction: %nv8ui8_to_f64 = uitofp <vscale x 8 x i8> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 23 for instruction: %nv8si16_to_f64 = sitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 23 for instruction: %nv8ui16_to_f64 = uitofp <vscale x 8 x i16> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv8si32_to_f64 = sitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv8ui32_to_f64 = uitofp <vscale x 8 x i32> undef to <vscale x 8 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv8si64_to_f64 = sitofp <vscale x 8 x i64> undef to <vscale x 8 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv8ui64_to_f64 = uitofp <vscale x 8 x i64> undef to <vscale x 8 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16si8_to_f16 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16ui8_to_f16 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv16si8_to_f16 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %nv16ui8_to_f16 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv16si16_to_f16 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %nv16ui16_to_f16 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv16si32_to_f16 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %nv16ui32_to_f16 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv16si64_to_f16 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x half>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv16ui64_to_f16 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x half>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv16si8_to_f32 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %nv16ui8_to_f32 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv16si16_to_f32 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %nv16ui16_to_f32 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 23 for instruction: %nv16si8_to_f32 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 23 for instruction: %nv16ui8_to_f32 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv16si16_to_f32 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %nv16ui16_to_f32 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv16si32_to_f32 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %nv16ui32_to_f32 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16si64_to_f32 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x float>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %nv16ui64_to_f32 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x float>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %nv16si8_to_f64 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %nv16ui8_to_f64 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 44 for instruction: %nv16si16_to_f64 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 44 for instruction: %nv16ui16_to_f64 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %nv16si32_to_f64 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %nv16ui32_to_f64 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 63 for instruction: %nv16si8_to_f64 = sitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 63 for instruction: %nv16ui8_to_f64 = uitofp <vscale x 16 x i8> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 46 for instruction: %nv16si16_to_f64 = sitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 46 for instruction: %nv16ui16_to_f64 = uitofp <vscale x 16 x i16> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %nv16si32_to_f64 = sitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %nv16ui32_to_f64 = uitofp <vscale x 16 x i32> undef to <vscale x 16 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %nv16si64_to_f64 = sitofp <vscale x 16 x i64> undef to <vscale x 16 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %nv16ui64_to_f64 = uitofp <vscale x 16 x i64> undef to <vscale x 16 x double>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
 ;
 
-  %nv1si8_to_f16  = sitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
-  %nv1ui8_to_f16  = uitofp <vscale x 1 x i8> undef to <vscale x 1 x half>
-  %nv1si16_to_f16 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
-  %nv1ui16_to_f16 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x half>
-  %nv1si32_to_f16 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
-  %nv1ui32_to_f16 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x half>
-  %nv1si64_to_f16 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
-  %nv1ui64_to_f16 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x half>
-
-  %nv1si8_to_f32  = sitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
-  %nv1ui8_to_f32  = uitofp <vscale x 1 x i8> undef to <vscale x 1 x float>
-  %nv1si16_to_f32 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
-  %nv1ui16_to_f32 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x float>
-  %nv1si32_to_f32 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
-  %nv1ui32_to_f32 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x float>
-  %nv1si64_to_f32 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
-  %nv1ui64_to_f32 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x float>
-
-  %nv1si8_to_f64  = sitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
-  %nv1ui8_to_f64  = uitofp <vscale x 1 x i8> undef to <vscale x 1 x double>
-  %nv1si16_to_f64 = sitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
-  %nv1ui16_to_f64 = uitofp <vscale x 1 x i16> undef to <vscale x 1 x double>
-  %nv1si32_to_f64 = sitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
-  %nv1ui32_to_f64 = uitofp <vscale x 1 x i32> undef to <vscale x 1 x double>
-  %nv1si64_to_f64 = sitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
-  %nv1ui64_to_f64 = uitofp <vscale x 1 x i64> undef to <vscale x 1 x double>
-
   %nv2si8_to_f16  = sitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
   %nv2ui8_to_f16  = uitofp <vscale x 2 x i8> undef to <vscale x 2 x half>
   %nv2si16_to_f16 = sitofp <vscale x 2 x i16> undef to <vscale x 2 x half>



More information about the llvm-commits mailing list