Skip to content

Commit 27a2d3d

Browse files
committed
[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.
1 parent a4d9a8d commit 27a2d3d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3623,7 +3623,13 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
36233623
// so the cost can be cheaper (smull or umull).
36243624
if (LT.second != MVT::v2i64 || isWideningInstruction(Ty, Opcode, Args))
36253625
return LT.first;
3626-
return LT.first * 14;
3626+
return cast<VectorType>(Ty)->getElementCount().getKnownMinValue() *
3627+
(getArithmeticInstrCost(Opcode, Ty->getScalarType(), CostKind) +
3628+
getVectorInstrCost(Instruction::ExtractElement, Ty, CostKind, -1,
3629+
nullptr, nullptr) *
3630+
2 +
3631+
getVectorInstrCost(Instruction::InsertElement, Ty, CostKind, -1,
3632+
nullptr, nullptr));
36273633
case ISD::ADD:
36283634
case ISD::XOR:
36293635
case ISD::OR:

0 commit comments

Comments
 (0)