[PATCH] D75689: [VectorCombine] fold extract-extract-op with different extraction indexes

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 09:18:10 PST 2020


spatel created this revision.
spatel added reviewers: lebedev.ri, RKSimon, efriedma.
Herald added subscribers: arphaman, hiraditya, mcrosier.
Herald added a project: LLVM.

opcode (extelt V0, Ext0), (ext V1, Ext1) --> extelt (opcode (splat V0, Ext0), V1), Ext1

The first part of this patch generalizes the cost calculation to accept different extraction indexes. The second part creates a shuffle+extract before feeding into the existing code to create a vector op+extract.

The patch conservatively uses "TargetTransformInfo::SK_PermuteSingleSrc" rather than "TargetTransformInfo::SK_Broadcast" (splat specifically from element 0) because we do not have a more general "SK_Splat" currently. That does not affect any of the current regression tests, but we might be able to find some cost model target specialization where that comes into play.

I suspect that we can expose some missing x86 horizontal op codegen with this transform, so I'm speculatively adding a debug flag to disable the binop variant of this transform to allow easier testing.

The test changes show that we're sensitive to cost model diffs (as we should be), so that means that patches like D74976 <https://reviews.llvm.org/D74976> should have better coverage.


https://reviews.llvm.org/D75689

Files:
  llvm/lib/Transforms/Vectorize/VectorCombine.cpp
  llvm/test/Transforms/VectorCombine/X86/extract-binop.ll
  llvm/test/Transforms/VectorCombine/X86/extract-cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75689.248494.patch
Type: text/x-patch
Size: 16324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200305/52bbecfb/attachment.bin>


More information about the llvm-commits mailing list