From 8148b961ed9dcc3b0b9b07f700b1167cb84bde23 Mon Sep 17 00:00:00 2001 From: Benjamin Maxwell Date: Fri, 7 Nov 2025 11:49:50 +0000 Subject: [PATCH 1/3] [AArch64][CostModel] Add SVE bfloat arithmetic tests (NFC) --- .../CostModel/AArch64/sve-arith-fp.ll | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll index ec848c2c08305..41e08fa903604 100644 --- a/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll +++ b/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py -; RUN: opt < %s -enable-no-nans-fp-math -passes="print" -cost-kind=all 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16 -mattr=+sve | FileCheck %s +; RUN: opt < %s -enable-no-nans-fp-math -passes="print" -cost-kind=all 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16 -mattr=+sve-b16b16 -mattr=+sve | FileCheck %s target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" @@ -8,6 +8,9 @@ define void @fadd() { ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fadd poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fadd poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fadd poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of Invalid for: %V1F32 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fadd poison, poison @@ -20,6 +23,10 @@ define void @fadd() { %V8F16 = fadd poison, poison %V16F16 = fadd poison, poison + %V4BF16 = fadd poison, poison + %V8BF16 = fadd poison, poison + %V16BF16 = fadd poison, poison + %V1F32 = fadd poison, poison %V2F32 = fadd poison, poison %V4F32 = fadd poison, poison @@ -36,6 +43,9 @@ define void @fsub() { ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fsub poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fsub poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fsub poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of Invalid for: %V1F32 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fsub poison, poison @@ -48,6 +58,10 @@ define void @fsub() { %V8F16 = fsub poison, poison %V16F16 = fsub poison, poison + %V4BF16 = fsub poison, poison + %V8BF16 = fsub poison, poison + %V16BF16 = fsub poison, poison + %V1F32 = fsub poison, poison %V2F32 = fsub poison, poison %V4F32 = fsub poison, poison @@ -65,6 +79,10 @@ define void @fneg() { ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2BF16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = fneg poison @@ -77,6 +95,11 @@ define void @fneg() { %V8F16 = fneg poison %V16F16 = fneg poison + %V2BF16 = fneg poison + %V4BF16 = fneg poison + %V8BF16 = fneg poison + %V16BF16 = fneg poison + %V2F32 = fneg poison %V4F32 = fneg poison %V8F32 = fneg poison @@ -92,6 +115,9 @@ define void @fmul() { ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fmul poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fmul poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fmul poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = fmul poison, poison @@ -103,6 +129,10 @@ define void @fmul() { %V8F16 = fmul poison, poison %V16F16 = fmul poison, poison + %V4BF16 = fmul poison, poison + %V8BF16 = fmul poison, poison + %V16BF16 = fmul poison, poison + %V2F32 = fmul poison, poison %V4F32 = fmul poison, poison %V8F32 = fmul poison, poison @@ -118,6 +148,9 @@ define void @fdiv() { ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V4F16 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V8F16 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of 4 for: %V16F16 = fdiv poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:4 Lat:4 SizeLat:4 for: %V4BF16 = fdiv poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:4 Lat:4 SizeLat:4 for: %V8BF16 = fdiv poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:4 Lat:4 SizeLat:4 for: %V16BF16 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V2F32 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V4F32 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of 4 for: %V8F32 = fdiv poison, poison @@ -129,6 +162,10 @@ define void @fdiv() { %V8F16 = fdiv poison, poison %V16F16 = fdiv poison, poison + %V4BF16 = fdiv poison, poison + %V8BF16 = fdiv poison, poison + %V16BF16 = fdiv poison, poison + %V2F32 = fdiv poison, poison %V4F32 = fdiv poison, poison %V8F32 = fdiv poison, poison @@ -144,6 +181,9 @@ define void @frem() { ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V4F16 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V8F16 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V16F16 = frem poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V4BF16 = frem poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V8BF16 = frem poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V16BF16 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V2F32 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V4F32 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V8F32 = frem poison, poison @@ -155,6 +195,10 @@ define void @frem() { %V8F16 = frem poison, poison %V16F16 = frem poison, poison + %V4BF16 = frem poison, poison + %V8BF16 = frem poison, poison + %V16BF16 = frem poison, poison + %V2F32 = frem poison, poison %V4F32 = frem poison, poison %V8F32 = frem poison, poison @@ -170,6 +214,9 @@ define void @fma() { ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = call @llvm.fma.nxv4f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = call @llvm.fma.nxv8f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = call @llvm.fma.nxv16f16( poison, poison, poison) +; CHECK-NEXT: Cost Model: Found costs of 2 for: %V4BF16 = call @llvm.fma.nxv4bf16( poison, poison, poison) +; CHECK-NEXT: Cost Model: Found costs of 2 for: %V8BF16 = call @llvm.fma.nxv8bf16( poison, poison, poison) +; CHECK-NEXT: Cost Model: Found costs of 4 for: %V16BF16 = call @llvm.fma.nxv16bf16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = call @llvm.fma.nxv2f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = call @llvm.fma.nxv4f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = call @llvm.fma.nxv8f32( poison, poison, poison) @@ -181,6 +228,10 @@ define void @fma() { %V8F16 = call @llvm.fma.v8f16( poison, poison, poison) %V16F16 = call @llvm.fma.v16f16( poison, poison, poison) + %V4BF16 = call @llvm.fma.v4BF16( poison, poison, poison) + %V8BF16 = call @llvm.fma.v8BF16( poison, poison, poison) + %V16BF16 = call @llvm.fma.v16BF16( poison, poison, poison) + %V2F32 = call @llvm.fma.v2f32( poison, poison, poison) %V4F32 = call @llvm.fma.v4f32( poison, poison, poison) %V8F32 = call @llvm.fma.v8f32( poison, poison, poison) @@ -196,6 +247,9 @@ define void @fmuladd() { ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = call @llvm.fmuladd.nxv4f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = call @llvm.fmuladd.nxv8f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = call @llvm.fmuladd.nxv16f16( poison, poison, poison) +; CHECK-NEXT: Cost Model: Found costs of 2 for: %V4BF16 = call @llvm.fmuladd.nxv4bf16( poison, poison, poison) +; CHECK-NEXT: Cost Model: Found costs of 2 for: %V8BF16 = call @llvm.fmuladd.nxv8bf16( poison, poison, poison) +; CHECK-NEXT: Cost Model: Found costs of 4 for: %V16BF16 = call @llvm.fmuladd.nxv16bf16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = call @llvm.fmuladd.nxv2f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = call @llvm.fmuladd.nxv4f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = call @llvm.fmuladd.nxv8f32( poison, poison, poison) @@ -207,6 +261,10 @@ define void @fmuladd() { %V8F16 = call @llvm.fmuladd.v8f16( poison, poison, poison) %V16F16 = call @llvm.fmuladd.v16f16( poison, poison, poison) + %V4BF16 = call @llvm.fmuladd.v4BF16( poison, poison, poison) + %V8BF16 = call @llvm.fmuladd.v8BF16( poison, poison, poison) + %V16BF16 = call @llvm.fmuladd.v16BF16( poison, poison, poison) + %V2F32 = call @llvm.fmuladd.v2f32( poison, poison, poison) %V4F32 = call @llvm.fmuladd.v4f32( poison, poison, poison) %V8F32 = call @llvm.fmuladd.v8f32( poison, poison, poison) From ecdadc1047eddf7f15b34c1ed084d5c5469e3c31 Mon Sep 17 00:00:00 2001 From: Benjamin Maxwell Date: Fri, 7 Nov 2025 16:06:00 +0000 Subject: [PATCH 2/3] Fixups --- .../Analysis/CostModel/AArch64/sve-arith-fp.ll | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll index 41e08fa903604..91b48621a06e8 100644 --- a/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll +++ b/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py -; RUN: opt < %s -enable-no-nans-fp-math -passes="print" -cost-kind=all 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16 -mattr=+sve-b16b16 -mattr=+sve | FileCheck %s +; RUN: opt < %s -enable-no-nans-fp-math -passes="print" -cost-kind=all 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16,+sve-b16b16,+sve | FileCheck %s target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" @@ -228,9 +228,9 @@ define void @fma() { %V8F16 = call @llvm.fma.v8f16( poison, poison, poison) %V16F16 = call @llvm.fma.v16f16( poison, poison, poison) - %V4BF16 = call @llvm.fma.v4BF16( poison, poison, poison) - %V8BF16 = call @llvm.fma.v8BF16( poison, poison, poison) - %V16BF16 = call @llvm.fma.v16BF16( poison, poison, poison) + %V4BF16 = call @llvm.fma.v4bf16( poison, poison, poison) + %V8BF16 = call @llvm.fma.v8bf16( poison, poison, poison) + %V16BF16 = call @llvm.fma.v16bf16( poison, poison, poison) %V2F32 = call @llvm.fma.v2f32( poison, poison, poison) %V4F32 = call @llvm.fma.v4f32( poison, poison, poison) @@ -261,9 +261,9 @@ define void @fmuladd() { %V8F16 = call @llvm.fmuladd.v8f16( poison, poison, poison) %V16F16 = call @llvm.fmuladd.v16f16( poison, poison, poison) - %V4BF16 = call @llvm.fmuladd.v4BF16( poison, poison, poison) - %V8BF16 = call @llvm.fmuladd.v8BF16( poison, poison, poison) - %V16BF16 = call @llvm.fmuladd.v16BF16( poison, poison, poison) + %V4BF16 = call @llvm.fmuladd.v4bf16( poison, poison, poison) + %V8BF16 = call @llvm.fmuladd.v8bf16( poison, poison, poison) + %V16BF16 = call @llvm.fmuladd.v16bf16( poison, poison, poison) %V2F32 = call @llvm.fmuladd.v2f32( poison, poison, poison) %V4F32 = call @llvm.fmuladd.v4f32( poison, poison, poison) From 92e7ea15e2ba3596749af8d02fbb059efc0ab26b Mon Sep 17 00:00:00 2001 From: Benjamin Maxwell Date: Mon, 10 Nov 2025 13:10:49 +0000 Subject: [PATCH 3/3] Rework test --- .../CostModel/AArch64/sve-arith-fp.ll | 188 ++++++++++++------ 1 file changed, 129 insertions(+), 59 deletions(-) diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll index 91b48621a06e8..d9e26dc47b53f 100644 --- a/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll +++ b/llvm/test/Analysis/CostModel/AArch64/sve-arith-fp.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py -; RUN: opt < %s -enable-no-nans-fp-math -passes="print" -cost-kind=all 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16,+sve-b16b16,+sve | FileCheck %s +; RUN: opt < %s -enable-no-nans-fp-math -passes="print" -cost-kind=all 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16,+sve | FileCheck %s --check-prefixes=CHECK,CHECK-BASE +; RUN: opt < %s -enable-no-nans-fp-math -passes="print" -cost-kind=all 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16,+sve-b16b16,+sve | FileCheck %s --check-prefixes=CHECK,CHECK-BF16 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" @@ -8,9 +9,6 @@ define void @fadd() { ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fadd poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fadd poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fadd poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of Invalid for: %V1F32 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fadd poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fadd poison, poison @@ -23,10 +21,6 @@ define void @fadd() { %V8F16 = fadd poison, poison %V16F16 = fadd poison, poison - %V4BF16 = fadd poison, poison - %V8BF16 = fadd poison, poison - %V16BF16 = fadd poison, poison - %V1F32 = fadd poison, poison %V2F32 = fadd poison, poison %V4F32 = fadd poison, poison @@ -38,14 +32,26 @@ define void @fadd() { ret void } +define void @fadd_bf16() { +; CHECK-LABEL: 'fadd_bf16' +; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fadd poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fadd poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fadd poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV4BF16 = fadd poison, poison + %NXV8BF16 = fadd poison, poison + %NXV16BF16 = fadd poison, poison + + ret void +} + + define void @fsub() { ; CHECK-LABEL: 'fsub' ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fsub poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fsub poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fsub poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of Invalid for: %V1F32 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fsub poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fsub poison, poison @@ -58,10 +64,6 @@ define void @fsub() { %V8F16 = fsub poison, poison %V16F16 = fsub poison, poison - %V4BF16 = fsub poison, poison - %V8BF16 = fsub poison, poison - %V16BF16 = fsub poison, poison - %V1F32 = fsub poison, poison %V2F32 = fsub poison, poison %V4F32 = fsub poison, poison @@ -73,16 +75,26 @@ define void @fsub() { ret void } +define void @fsub_bf16() { +; CHECK-LABEL: 'fsub_bf16' +; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fsub poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fsub poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fsub poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV4BF16 = fsub poison, poison + %NXV8BF16 = fsub poison, poison + %NXV16BF16 = fsub poison, poison + + ret void +} + define void @fneg() { ; CHECK-LABEL: 'fneg' ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F16 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fneg poison -; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2BF16 = fneg poison -; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fneg poison -; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fneg poison -; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fneg poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = fneg poison @@ -95,11 +107,6 @@ define void @fneg() { %V8F16 = fneg poison %V16F16 = fneg poison - %V2BF16 = fneg poison - %V4BF16 = fneg poison - %V8BF16 = fneg poison - %V16BF16 = fneg poison - %V2F32 = fneg poison %V4F32 = fneg poison %V8F32 = fneg poison @@ -110,14 +117,27 @@ define void @fneg() { ret void } +define void @fneg_bf16() { +; CHECK-LABEL: 'fneg_bf16' +; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %NXV2BF16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fneg poison +; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV2BF16 = fneg poison + %NXV4BF16 = fneg poison + %NXV8BF16 = fneg poison + %NXV16BF16 = fneg poison + + ret void +} + define void @fmul() { ; CHECK-LABEL: 'fmul' ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = fmul poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:1 Lat:3 SizeLat:1 for: %V4BF16 = fmul poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:1 Lat:3 SizeLat:1 for: %V8BF16 = fmul poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:1 Lat:3 SizeLat:1 for: %V16BF16 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fmul poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = fmul poison, poison @@ -129,10 +149,6 @@ define void @fmul() { %V8F16 = fmul poison, poison %V16F16 = fmul poison, poison - %V4BF16 = fmul poison, poison - %V8BF16 = fmul poison, poison - %V16BF16 = fmul poison, poison - %V2F32 = fmul poison, poison %V4F32 = fmul poison, poison %V8F32 = fmul poison, poison @@ -143,14 +159,25 @@ define void @fmul() { ret void } +define void @fmul_bf16() { +; CHECK-LABEL: 'fmul_bf16' +; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fmul poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fmul poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fmul poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV4BF16 = fmul poison, poison + %NXV8BF16 = fmul poison, poison + %NXV16BF16 = fmul poison, poison + + ret void +} + define void @fdiv() { ; CHECK-LABEL: 'fdiv' ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V4F16 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V8F16 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of 4 for: %V16F16 = fdiv poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:4 Lat:4 SizeLat:4 for: %V4BF16 = fdiv poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:4 Lat:4 SizeLat:4 for: %V8BF16 = fdiv poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:4 Lat:4 SizeLat:4 for: %V16BF16 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V2F32 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V4F32 = fdiv poison, poison ; CHECK-NEXT: Cost Model: Found costs of 4 for: %V8F32 = fdiv poison, poison @@ -162,10 +189,6 @@ define void @fdiv() { %V8F16 = fdiv poison, poison %V16F16 = fdiv poison, poison - %V4BF16 = fdiv poison, poison - %V8BF16 = fdiv poison, poison - %V16BF16 = fdiv poison, poison - %V2F32 = fdiv poison, poison %V4F32 = fdiv poison, poison %V8F32 = fdiv poison, poison @@ -176,14 +199,25 @@ define void @fdiv() { ret void } +define void @fdiv_bf16() { +; CHECK-LABEL: 'fdiv_bf16' +; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:4 Lat:4 SizeLat:4 for: %NXV4BF16 = fdiv poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:4 Lat:4 SizeLat:4 for: %NXV8BF16 = fdiv poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:4 Lat:4 SizeLat:4 for: %NXV16BF16 = fdiv poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV4BF16 = fdiv poison, poison + %NXV8BF16 = fdiv poison, poison + %NXV16BF16 = fdiv poison, poison + + ret void +} + define void @frem() { ; CHECK-LABEL: 'frem' ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V4F16 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V8F16 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V16F16 = frem poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V4BF16 = frem poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V8BF16 = frem poison, poison -; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V16BF16 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V2F32 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V4F32 = frem poison, poison ; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V8F32 = frem poison, poison @@ -195,10 +229,6 @@ define void @frem() { %V8F16 = frem poison, poison %V16F16 = frem poison, poison - %V4BF16 = frem poison, poison - %V8BF16 = frem poison, poison - %V16BF16 = frem poison, poison - %V2F32 = frem poison, poison %V4F32 = frem poison, poison %V8F32 = frem poison, poison @@ -209,14 +239,25 @@ define void @frem() { ret void } +define void @frem_bf16() { +; CHECK-LABEL: 'frem_bf16' +; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %NXV4BF16 = frem poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %NXV8BF16 = frem poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %NXV16BF16 = frem poison, poison +; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV4BF16 = frem poison, poison + %NXV8BF16 = frem poison, poison + %NXV16BF16 = frem poison, poison + + ret void +} + define void @fma() { ; CHECK-LABEL: 'fma' ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = call @llvm.fma.nxv4f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = call @llvm.fma.nxv8f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = call @llvm.fma.nxv16f16( poison, poison, poison) -; CHECK-NEXT: Cost Model: Found costs of 2 for: %V4BF16 = call @llvm.fma.nxv4bf16( poison, poison, poison) -; CHECK-NEXT: Cost Model: Found costs of 2 for: %V8BF16 = call @llvm.fma.nxv8bf16( poison, poison, poison) -; CHECK-NEXT: Cost Model: Found costs of 4 for: %V16BF16 = call @llvm.fma.nxv16bf16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = call @llvm.fma.nxv2f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = call @llvm.fma.nxv4f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = call @llvm.fma.nxv8f32( poison, poison, poison) @@ -228,10 +269,6 @@ define void @fma() { %V8F16 = call @llvm.fma.v8f16( poison, poison, poison) %V16F16 = call @llvm.fma.v16f16( poison, poison, poison) - %V4BF16 = call @llvm.fma.v4bf16( poison, poison, poison) - %V8BF16 = call @llvm.fma.v8bf16( poison, poison, poison) - %V16BF16 = call @llvm.fma.v16bf16( poison, poison, poison) - %V2F32 = call @llvm.fma.v2f32( poison, poison, poison) %V4F32 = call @llvm.fma.v4f32( poison, poison, poison) %V8F32 = call @llvm.fma.v8f32( poison, poison, poison) @@ -242,14 +279,31 @@ define void @fma() { ret void } +define void @fma_bf16() { +; CHECK-BASE-LABEL: 'fma_bf16' +; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV4BF16 = call @llvm.fma.nxv4bf16( poison, poison, poison) +; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV8BF16 = call @llvm.fma.nxv8bf16( poison, poison, poison) +; CHECK-BASE-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call @llvm.fma.nxv16bf16( poison, poison, poison) +; CHECK-BASE-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; +; CHECK-BF16-LABEL: 'fma_bf16' +; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV4BF16 = call @llvm.fma.nxv4bf16( poison, poison, poison) +; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV8BF16 = call @llvm.fma.nxv8bf16( poison, poison, poison) +; CHECK-BF16-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call @llvm.fma.nxv16bf16( poison, poison, poison) +; CHECK-BF16-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV4BF16 = call @llvm.fma.nxv4bf16( poison, poison, poison) + %NXV8BF16 = call @llvm.fma.nxv8bf16( poison, poison, poison) + %NXV16BF16 = call @llvm.fma.nxv16bf16( poison, poison, poison) + + ret void +} + define void @fmuladd() { ; CHECK-LABEL: 'fmuladd' ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = call @llvm.fmuladd.nxv4f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V8F16 = call @llvm.fmuladd.nxv8f16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V16F16 = call @llvm.fmuladd.nxv16f16( poison, poison, poison) -; CHECK-NEXT: Cost Model: Found costs of 2 for: %V4BF16 = call @llvm.fmuladd.nxv4bf16( poison, poison, poison) -; CHECK-NEXT: Cost Model: Found costs of 2 for: %V8BF16 = call @llvm.fmuladd.nxv8bf16( poison, poison, poison) -; CHECK-NEXT: Cost Model: Found costs of 4 for: %V16BF16 = call @llvm.fmuladd.nxv16bf16( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = call @llvm.fmuladd.nxv2f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = call @llvm.fmuladd.nxv4f32( poison, poison, poison) ; CHECK-NEXT: Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = call @llvm.fmuladd.nxv8f32( poison, poison, poison) @@ -261,10 +315,6 @@ define void @fmuladd() { %V8F16 = call @llvm.fmuladd.v8f16( poison, poison, poison) %V16F16 = call @llvm.fmuladd.v16f16( poison, poison, poison) - %V4BF16 = call @llvm.fmuladd.v4bf16( poison, poison, poison) - %V8BF16 = call @llvm.fmuladd.v8bf16( poison, poison, poison) - %V16BF16 = call @llvm.fmuladd.v16bf16( poison, poison, poison) - %V2F32 = call @llvm.fmuladd.v2f32( poison, poison, poison) %V4F32 = call @llvm.fmuladd.v4f32( poison, poison, poison) %V8F32 = call @llvm.fmuladd.v8f32( poison, poison, poison) @@ -274,3 +324,23 @@ define void @fmuladd() { ret void } + +define void @fmuladd_bf16() { +; CHECK-BASE-LABEL: 'fmuladd_bf16' +; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV4BF16 = call @llvm.fmuladd.nxv4bf16( poison, poison, poison) +; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV8BF16 = call @llvm.fmuladd.nxv8bf16( poison, poison, poison) +; CHECK-BASE-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call @llvm.fmuladd.nxv16bf16( poison, poison, poison) +; CHECK-BASE-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; +; CHECK-BF16-LABEL: 'fmuladd_bf16' +; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV4BF16 = call @llvm.fmuladd.nxv4bf16( poison, poison, poison) +; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV8BF16 = call @llvm.fmuladd.nxv8bf16( poison, poison, poison) +; CHECK-BF16-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call @llvm.fmuladd.nxv16bf16( poison, poison, poison) +; CHECK-BF16-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void +; + %NXV4BF16 = call @llvm.fmuladd.nxv4bf16( poison, poison, poison) + %NXV8BF16 = call @llvm.fmuladd.nxv8bf16( poison, poison, poison) + %NXV16BF16 = call @llvm.fmuladd.nxv16bf16( poison, poison, poison) + + ret void +}