[PATCH] D110739: [CostModel] Update default cost model for sadd/ssub overflow to match TargetLowering

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 02:25:18 PDT 2021


RKSimon accepted this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.

LGTM - cheers



================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1797
       InstructionCost Cost = 0;
       Cost += thisT()->getArithmeticInstrCost(Opcode, SumTy, CostKind);
       Cost += 2 * thisT()->getCmpSelInstrCost(
----------------
craig.topper wrote:
> RKSimon wrote:
> > Worth trying to specify the Args as well via the IntrinsicCostAttributes arg?
> You mean to get the getArithmeticInstrCost calls? I don't see any arg operands for getCmpSelInstrCost.
OK - that's probably not going to help for add/sub anyhow.


================
Comment at: llvm/test/Transforms/LoopVectorize/ARM/mve-saddsatcost.ll:11
+; CHECK-COST: Found an estimated cost of 7 for VF 1 For instruction:   %1 = tail call i16 @llvm.sadd.sat.i16(i16 %0, i16 %offset)
 ; CHECK-COST: Found an estimated cost of 36 for VF 2 For instruction:   %1 = tail call i16 @llvm.sadd.sat.i16(i16 %0, i16 %offset)
 ; CHECK-COST: Found an estimated cost of 8 for VF 4 For instruction:   %1 = tail call i16 @llvm.sadd.sat.i16(i16 %0, i16 %offset)
----------------
This still looks suspiciously high


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110739/new/

https://reviews.llvm.org/D110739



More information about the llvm-commits mailing list