[llvm] 27a2d3d - [AArch64] Build v2i64 Mul cost out of getArithmeticInstrCost and getVectorInstrCost. NFCI
David Green via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 20 03:44:08 PST 2025
Author: David Green
Date: 2025-01-20T11:43:57Z
New Revision: 27a2d3d0887ef8a61bc953e76a22bb8a628a1ea0
URL: https://github.com/llvm/llvm-project/commit/27a2d3d0887ef8a61bc953e76a22bb8a628a1ea0
DIFF: https://github.com/llvm/llvm-project/commit/27a2d3d0887ef8a61bc953e76a22bb8a628a1ea0.diff
LOG: [AArch64] Build v2i64 Mul cost out of getArithmeticInstrCost and getVectorInstrCost. NFCI
This should not effect the result, unless the getArithmeticInstrCost and
getVectorInstrCost routines learn to produce different costs (with CostKind =
CodeSize for example). The -1 lanes prevent 0 lanes from (incorrectly) being
marked as free.
Added:
Modified:
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 7f10bfed739b41..050fd71d3b1438 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -3623,7 +3623,13 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
// so the cost can be cheaper (smull or umull).
if (LT.second != MVT::v2i64 || isWideningInstruction(Ty, Opcode, Args))
return LT.first;
- return LT.first * 14;
+ return cast<VectorType>(Ty)->getElementCount().getKnownMinValue() *
+ (getArithmeticInstrCost(Opcode, Ty->getScalarType(), CostKind) +
+ getVectorInstrCost(Instruction::ExtractElement, Ty, CostKind, -1,
+ nullptr, nullptr) *
+ 2 +
+ getVectorInstrCost(Instruction::InsertElement, Ty, CostKind, -1,
+ nullptr, nullptr));
case ISD::ADD:
case ISD::XOR:
case ISD::OR:
More information about the llvm-commits
mailing list