Skip to content

Commit fc89745

Browse files
authored
[RISCV][NFC] Clarify getRISCVInstructionCost usage (#121556)
This patch adds a comment to explicitly state that getRISCVInstructionCost uses vtype associated with widening and narrowing instructions. For example, vtype = (SEW): For vfwcvt.f.f.v, the source is (SEW), the destination is (2 * SEW) For vfncvt.f.f.w, the source is (2 * SEW), the destination is (SEW). In these cases, the type passed to `getRISCVInstructionCost` differs - The source type is used for `vfwcvt.f.f.v`. - The destination type is used for `vfncvt.f.f.w`.
1 parent a1ff2d1 commit fc89745

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
4848
/// actual target hardware.
4949
unsigned getEstimatedVLFor(VectorType *Ty);
5050

51+
/// This function calculates the costs for one or more RVV opcodes based
52+
/// on the vtype and the cost kind.
53+
/// \param Opcodes A list of opcodes of the RVV instruction to evaluate.
54+
/// \param VT The MVT of vtype associated with the RVV instructions.
55+
/// For widening/narrowing instructions where the result and source types
56+
/// differ, it is important to check the spec to determine whether the vtype
57+
/// refers to the result or source type.
58+
/// \param CostKind The type of cost to compute.
5159
InstructionCost getRISCVInstructionCost(ArrayRef<unsigned> OpCodes, MVT VT,
5260
TTI::TargetCostKind CostKind);
5361

0 commit comments

Comments
 (0)