[PATCH] D107228: [TTI] Add basic SK_InsertSubvector shuffle mask recognition

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 31 11:47:03 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: ABataev, dmgreen, pengfei, fhahn, spatel.
Herald added subscribers: dexonsmith, hiraditya, kristof.beyls.
RKSimon requested review of this revision.
Herald added a project: LLVM.

This patch adds an initial ShuffleVectorInst::isInsertSubvectorMask helper to recognize 2-op shuffles where the lowest elements of one of the sources are being inserted into the "in-place" other operand, this includes "concat_vectors" patterns as can be seen in the Arm shuffle cost changes. This also helped fix a x86 issue with irregular/length-changing SK_InsertSubvector costs - I'm hoping this will help with D107188 <https://reviews.llvm.org/D107188>

This doesn't currently attempt to work with 1-op shuffles that could either be a "widening" shuffle or a self-insertion. The widening case probably needs addressing separately as in most cases this should have a zero cost. The self-insertion case is trickier, but we currently always match this with the existing SK_PermuteSingleSrc logic.

Masks with a high number of undef elts will still struggle to match optimal subvector widths - its currently bounded by minimum-width possible insertion, whilst some cases would benefit from wider subvectors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107228

Files:
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/IR/Instructions.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/test/Analysis/CostModel/ARM/shuffle.ll
  llvm/test/Analysis/CostModel/X86/shuffle-insert_subvector.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107228.363310.patch
Type: text/x-patch
Size: 223139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210731/0e96abe7/attachment-0001.bin>


More information about the llvm-commits mailing list