[llvm] [RISCV][NFC] Clarify getRISCVInstructionCost usage (PR #121556)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 2 23:36:59 PST 2025
https://github.com/arcbbb updated https://github.com/llvm/llvm-project/pull/121556
>From 9402fbb4460206d6b3e75e58d425aedc49f1f0c3 Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Fri, 3 Jan 2025 01:20:43 -0800
Subject: [PATCH 1/2] [RISCV][TTI] Use vtype for getRISCVInstructionCost
---
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index 9b364391f0fa47..3a9073731681ef 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -48,6 +48,11 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
/// actual target hardware.
unsigned getEstimatedVLFor(VectorType *Ty);
+ /// This function calculates the costs for one or more RVV opcodes based
+ /// on the vtype and the cost kind.
+ /// \param Opcodes A list of opcodes of the RVV instruction to evaluate.
+ /// \param VT The MVT of vtype associated with the RVV instructions.
+ /// \param CostKind The type of cost to compute.
InstructionCost getRISCVInstructionCost(ArrayRef<unsigned> OpCodes, MVT VT,
TTI::TargetCostKind CostKind);
>From 02f633cc4323988f4f7e88d88073b29f4435f63c Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Sun, 2 Feb 2025 23:36:36 -0800
Subject: [PATCH 2/2] Add comments for widening/narrowing instructions
---
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index 3a9073731681ef..042530b9cd2b32 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -52,6 +52,9 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
/// on the vtype and the cost kind.
/// \param Opcodes A list of opcodes of the RVV instruction to evaluate.
/// \param VT The MVT of vtype associated with the RVV instructions.
+ /// For widening/narrowing instructions where the result and source types
+ /// differ, it is important to check the spec to determine whether the vtype
+ /// refers to the result or source type.
/// \param CostKind The type of cost to compute.
InstructionCost getRISCVInstructionCost(ArrayRef<unsigned> OpCodes, MVT VT,
TTI::TargetCostKind CostKind);
More information about the llvm-commits
mailing list