[PATCH] D55481: [CostModel][X86] Have getArithmeticReductionCost call back to the target code after the loop reaches a legal type. Only handle legal/simple types from the X86 code

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 8 17:24:43 PST 2018


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, ABataev.

Previously X86 would call getTypeLegalizationCost then do the table look up and multiply the result by the splitting cost. But that's not really representative of how the reduction occurs. For example it will count the cost of the extract element multiple times. And for the non-pairwise case, a reduction on a large vector type just does a bunch of packed operations on full legal registers until we're down to only a single register of values. Then the horizontal shuffling starts happening.

This patch has the base implementation call back to the target implementation once we've reached a legal type. Since that's likely the case where the target may have some horizontal tricks. If the target doesn't have special handling we should just come back to the base implementation, but end up in the lower part of the code. I've changed X86 to only do lookups on simple types and illegal types will then go to the base implementation for legalization.


https://reviews.llvm.org/D55481

Files:
  include/llvm/CodeGen/BasicTTIImpl.h
  lib/Target/X86/X86TargetTransformInfo.cpp
  test/Analysis/CostModel/X86/reduce-add-widen.ll
  test/Analysis/CostModel/X86/reduce-add.ll
  test/Analysis/CostModel/X86/reduction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55481.177401.patch
Type: text/x-patch
Size: 68362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181209/1203da8c/attachment.bin>


More information about the llvm-commits mailing list