[llvm] [ARM] Add scalar add_sat costs. (PR #100988)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 30 23:46:35 PDT 2024
================
@@ -1904,17 +1905,37 @@ ARMTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
case Intrinsic::ssub_sat:
case Intrinsic::uadd_sat:
case Intrinsic::usub_sat: {
+ bool IsAdd = (Opc == Intrinsic::sadd_sat || Opc == Intrinsic::ssub_sat);
+ bool IsSigned = (Opc == Intrinsic::sadd_sat || Opc == Intrinsic::ssub_sat);
+ Type *RetTy = ICA.getReturnType();
+
+ if (RetTy->isIntegerTy()) {
+ if (IsSigned && ST->hasDSP() && RetTy->isIntegerTy(32))
+ return 1; // qadd / qsub
+ if (ST->hasDSP() && (RetTy->isIntegerTy(8) || RetTy->isIntegerTy(16)))
----------------
davemgreen wrote:
They would need to emit the cmp+sel for saturating to the original type.
https://github.com/llvm/llvm-project/pull/100988
More information about the llvm-commits
mailing list