[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.
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp index 7f10bfe..050fd71 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -3623,7 +3623,13 @@ // 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: