[llvm] 053e033 - [RISCV] Generalize cost model for vp_fneg. NFC. (#126915)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 14 05:58:22 PST 2025
Author: Mikhail R. Gadelha
Date: 2025-02-14T10:58:18-03:00
New Revision: 053e03332162e3a0527f0ac76313dcf1b8c1ae8c
URL: https://github.com/llvm/llvm-project/commit/053e03332162e3a0527f0ac76313dcf1b8c1ae8c
DIFF: https://github.com/llvm/llvm-project/commit/053e03332162e3a0527f0ac76313dcf1b8c1ae8c.diff
LOG: [RISCV] Generalize cost model for vp_fneg. NFC. (#126915)
Move the cost model for vp_fneg from the riscv-specific implementation to the generic TTI layer.
This ensures consistent handling of vp_fneg across targets
Added:
Modified:
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index c63d288ad1579..032c7d7b5159e 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1675,7 +1675,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
return thisT()->getMemoryOpCost(*FOp, ICA.getArgTypes()[0], Alignment,
AS, CostKind);
}
- if (VPBinOpIntrinsic::isVPBinOp(ICA.getID())) {
+ if (VPBinOpIntrinsic::isVPBinOp(ICA.getID()) ||
+ ICA.getID() == Intrinsic::vp_fneg) {
return thisT()->getArithmeticInstrCost(*FOp, ICA.getReturnType(),
CostKind);
}
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index c46400a1936ad..da77bae18962c 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -1356,13 +1356,6 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
return Cost * LT.first;
break;
}
- case Intrinsic::vp_fneg: {
- std::optional<unsigned> FOp =
- VPIntrinsic::getFunctionalOpcodeForVP(ICA.getID());
- assert(FOp.has_value());
- return getArithmeticInstrCost(*FOp, ICA.getReturnType(), CostKind);
- break;
- }
case Intrinsic::vp_select: {
Intrinsic::ID IID = ICA.getID();
std::optional<unsigned> FOp = VPIntrinsic::getFunctionalOpcodeForVP(IID);
More information about the llvm-commits
mailing list