[PATCH] D113609: [X86][Costmodel] `getReplicationShuffleCost()`: promote 16 bit-wide elements to 32 bit when no AVX512BW

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 13:16:46 PST 2021


lebedev.ri created this revision.
lebedev.ri added a reviewer: RKSimon.
lebedev.ri added a project: LLVM.
Herald added subscribers: pengfei, hiraditya.
lebedev.ri requested review of this revision.

Ok, the code change looks scary, but this is mostly just renames.
Let me know if i should just precommit most of this as NFC,
and leave only the

  diff
  -return bailout();
  +ShufEltTyBits = 32; // promote to i32, AVX512F.

The basic idea is simple, if we don't have native shuffle for this element type,
then we must have native shuffle for wider element type,
so promote, replicate, demote.

Some costs look rather iffy, i suspect `X86TTIImpl::getCastInstrCost()` may need tuning.

I believe, asking `getCastInstrCost(Instruction::Trunc` is correct semantically,
case in point `trunc <32 x i32> to <32 x i8>` aka 2 * ZMM will naively result in 
2 * XMM, that then will be packed into 1 * YMM,
and it should count the cost of said packing,
not just the truncations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113609

Files:
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/test/Analysis/CostModel/X86/shuffle-replication-i16.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113609.386296.patch
Type: text/x-patch
Size: 89944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/c8fbd542/attachment.bin>


More information about the llvm-commits mailing list