[PATCH] D103952: [CostModel][AArch64] Improve the cost estimate of CTPOP intrinsic

Rosie Sumpter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 9 09:47:53 PDT 2021


RosieSumpter added inline comments.


================
Comment at: llvm/test/Analysis/CostModel/AArch64/ctpop.ll:168
 ; CHECK-LABEL: 'test_ctpop_v32i8'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %ctpop
----------------
RosieSumpter wrote:
> SjoerdMeijer wrote:
> > Does this really have a cost of only 2?
> > 
> > I guess it's 2 because `LT.first * Entry->Cost = 2 * 1 = 2`
> > 
> > So I am wondering if it is easier to expand the table with vector types, and if the lookup fails let it fall back to the generic function that will hopefully then assign a high cost for it.
> I did try doing a check of the codegen for the large vector cases and they did seem to be double the cost, but I understand it is probably safer to expand the table so I'm happy to do that
The costs for the large vectors are all now 4 as they fall through to a CustomCost of LT.first*2 in BasicTTIImpl.h. Is this what we want?


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

https://reviews.llvm.org/D103952



More information about the llvm-commits mailing list