[llvm] [RISCV][TTI] Support cost of f16 FCmp using zvfhmin in the absence of… (PR #89166)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 3 23:11:41 PST 2025
https://github.com/arcbbb updated https://github.com/llvm/llvm-project/pull/89166
>From 498ee55a249b45851a848b58b616ce3f68be3861 Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Thu, 2 Jan 2025 23:27:05 -0800
Subject: [PATCH] [RISCV][TTI] Support cost of f16 FCmp using zvfhmin in the
absence of zvfh
With zvfhmin, the cost of f16 FCmp is determined by the cost of widening
two
operands from f16 to f32, plus the cost of performing an f32 FCmp
---
.../Target/RISCV/RISCVTargetTransformInfo.cpp | 17 +-
.../Analysis/CostModel/RISCV/rvv-fcmp-f16.ll | 216 +++++++++---------
2 files changed, 124 insertions(+), 109 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 850d6244affa50..cbca1fc379cb77 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -1816,12 +1816,27 @@ InstructionCost RISCVTTIImpl::getCmpSelInstrCost(
// one which will calculate as:
// ScalarizeCost + Num * Cost for fixed vector,
// InvalidCost for scalable vector.
- if ((ValTy->getScalarSizeInBits() == 16 && !ST->hasVInstructionsF16()) ||
+ if ((ValTy->getScalarSizeInBits() == 16 &&
+ !ST->hasVInstructionsF16Minimal()) ||
(ValTy->getScalarSizeInBits() == 32 && !ST->hasVInstructionsF32()) ||
(ValTy->getScalarSizeInBits() == 64 && !ST->hasVInstructionsF64()))
return BaseT::getCmpSelInstrCost(Opcode, ValTy, CondTy, VecPred, CostKind,
Op1Info, Op2Info, I);
+ if ((ValTy->getScalarSizeInBits() == 16) && !ST->hasVInstructionsF16()) {
+ // pre-widening Op1 and Op2 to f32 before comparison
+ VectorType *VecF32Ty =
+ VectorType::get(Type::getFloatTy(ValTy->getContext()),
+ cast<VectorType>(ValTy)->getElementCount());
+
+ InstructionCost WidenCost =
+ getCastInstrCost(Instruction::FPExt, VecF32Ty, ValTy,
+ TTI::CastContextHint::None, CostKind);
+ InstructionCost CmpCost = getCmpSelInstrCost(
+ Opcode, VecF32Ty, CondTy, VecPred, CostKind, Op1Info, Op2Info, I);
+ return WidenCost + CmpCost;
+ }
+
// Assuming vector fp compare and mask instructions are all the same cost
// until a need arises to differentiate them.
switch (VecPred) {
diff --git a/llvm/test/Analysis/CostModel/RISCV/rvv-fcmp-f16.ll b/llvm/test/Analysis/CostModel/RISCV/rvv-fcmp-f16.ll
index 8396e80ca3e80e..6fee311befc52c 100644
--- a/llvm/test/Analysis/CostModel/RISCV/rvv-fcmp-f16.ll
+++ b/llvm/test/Analysis/CostModel/RISCV/rvv-fcmp-f16.ll
@@ -29,15 +29,15 @@ define void @fcmp_oeq() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_oeq'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp oeq <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp oeq <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp oeq <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp oeq <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp oeq <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp oeq <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp oeq <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp oeq <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp oeq <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2f16 = fcmp oeq <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v4f16 = fcmp oeq <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8f16 = fcmp oeq <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v16f16 = fcmp oeq <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv1f16 = fcmp oeq <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv2f16 = fcmp oeq <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv4f16 = fcmp oeq <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %nxv8f16 = fcmp oeq <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %nxv16f16 = fcmp oeq <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp oeq <2 x half> undef, undef
@@ -77,15 +77,15 @@ define void @fcmp_one() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_one'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp one <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp one <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp one <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp one <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp one <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp one <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp one <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp one <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp one <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = fcmp one <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v4f16 = fcmp one <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %v8f16 = fcmp one <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %v16f16 = fcmp one <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv1f16 = fcmp one <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv2f16 = fcmp one <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %nxv4f16 = fcmp one <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %nxv8f16 = fcmp one <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 25 for instruction: %nxv16f16 = fcmp one <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp one <2 x half> undef, undef
@@ -125,15 +125,15 @@ define void @fcmp_olt() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_olt'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp olt <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp olt <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp olt <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp olt <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp olt <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp olt <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp olt <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp olt <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp olt <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2f16 = fcmp olt <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v4f16 = fcmp olt <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8f16 = fcmp olt <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v16f16 = fcmp olt <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv1f16 = fcmp olt <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv2f16 = fcmp olt <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv4f16 = fcmp olt <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %nxv8f16 = fcmp olt <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %nxv16f16 = fcmp olt <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp olt <2 x half> undef, undef
@@ -173,15 +173,15 @@ define void @fcmp_ole() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_ole'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp ole <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp ole <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp ole <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp ole <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp ole <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp ole <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp ole <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp ole <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp ole <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2f16 = fcmp ole <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v4f16 = fcmp ole <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8f16 = fcmp ole <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v16f16 = fcmp ole <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv1f16 = fcmp ole <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv2f16 = fcmp ole <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv4f16 = fcmp ole <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %nxv8f16 = fcmp ole <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %nxv16f16 = fcmp ole <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp ole <2 x half> undef, undef
@@ -221,15 +221,15 @@ define void @fcmp_ogt() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_ogt'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp ogt <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp ogt <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp ogt <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp ogt <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp ogt <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp ogt <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp ogt <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp ogt <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp ogt <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2f16 = fcmp ogt <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v4f16 = fcmp ogt <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8f16 = fcmp ogt <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v16f16 = fcmp ogt <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv1f16 = fcmp ogt <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv2f16 = fcmp ogt <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv4f16 = fcmp ogt <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %nxv8f16 = fcmp ogt <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %nxv16f16 = fcmp ogt <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp ogt <2 x half> undef, undef
@@ -269,15 +269,15 @@ define void @fcmp_oge() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_oge'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp oge <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp oge <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp oge <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp oge <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp oge <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp oge <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp oge <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp oge <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp oge <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2f16 = fcmp oge <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v4f16 = fcmp oge <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8f16 = fcmp oge <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v16f16 = fcmp oge <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv1f16 = fcmp oge <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv2f16 = fcmp oge <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv4f16 = fcmp oge <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %nxv8f16 = fcmp oge <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %nxv16f16 = fcmp oge <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp oge <2 x half> undef, undef
@@ -317,15 +317,15 @@ define void @fcmp_ueq() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_ueq'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp ueq <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp ueq <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp ueq <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp ueq <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp ueq <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp ueq <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp ueq <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp ueq <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp ueq <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = fcmp ueq <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v4f16 = fcmp ueq <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %v8f16 = fcmp ueq <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %v16f16 = fcmp ueq <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv1f16 = fcmp ueq <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv2f16 = fcmp ueq <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %nxv4f16 = fcmp ueq <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %nxv8f16 = fcmp ueq <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 25 for instruction: %nxv16f16 = fcmp ueq <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp ueq <2 x half> undef, undef
@@ -365,15 +365,15 @@ define void @fcmp_une() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_une'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp une <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp une <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp une <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp une <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp une <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp une <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp une <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp une <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp une <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2f16 = fcmp une <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v4f16 = fcmp une <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8f16 = fcmp une <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v16f16 = fcmp une <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv1f16 = fcmp une <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %nxv2f16 = fcmp une <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %nxv4f16 = fcmp une <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %nxv8f16 = fcmp une <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %nxv16f16 = fcmp une <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp une <2 x half> undef, undef
@@ -413,15 +413,15 @@ define void @fcmp_ult() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_ult'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp ult <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp ult <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp ult <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp ult <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp ult <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp ult <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp ult <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp ult <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp ult <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = fcmp ult <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v4f16 = fcmp ult <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v8f16 = fcmp ult <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v16f16 = fcmp ult <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv1f16 = fcmp ult <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv2f16 = fcmp ult <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %nxv4f16 = fcmp ult <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %nxv8f16 = fcmp ult <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %nxv16f16 = fcmp ult <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp ult <2 x half> undef, undef
@@ -461,15 +461,15 @@ define void @fcmp_ule() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_ule'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp ule <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp ule <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp ule <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp ule <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp ule <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp ule <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp ule <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp ule <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp ule <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = fcmp ule <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v4f16 = fcmp ule <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v8f16 = fcmp ule <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v16f16 = fcmp ule <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv1f16 = fcmp ule <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv2f16 = fcmp ule <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %nxv4f16 = fcmp ule <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %nxv8f16 = fcmp ule <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %nxv16f16 = fcmp ule <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp ule <2 x half> undef, undef
@@ -509,15 +509,15 @@ define void @fcmp_ugt() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_ugt'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp ugt <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp ugt <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp ugt <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp ugt <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp ugt <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp ugt <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp ugt <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp ugt <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp ugt <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = fcmp ugt <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v4f16 = fcmp ugt <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v8f16 = fcmp ugt <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v16f16 = fcmp ugt <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv1f16 = fcmp ugt <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv2f16 = fcmp ugt <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %nxv4f16 = fcmp ugt <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %nxv8f16 = fcmp ugt <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %nxv16f16 = fcmp ugt <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp ugt <2 x half> undef, undef
@@ -557,15 +557,15 @@ define void @fcmp_uge() {
; VFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; VFHMIN-LABEL: 'fcmp_uge'
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2f16 = fcmp uge <2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v4f16 = fcmp uge <4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v8f16 = fcmp uge <8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16f16 = fcmp uge <16 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv1f16 = fcmp uge <vscale x 1 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv2f16 = fcmp uge <vscale x 2 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv4f16 = fcmp uge <vscale x 4 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv8f16 = fcmp uge <vscale x 8 x half> undef, undef
-; VFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nxv16f16 = fcmp uge <vscale x 16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = fcmp uge <2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v4f16 = fcmp uge <4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v8f16 = fcmp uge <8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v16f16 = fcmp uge <16 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv1f16 = fcmp uge <vscale x 1 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %nxv2f16 = fcmp uge <vscale x 2 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %nxv4f16 = fcmp uge <vscale x 4 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %nxv8f16 = fcmp uge <vscale x 8 x half> undef, undef
+; VFHMIN-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %nxv16f16 = fcmp uge <vscale x 16 x half> undef, undef
; VFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%v2f16 = fcmp uge <2 x half> undef, undef
More information about the llvm-commits
mailing list