[llvm] [NFC][AMDGPU] Add cost tests for integer to/from floating point casts (PR #223571)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 02:33:21 PDT 2026
https://github.com/MrSidims updated https://github.com/llvm/llvm-project/pull/223571
>From 43930259b9b07de34d5995c1d7a9d496043b2700 Mon Sep 17 00:00:00 2001
From: Dmitry Sidorov <Dmitry.Sidorov at amd.com>
Date: Tue, 15 Sep 2026 00:14:53 +0200
Subject: [PATCH 1/2] [NFC][AMDGPU] Add cost tests for integer to/from floating
point casts
Cover i48, i64, i128, bf16, fp128 and narrow vector lanes across FP64
rates, 16 bit instructions, sdwa and both cost kinds.
Assisted-by: Claude Code Opus 5
---
llvm/test/Analysis/CostModel/AMDGPU/cast.ll | 289 +++++++++++++++++-
.../CostModel/AMDGPU/expanded-int-fp-casts.ll | 286 +++++++++++++++++
llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll | 42 ++-
llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll | 42 ++-
4 files changed, 639 insertions(+), 20 deletions(-)
create mode 100644 llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/cast.ll b/llvm/test/Analysis/CostModel/AMDGPU/cast.ll
index 934d99b5a012b1..aab8fbe6f5e4d5 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/cast.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/cast.ll
@@ -1,13 +1,15 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,SLOW %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu11.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,QUARTER64,NOSDWA %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64,FAST-QUARTER64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,FULL64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64,FAST-QUARTER64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,QUARTER64,SLOW %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,SLOW-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu11.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,QUARTER64-SIZE,NOSDWA-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE,FAST-QUARTER64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,FULL64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE,FAST-QUARTER64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,QUARTER64-SIZE,SLOW-SIZE %s
; END.
define i32 @add(i32 %arg) {
@@ -51,6 +53,36 @@ define i32 @add(i32 %arg) {
}
define i32 @zext_sext(<8 x i1> %in) {
+; NOSDWA-LABEL: 'zext_sext'
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %S = sext <8 x i1> %in to <8 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %A1 = zext <16 x i8> poison to <16 x i16>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %A2 = sext <16 x i8> poison to <16 x i16>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %A = sext <8 x i16> poison to <8 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %B = zext <8 x i16> poison to <8 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C = sext <4 x i32> poison to <4 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %C.v8i8.z = zext <8 x i8> poison to <8 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %C.v8i8.s = sext <8 x i8> poison to <8 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %C.v4i16.z = zext <4 x i16> poison to <4 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C.v4i16.s = sext <4 x i16> poison to <4 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %C.v4i8.z = zext <4 x i8> poison to <4 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C.v4i8.s = sext <4 x i8> poison to <4 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D = zext <4 x i32> poison to <4 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D1 = zext <8 x i32> poison to <8 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %D2 = sext <8 x i32> poison to <8 x i64>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D3 = zext <16 x i16> poison to <16 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D4 = zext <16 x i8> poison to <16 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %D5 = zext <16 x i1> poison to <16 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %E = trunc <4 x i64> poison to <4 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F = trunc <8 x i32> poison to <8 x i16>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F1 = trunc <16 x i16> poison to <16 x i8>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F2 = trunc <8 x i32> poison to <8 x i8>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F3 = trunc <4 x i64> poison to <4 x i8>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %G = trunc <8 x i64> poison to <8 x i32>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %G1 = trunc <16 x i32> poison to <16 x i16>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %G2 = trunc <16 x i32> poison to <16 x i8>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
+;
; FAST-LABEL: 'zext_sext'
; FAST-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
; FAST-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %S = sext <8 x i1> %in to <8 x i32>
@@ -111,6 +143,36 @@ define i32 @zext_sext(<8 x i1> %in) {
; SLOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %G2 = trunc <16 x i32> poison to <16 x i8>
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
+; NOSDWA-SIZE-LABEL: 'zext_sext'
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %S = sext <8 x i1> %in to <8 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %A1 = zext <16 x i8> poison to <16 x i16>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %A2 = sext <16 x i8> poison to <16 x i16>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %A = sext <8 x i16> poison to <8 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %B = zext <8 x i16> poison to <8 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C = sext <4 x i32> poison to <4 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %C.v8i8.z = zext <8 x i8> poison to <8 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %C.v8i8.s = sext <8 x i8> poison to <8 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %C.v4i16.z = zext <4 x i16> poison to <4 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C.v4i16.s = sext <4 x i16> poison to <4 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %C.v4i8.z = zext <4 x i8> poison to <4 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C.v4i8.s = sext <4 x i8> poison to <4 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D = zext <4 x i32> poison to <4 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D1 = zext <8 x i32> poison to <8 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %D2 = sext <8 x i32> poison to <8 x i64>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D3 = zext <16 x i16> poison to <16 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %D4 = zext <16 x i8> poison to <16 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %D5 = zext <16 x i1> poison to <16 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %E = trunc <4 x i64> poison to <4 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F = trunc <8 x i32> poison to <8 x i16>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F1 = trunc <16 x i16> poison to <16 x i8>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F2 = trunc <8 x i32> poison to <8 x i8>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %F3 = trunc <4 x i64> poison to <4 x i8>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %G = trunc <8 x i64> poison to <8 x i32>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %G1 = trunc <16 x i32> poison to <16 x i16>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %G2 = trunc <16 x i32> poison to <16 x i8>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 poison
+;
; FAST-SIZE-LABEL: 'zext_sext'
; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %S = sext <8 x i1> %in to <8 x i32>
@@ -243,6 +305,17 @@ define i32 @masks4(<4 x i1> %in) {
}
define void @sitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
+; NOSDWA-LABEL: 'sitofp4'
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = sitofp <4 x i8> %b to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B2 = sitofp <4 x i8> %b to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %C1 = sitofp <4 x i16> %c to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C2 = sitofp <4 x i16> %c to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <4 x i32> %d to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
; FAST-LABEL: 'sitofp4'
; FAST-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
; FAST-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
@@ -265,6 +338,17 @@ define void @sitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
; SLOW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
+; NOSDWA-SIZE-LABEL: 'sitofp4'
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = sitofp <4 x i8> %b to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B2 = sitofp <4 x i8> %b to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %C1 = sitofp <4 x i16> %c to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C2 = sitofp <4 x i16> %c to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <4 x i32> %d to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
; FAST-SIZE-LABEL: 'sitofp4'
; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
@@ -321,6 +405,17 @@ define void @sitofp8(<8 x i1> %a, <8 x i8> %b, <8 x i16> %c, <8 x i32> %d) {
}
define void @uitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
+; NOSDWA-LABEL: 'uitofp4'
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = uitofp <4 x i8> %b to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B2 = uitofp <4 x i8> %b to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %C1 = uitofp <4 x i16> %c to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C2 = uitofp <4 x i16> %c to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %D1 = uitofp <4 x i32> %d to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
; FAST-LABEL: 'uitofp4'
; FAST-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
; FAST-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
@@ -343,6 +438,17 @@ define void @uitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
; SLOW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
+; NOSDWA-SIZE-LABEL: 'uitofp4'
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = uitofp <4 x i8> %b to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B2 = uitofp <4 x i8> %b to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %C1 = uitofp <4 x i16> %c to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %C2 = uitofp <4 x i16> %c to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %D1 = uitofp <4 x i32> %d to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
; FAST-SIZE-LABEL: 'uitofp4'
; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
@@ -398,6 +504,166 @@ define void @uitofp8(<8 x i1> %a, <8 x i8> %b, <8 x i16> %c, <8 x i32> %d) {
ret void
}
+define void @sitofp16(<16 x i8> %b, <16 x i16> %c) {
+; ALL-LABEL: 'sitofp16'
+; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %B1 = sitofp <16 x i8> %b to <16 x float>
+; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %C1 = sitofp <16 x i16> %c to <16 x float>
+; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'sitofp16'
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %B1 = sitofp <16 x i8> %b to <16 x float>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %C1 = sitofp <16 x i16> %c to <16 x float>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+ %B1 = sitofp <16 x i8> %b to <16 x float>
+ %C1 = sitofp <16 x i16> %c to <16 x float>
+ ret void
+}
+
+define void @uitofp16(<16 x i8> %b, <16 x i16> %c) {
+; ALL-LABEL: 'uitofp16'
+; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %B1 = uitofp <16 x i8> %b to <16 x float>
+; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %C1 = uitofp <16 x i16> %c to <16 x float>
+; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'uitofp16'
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %B1 = uitofp <16 x i8> %b to <16 x float>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %C1 = uitofp <16 x i16> %c to <16 x float>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+ %B1 = uitofp <16 x i8> %b to <16 x float>
+ %C1 = uitofp <16 x i16> %c to <16 x float>
+ ret void
+}
+
+define void @sitofp_i64(i64 %a, <4 x i64> %b) {
+; NOSDWA-LABEL: 'sitofp_i64'
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = sitofp i64 %a to half
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = sitofp i64 %a to float
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = sitofp i64 %a to double
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = sitofp <4 x i64> %b to <4 x half>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = sitofp <4 x i64> %b to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = sitofp <4 x i64> %b to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; FAST-LABEL: 'sitofp_i64'
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = sitofp i64 %a to half
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = sitofp i64 %a to float
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = sitofp i64 %a to double
+; FAST-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = sitofp <4 x i64> %b to <4 x half>
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = sitofp <4 x i64> %b to <4 x float>
+; FAST-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = sitofp <4 x i64> %b to <4 x double>
+; FAST-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; SLOW-LABEL: 'sitofp_i64'
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = sitofp i64 %a to half
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = sitofp i64 %a to float
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = sitofp i64 %a to double
+; SLOW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = sitofp <4 x i64> %b to <4 x half>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = sitofp <4 x i64> %b to <4 x float>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = sitofp <4 x i64> %b to <4 x double>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; NOSDWA-SIZE-LABEL: 'sitofp_i64'
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = sitofp i64 %a to half
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = sitofp i64 %a to float
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = sitofp i64 %a to double
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = sitofp <4 x i64> %b to <4 x half>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = sitofp <4 x i64> %b to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = sitofp <4 x i64> %b to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+; FAST-SIZE-LABEL: 'sitofp_i64'
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = sitofp i64 %a to half
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = sitofp i64 %a to float
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = sitofp i64 %a to double
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = sitofp <4 x i64> %b to <4 x half>
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = sitofp <4 x i64> %b to <4 x float>
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = sitofp <4 x i64> %b to <4 x double>
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+; SLOW-SIZE-LABEL: 'sitofp_i64'
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = sitofp i64 %a to half
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = sitofp i64 %a to float
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = sitofp i64 %a to double
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = sitofp <4 x i64> %b to <4 x half>
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = sitofp <4 x i64> %b to <4 x float>
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = sitofp <4 x i64> %b to <4 x double>
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+ %A1 = sitofp i64 %a to half
+ %A2 = sitofp i64 %a to float
+ %A3 = sitofp i64 %a to double
+ %B1 = sitofp <4 x i64> %b to <4 x half>
+ %B2 = sitofp <4 x i64> %b to <4 x float>
+ %B3 = sitofp <4 x i64> %b to <4 x double>
+ ret void
+}
+
+define void @uitofp_i64(i64 %a, <4 x i64> %b) {
+; NOSDWA-LABEL: 'uitofp_i64'
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = uitofp i64 %a to half
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = uitofp i64 %a to float
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = uitofp i64 %a to double
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = uitofp <4 x i64> %b to <4 x half>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = uitofp <4 x i64> %b to <4 x float>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = uitofp <4 x i64> %b to <4 x double>
+; NOSDWA-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; FAST-LABEL: 'uitofp_i64'
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = uitofp i64 %a to half
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = uitofp i64 %a to float
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = uitofp i64 %a to double
+; FAST-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = uitofp <4 x i64> %b to <4 x half>
+; FAST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = uitofp <4 x i64> %b to <4 x float>
+; FAST-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = uitofp <4 x i64> %b to <4 x double>
+; FAST-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; SLOW-LABEL: 'uitofp_i64'
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = uitofp i64 %a to half
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = uitofp i64 %a to float
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = uitofp i64 %a to double
+; SLOW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = uitofp <4 x i64> %b to <4 x half>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = uitofp <4 x i64> %b to <4 x float>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = uitofp <4 x i64> %b to <4 x double>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; NOSDWA-SIZE-LABEL: 'uitofp_i64'
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = uitofp i64 %a to half
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = uitofp i64 %a to float
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = uitofp i64 %a to double
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = uitofp <4 x i64> %b to <4 x half>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = uitofp <4 x i64> %b to <4 x float>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = uitofp <4 x i64> %b to <4 x double>
+; NOSDWA-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+; FAST-SIZE-LABEL: 'uitofp_i64'
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = uitofp i64 %a to half
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = uitofp i64 %a to float
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = uitofp i64 %a to double
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %B1 = uitofp <4 x i64> %b to <4 x half>
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = uitofp <4 x i64> %b to <4 x float>
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = uitofp <4 x i64> %b to <4 x double>
+; FAST-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+; SLOW-SIZE-LABEL: 'uitofp_i64'
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = uitofp i64 %a to half
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = uitofp i64 %a to float
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A3 = uitofp i64 %a to double
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B1 = uitofp <4 x i64> %b to <4 x half>
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %B2 = uitofp <4 x i64> %b to <4 x float>
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %B3 = uitofp <4 x i64> %b to <4 x double>
+; SLOW-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+ %A1 = uitofp i64 %a to half
+ %A2 = uitofp i64 %a to float
+ %A3 = uitofp i64 %a to double
+ %B1 = uitofp <4 x i64> %b to <4 x half>
+ %B2 = uitofp <4 x i64> %b to <4 x float>
+ %B3 = uitofp <4 x i64> %b to <4 x double>
+ ret void
+}
+
define void @fp_conv(<8 x float> %a, <16 x float>%b, <4 x float> %c) {
; ALL-LABEL: 'fp_conv'
; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A1 = fpext <4 x float> %c to <4 x double>
@@ -419,3 +685,10 @@ define void @fp_conv(<8 x float> %a, <16 x float>%b, <4 x float> %c) {
%A4 = fptrunc <8 x double> poison to <8 x float>
ret void
}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; FAST-QUARTER64: {{.*}}
+; FAST-QUARTER64-SIZE: {{.*}}
+; FULL64: {{.*}}
+; FULL64-SIZE: {{.*}}
+; QUARTER64: {{.*}}
+; QUARTER64-SIZE: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll b/llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll
new file mode 100644
index 00000000000000..b495729859cbea
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll
@@ -0,0 +1,286 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --filter "instruction:.*(sitofp|uitofp|fptosi|fptoui)"
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu6.01-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX6-THROUGHPUT
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu7.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX7
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu8.03-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX8
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX9
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.00-amd-amdhsa -mattr=-gfx9-insts < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX8
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.06-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF,GFX9
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.42-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,GFX9
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,NATIVE-SDWA
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu11.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX11
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu11.00-amd-amdhsa -mattr=-16-bit-insts < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX7
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu12.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,NATIVE-NOSDWA
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu6.01-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX6-SIZE
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF,GFX9
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.42-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,GFX9
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,NATIVE-SDWA
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu12.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF,NATIVE-NOSDWA
+
+; Half fits in i32. Bfloat must extend to f32 and use the full i64 expansion.
+define void @bf16_to_i64(bfloat %a, <2 x bfloat> %b, half %h) {
+; ALL-LABEL: 'bf16_to_i64'
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %s = fptosi bfloat %a to i64
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %u = fptoui bfloat %a to i64
+; ALL: Cost Model: Found an estimated cost of 2 for instruction: %vs = fptosi <2 x bfloat> %b to <2 x i64>
+; ALL: Cost Model: Found an estimated cost of 2 for instruction: %vu = fptoui <2 x bfloat> %b to <2 x i64>
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %hs = fptosi half %h to i64
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %hu = fptoui half %h to i64
+;
+ %s = fptosi bfloat %a to i64
+ %u = fptoui bfloat %a to i64
+ %vs = fptosi <2 x bfloat> %b to <2 x i64>
+ %vu = fptoui <2 x bfloat> %b to <2 x i64>
+ %hs = fptosi half %h to i64
+ %hu = fptoui half %h to i64
+ ret void
+}
+
+; Conversion to bf16 goes through f32 and rounds the result when there are
+; 16 bit instructions. Native rounding packs pairs, including the final
+; unpaired element of an odd-sized vector.
+define void @i64_to_bf16(i64 %a, <2 x i64> %b, <3 x i64> %c, i48 %d) {
+; GFX6-LABEL: 'i64_to_bf16'
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i64 %a to bfloat
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i64 %a to bfloat
+; GFX6: Cost Model: Found an estimated cost of 2 for instruction: %vs = sitofp <2 x i64> %b to <2 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 2 for instruction: %vu = uitofp <2 x i64> %b to <2 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 9 for instruction: %v3s = sitofp <3 x i64> %c to <3 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 9 for instruction: %v3u = uitofp <3 x i64> %c to <3 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %s48 = sitofp i48 %d to bfloat
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %u48 = uitofp i48 %d to bfloat
+;
+; GFX9-THROUGHPUT-LABEL: 'i64_to_bf16'
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i64 %a to bfloat
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i64 %a to bfloat
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 4 for instruction: %vs = sitofp <2 x i64> %b to <2 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 4 for instruction: %vu = uitofp <2 x i64> %b to <2 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 7 for instruction: %v3s = sitofp <3 x i64> %c to <3 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 7 for instruction: %v3u = uitofp <3 x i64> %c to <3 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %s48 = sitofp i48 %d to bfloat
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %u48 = uitofp i48 %d to bfloat
+;
+; HALF-LABEL: 'i64_to_bf16'
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i64 %a to bfloat
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i64 %a to bfloat
+; HALF: Cost Model: Found an estimated cost of 4 for instruction: %vs = sitofp <2 x i64> %b to <2 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 4 for instruction: %vu = uitofp <2 x i64> %b to <2 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 7 for instruction: %v3s = sitofp <3 x i64> %c to <3 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 7 for instruction: %v3u = uitofp <3 x i64> %c to <3 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %s48 = sitofp i48 %d to bfloat
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %u48 = uitofp i48 %d to bfloat
+;
+; FULL-LABEL: 'i64_to_bf16'
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i64 %a to bfloat
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i64 %a to bfloat
+; FULL: Cost Model: Found an estimated cost of 4 for instruction: %vs = sitofp <2 x i64> %b to <2 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 4 for instruction: %vu = uitofp <2 x i64> %b to <2 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 7 for instruction: %v3s = sitofp <3 x i64> %c to <3 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 7 for instruction: %v3u = uitofp <3 x i64> %c to <3 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %s48 = sitofp i48 %d to bfloat
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %u48 = uitofp i48 %d to bfloat
+;
+ %s = sitofp i64 %a to bfloat
+ %u = uitofp i64 %a to bfloat
+ %vs = sitofp <2 x i64> %b to <2 x bfloat>
+ %vu = uitofp <2 x i64> %b to <2 x bfloat>
+ %v3s = sitofp <3 x i64> %c to <3 x bfloat>
+ %v3u = uitofp <3 x i64> %c to <3 x bfloat>
+ %s48 = sitofp i48 %d to bfloat
+ %u48 = uitofp i48 %d to bfloat
+ ret void
+}
+
+; Subword extraction and bf16 rounding are independent costs. Native packed
+; rounding still needs one integer-to-f32 conversion for each input lane.
+define void @narrow_to_bf16(<4 x i8> %a, <2 x i16> %b, <3 x i32> %c) {
+; GFX6-LABEL: 'narrow_to_bf16'
+; GFX6: Cost Model: Found an estimated cost of 4 for instruction: %bs = sitofp <4 x i8> %a to <4 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 4 for instruction: %bu = uitofp <4 x i8> %a to <4 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 2 for instruction: %hs = sitofp <2 x i16> %b to <2 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 2 for instruction: %hu = uitofp <2 x i16> %b to <2 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 9 for instruction: %ws = sitofp <3 x i32> %c to <3 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 9 for instruction: %wu = uitofp <3 x i32> %c to <3 x bfloat>
+;
+; GFX9-THROUGHPUT-LABEL: 'narrow_to_bf16'
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 4 for instruction: %bs = sitofp <4 x i8> %a to <4 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 4 for instruction: %bu = uitofp <4 x i8> %a to <4 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 4 for instruction: %hs = sitofp <2 x i16> %b to <2 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 4 for instruction: %hu = uitofp <2 x i16> %b to <2 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 7 for instruction: %ws = sitofp <3 x i32> %c to <3 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 7 for instruction: %wu = uitofp <3 x i32> %c to <3 x bfloat>
+;
+; HALF-LABEL: 'narrow_to_bf16'
+; HALF: Cost Model: Found an estimated cost of 4 for instruction: %bs = sitofp <4 x i8> %a to <4 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 4 for instruction: %bu = uitofp <4 x i8> %a to <4 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 4 for instruction: %hs = sitofp <2 x i16> %b to <2 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 4 for instruction: %hu = uitofp <2 x i16> %b to <2 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 7 for instruction: %ws = sitofp <3 x i32> %c to <3 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 7 for instruction: %wu = uitofp <3 x i32> %c to <3 x bfloat>
+;
+; FULL-LABEL: 'narrow_to_bf16'
+; FULL: Cost Model: Found an estimated cost of 4 for instruction: %bs = sitofp <4 x i8> %a to <4 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 4 for instruction: %bu = uitofp <4 x i8> %a to <4 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 4 for instruction: %hs = sitofp <2 x i16> %b to <2 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 4 for instruction: %hu = uitofp <2 x i16> %b to <2 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 7 for instruction: %ws = sitofp <3 x i32> %c to <3 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 7 for instruction: %wu = uitofp <3 x i32> %c to <3 x bfloat>
+;
+ %bs = sitofp <4 x i8> %a to <4 x bfloat>
+ %bu = uitofp <4 x i8> %a to <4 x bfloat>
+ %hs = sitofp <2 x i16> %b to <2 x bfloat>
+ %hu = uitofp <2 x i16> %b to <2 x bfloat>
+ %ws = sitofp <3 x i32> %c to <3 x bfloat>
+ %wu = uitofp <3 x i32> %c to <3 x bfloat>
+ ret void
+}
+
+; Unsigned lanes wider than a byte are zero extended before the conversion.
+define void @narrow_unsigned_lanes(<4 x i12> %a) {
+; GFX6-LABEL: 'narrow_unsigned_lanes'
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp <4 x i12> %a to <4 x float>
+; GFX6: Cost Model: Found an estimated cost of 4 for instruction: %uh = uitofp <4 x i12> %a to <4 x half>
+;
+; GFX9-THROUGHPUT-LABEL: 'narrow_unsigned_lanes'
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp <4 x i12> %a to <4 x float>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 10 for instruction: %uh = uitofp <4 x i12> %a to <4 x half>
+;
+; HALF-LABEL: 'narrow_unsigned_lanes'
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp <4 x i12> %a to <4 x float>
+; HALF: Cost Model: Found an estimated cost of 10 for instruction: %uh = uitofp <4 x i12> %a to <4 x half>
+;
+; FULL-LABEL: 'narrow_unsigned_lanes'
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp <4 x i12> %a to <4 x float>
+; FULL: Cost Model: Found an estimated cost of 10 for instruction: %uh = uitofp <4 x i12> %a to <4 x half>
+;
+ %u = uitofp <4 x i12> %a to <4 x float>
+ %uh = uitofp <4 x i12> %a to <4 x half>
+ ret void
+}
+
+; FP64 rates vary independently of native trunc/floor support and code size.
+define void @i64_double(i64 %a, <2 x i64> %b, double %c, <2 x double> %d, i48 %e) {
+; ALL-LABEL: 'i64_double'
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i64 %a to double
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i64 %a to double
+; ALL: Cost Model: Found an estimated cost of 2 for instruction: %vs = sitofp <2 x i64> %b to <2 x double>
+; ALL: Cost Model: Found an estimated cost of 2 for instruction: %vu = uitofp <2 x i64> %b to <2 x double>
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %rs = fptosi double %c to i64
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %ru = fptoui double %c to i64
+; ALL: Cost Model: Found an estimated cost of 2 for instruction: %rvs = fptosi <2 x double> %d to <2 x i64>
+; ALL: Cost Model: Found an estimated cost of 2 for instruction: %rvu = fptoui <2 x double> %d to <2 x i64>
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %s48 = sitofp i48 %e to double
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %u48 = uitofp i48 %e to double
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %ru48 = fptoui double %c to i48
+;
+ %s = sitofp i64 %a to double
+ %u = uitofp i64 %a to double
+ %vs = sitofp <2 x i64> %b to <2 x double>
+ %vu = uitofp <2 x i64> %b to <2 x double>
+ %rs = fptosi double %c to i64
+ %ru = fptoui double %c to i64
+ %rvs = fptosi <2 x double> %d to <2 x i64>
+ %rvu = fptoui <2 x double> %d to <2 x i64>
+ %s48 = sitofp i48 %e to double
+ %u48 = uitofp i48 %e to double
+ %ru48 = fptoui double %c to i48
+ ret void
+}
+
+; Integers of 33 to 63 bits are converted through i64.
+define void @i48(i48 %a, float %b, bfloat %c) {
+; ALL-LABEL: 'i48'
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i48 %a to float
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i48 %a to float
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %rs = fptosi float %b to i48
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %ru = fptoui float %b to i48
+; ALL: Cost Model: Found an estimated cost of 1 for instruction: %bu = fptoui bfloat %c to i48
+;
+ %s = sitofp i48 %a to float
+ %u = uitofp i48 %a to float
+ %rs = fptosi float %b to i48
+ %ru = fptoui float %b to i48
+ %bu = fptoui bfloat %c to i48
+ ret void
+}
+
+; i128 and fp128 casts keep the generic estimates.
+define void @other_widths(i128 %a, double %b, <2 x i128> %c, <2 x double> %d, fp128 %e, i64 %f) {
+; GFX6-LABEL: 'other_widths'
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i128 %a to double
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i128 %a to bfloat
+; GFX6: Cost Model: Found an estimated cost of 2 for instruction: %vs = sitofp <2 x i128> %c to <2 x double>
+; GFX6: Cost Model: Found an estimated cost of 6 for instruction: %vu = uitofp <2 x i128> %c to <2 x bfloat>
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %rs = fptosi double %b to i128
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %ru = fptoui double %b to i128
+; GFX6: Cost Model: Found an estimated cost of 2 for instruction: %rvs = fptosi <2 x double> %d to <2 x i128>
+; GFX6: Cost Model: Found an estimated cost of 2 for instruction: %rvu = fptoui <2 x double> %d to <2 x i128>
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %qs = fptosi fp128 %e to i64
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %qu = fptoui fp128 %e to i64
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %rqs = sitofp i64 %f to fp128
+; GFX6: Cost Model: Found an estimated cost of 1 for instruction: %rqu = uitofp i64 %f to fp128
+;
+; GFX9-THROUGHPUT-LABEL: 'other_widths'
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i128 %a to double
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i128 %a to bfloat
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 2 for instruction: %vs = sitofp <2 x i128> %c to <2 x double>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 2 for instruction: %vu = uitofp <2 x i128> %c to <2 x bfloat>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %rs = fptosi double %b to i128
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %ru = fptoui double %b to i128
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 2 for instruction: %rvs = fptosi <2 x double> %d to <2 x i128>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 2 for instruction: %rvu = fptoui <2 x double> %d to <2 x i128>
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %qs = fptosi fp128 %e to i64
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %qu = fptoui fp128 %e to i64
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %rqs = sitofp i64 %f to fp128
+; GFX9-THROUGHPUT: Cost Model: Found an estimated cost of 1 for instruction: %rqu = uitofp i64 %f to fp128
+;
+; HALF-LABEL: 'other_widths'
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i128 %a to double
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i128 %a to bfloat
+; HALF: Cost Model: Found an estimated cost of 2 for instruction: %vs = sitofp <2 x i128> %c to <2 x double>
+; HALF: Cost Model: Found an estimated cost of 2 for instruction: %vu = uitofp <2 x i128> %c to <2 x bfloat>
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %rs = fptosi double %b to i128
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %ru = fptoui double %b to i128
+; HALF: Cost Model: Found an estimated cost of 2 for instruction: %rvs = fptosi <2 x double> %d to <2 x i128>
+; HALF: Cost Model: Found an estimated cost of 2 for instruction: %rvu = fptoui <2 x double> %d to <2 x i128>
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %qs = fptosi fp128 %e to i64
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %qu = fptoui fp128 %e to i64
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %rqs = sitofp i64 %f to fp128
+; HALF: Cost Model: Found an estimated cost of 1 for instruction: %rqu = uitofp i64 %f to fp128
+;
+; FULL-LABEL: 'other_widths'
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %s = sitofp i128 %a to double
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %u = uitofp i128 %a to bfloat
+; FULL: Cost Model: Found an estimated cost of 2 for instruction: %vs = sitofp <2 x i128> %c to <2 x double>
+; FULL: Cost Model: Found an estimated cost of 2 for instruction: %vu = uitofp <2 x i128> %c to <2 x bfloat>
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %rs = fptosi double %b to i128
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %ru = fptoui double %b to i128
+; FULL: Cost Model: Found an estimated cost of 2 for instruction: %rvs = fptosi <2 x double> %d to <2 x i128>
+; FULL: Cost Model: Found an estimated cost of 2 for instruction: %rvu = fptoui <2 x double> %d to <2 x i128>
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %qs = fptosi fp128 %e to i64
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %qu = fptoui fp128 %e to i64
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %rqs = sitofp i64 %f to fp128
+; FULL: Cost Model: Found an estimated cost of 1 for instruction: %rqu = uitofp i64 %f to fp128
+;
+ %s = sitofp i128 %a to double
+ %u = uitofp i128 %a to bfloat
+ %vs = sitofp <2 x i128> %c to <2 x double>
+ %vu = uitofp <2 x i128> %c to <2 x bfloat>
+ %rs = fptosi double %b to i128
+ %ru = fptoui double %b to i128
+ %rvs = fptosi <2 x double> %d to <2 x i128>
+ %rvu = fptoui <2 x double> %d to <2 x i128>
+ %qs = fptosi fp128 %e to i64
+ %qu = fptoui fp128 %e to i64
+ %rqs = sitofp i64 %f to fp128
+ %rqu = uitofp i64 %f to fp128
+ ret void
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; GFX11: {{.*}}
+; GFX6-SIZE: {{.*}}
+; GFX6-THROUGHPUT: {{.*}}
+; GFX7: {{.*}}
+; GFX8: {{.*}}
+; GFX9: {{.*}}
+; NATIVE-NOSDWA: {{.*}}
+; NATIVE-SDWA: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll b/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll
index 552b0c909f3bfa..e122a9b667e7f9 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll
@@ -1,12 +1,12 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,FULL64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,SLOW %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,FULL64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,SLOW-SIZE %s
; END.
@@ -257,3 +257,33 @@ define i32 @fptosi_float_i8(i32 %arg) {
%V16I8 = fptosi <16 x float> poison to <16 x i8>
ret i32 poison
}
+
+define i32 @fptosi_half_i64(i32 %arg) {
+; ALL-LABEL: 'fptosi_half_i64'
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = fptosi half poison to i64
+; ALL-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = fptosi <2 x half> poison to <2 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4I64 = fptosi <4 x half> poison to <4 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V8I64 = fptosi <8 x half> poison to <8 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V16I64 = fptosi <16 x half> poison to <16 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
+;
+; ALL-SIZE-LABEL: 'fptosi_half_i64'
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = fptosi half poison to i64
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = fptosi <2 x half> poison to <2 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4I64 = fptosi <4 x half> poison to <4 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V8I64 = fptosi <8 x half> poison to <8 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V16I64 = fptosi <16 x half> poison to <16 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 poison
+;
+ %I64 = fptosi half poison to i64
+ %V2I64 = fptosi <2 x half> poison to <2 x i64>
+ %V4I64 = fptosi <4 x half> poison to <4 x i64>
+ %V8I64 = fptosi <8 x half> poison to <8 x i64>
+ %V16I64 = fptosi <16 x half> poison to <16 x i64>
+ ret i32 poison
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; FULL64: {{.*}}
+; FULL64-SIZE: {{.*}}
+; QUARTER64: {{.*}}
+; QUARTER64-SIZE: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll b/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll
index ae5915c63fac58..3ed5d1ea77325a 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll
@@ -1,12 +1,12 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,FULL64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,SLOW %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,FULL64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,SLOW-SIZE %s
; END.
@@ -257,3 +257,33 @@ define i32 @fptoui_float_i8(i32 %arg) {
%V16I8 = fptoui <16 x float> poison to <16 x i8>
ret i32 poison
}
+
+define i32 @fptoui_half_i64(i32 %arg) {
+; ALL-LABEL: 'fptoui_half_i64'
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = fptoui half poison to i64
+; ALL-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = fptoui <2 x half> poison to <2 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4I64 = fptoui <4 x half> poison to <4 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V8I64 = fptoui <8 x half> poison to <8 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V16I64 = fptoui <16 x half> poison to <16 x i64>
+; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
+;
+; ALL-SIZE-LABEL: 'fptoui_half_i64'
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = fptoui half poison to i64
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = fptoui <2 x half> poison to <2 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4I64 = fptoui <4 x half> poison to <4 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V8I64 = fptoui <8 x half> poison to <8 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V16I64 = fptoui <16 x half> poison to <16 x i64>
+; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 poison
+;
+ %I64 = fptoui half poison to i64
+ %V2I64 = fptoui <2 x half> poison to <2 x i64>
+ %V4I64 = fptoui <4 x half> poison to <4 x i64>
+ %V8I64 = fptoui <8 x half> poison to <8 x i64>
+ %V16I64 = fptoui <16 x half> poison to <16 x i64>
+ ret i32 poison
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; FULL64: {{.*}}
+; FULL64-SIZE: {{.*}}
+; QUARTER64: {{.*}}
+; QUARTER64-SIZE: {{.*}}
>From f28f5d912b053f59fd4ad2b77411d1e0816d8d2c Mon Sep 17 00:00:00 2001
From: Dmitry Sidorov <Dmitry.Sidorov at amd.com>
Date: Tue, 15 Sep 2026 11:21:15 +0200
Subject: [PATCH 2/2] drop check prefixes unused before the fix
---
llvm/test/Analysis/CostModel/AMDGPU/cast.ll | 27 +++++-------
.../CostModel/AMDGPU/expanded-int-fp-casts.ll | 41 ++++++++-----------
llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll | 17 +++-----
llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll | 17 +++-----
4 files changed, 38 insertions(+), 64 deletions(-)
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/cast.ll b/llvm/test/Analysis/CostModel/AMDGPU/cast.ll
index aab8fbe6f5e4d5..eedca86f6bc322 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/cast.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/cast.ll
@@ -1,15 +1,15 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu11.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,QUARTER64,NOSDWA %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64,FAST-QUARTER64 %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,FULL64 %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64,FAST-QUARTER64 %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,QUARTER64,SLOW %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu11.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,NOSDWA %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,SLOW %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu11.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,QUARTER64-SIZE,NOSDWA-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE,FAST-QUARTER64-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,FULL64-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE,FAST-QUARTER64-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,QUARTER64-SIZE,SLOW-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu11.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,NOSDWA-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,SLOW-SIZE %s
; END.
define i32 @add(i32 %arg) {
@@ -685,10 +685,3 @@ define void @fp_conv(<8 x float> %a, <16 x float>%b, <4 x float> %c) {
%A4 = fptrunc <8 x double> poison to <8 x float>
ret void
}
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; FAST-QUARTER64: {{.*}}
-; FAST-QUARTER64-SIZE: {{.*}}
-; FULL64: {{.*}}
-; FULL64-SIZE: {{.*}}
-; QUARTER64: {{.*}}
-; QUARTER64-SIZE: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll b/llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll
index b495729859cbea..9434c87f23dbd9 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/expanded-int-fp-casts.ll
@@ -1,20 +1,20 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --filter "instruction:.*(sitofp|uitofp|fptosi|fptoui)"
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu6.01-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX6-THROUGHPUT
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu7.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX7
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu8.03-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX8
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX9
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.00-amd-amdhsa -mattr=-gfx9-insts < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX8
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.06-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF,GFX9
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.42-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,GFX9
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,NATIVE-SDWA
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu11.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,GFX11
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu11.00-amd-amdhsa -mattr=-16-bit-insts < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX7
-; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu12.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT,NATIVE-NOSDWA
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu6.01-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6,GFX6-SIZE
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF,GFX9
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.42-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,GFX9
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL,NATIVE-SDWA
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu12.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF,NATIVE-NOSDWA
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu6.01-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu7.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu8.03-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.00-amd-amdhsa -mattr=-gfx9-insts < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.06-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.42-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu9.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu11.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu11.00-amd-amdhsa -mattr=-16-bit-insts < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6
+; RUN: opt -passes="print<cost-model>" -disable-output -mtriple=amdgpu12.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX9-THROUGHPUT
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu6.01-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,GFX6
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.42-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu9.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,FULL
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size -disable-output -mtriple=amdgpu12.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=ALL,HALF
; Half fits in i32. Bfloat must extend to f32 and use the full i64 expansion.
define void @bf16_to_i64(bfloat %a, <2 x bfloat> %b, half %h) {
@@ -275,12 +275,3 @@ define void @other_widths(i128 %a, double %b, <2 x i128> %c, <2 x double> %d, fp
%rqu = uitofp i64 %f to fp128
ret void
}
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; GFX11: {{.*}}
-; GFX6-SIZE: {{.*}}
-; GFX6-THROUGHPUT: {{.*}}
-; GFX7: {{.*}}
-; GFX8: {{.*}}
-; GFX9: {{.*}}
-; NATIVE-NOSDWA: {{.*}}
-; NATIVE-SDWA: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll b/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll
index e122a9b667e7f9..545643bd43e3df 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/fptosi.ll
@@ -1,12 +1,12 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,FULL64 %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,SLOW %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,FULL64-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,SLOW-SIZE %s
; END.
@@ -282,8 +282,3 @@ define i32 @fptosi_half_i64(i32 %arg) {
%V16I64 = fptosi <16 x half> poison to <16 x i64>
ret i32 poison
}
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; FULL64: {{.*}}
-; FULL64-SIZE: {{.*}}
-; QUARTER64: {{.*}}
-; QUARTER64-SIZE: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll b/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll
index 3ed5d1ea77325a..1cd41d8376e453 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/fptoui.ll
@@ -1,12 +1,12 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,FULL64 %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST,QUARTER64 %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,FAST %s
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL,SLOW %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,FULL64-SIZE %s
-; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE,QUARTER64-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu10.10-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.0a-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu9.00-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,FAST-SIZE %s
; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgpu6.01-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE,SLOW-SIZE %s
; END.
@@ -282,8 +282,3 @@ define i32 @fptoui_half_i64(i32 %arg) {
%V16I64 = fptoui <16 x half> poison to <16 x i64>
ret i32 poison
}
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; FULL64: {{.*}}
-; FULL64-SIZE: {{.*}}
-; QUARTER64: {{.*}}
-; QUARTER64-SIZE: {{.*}}
More information about the llvm-commits
mailing list