[PATCH] D121354: [SLP] Fix lookahead operand reordering for splat loads.

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 21:45:04 PST 2022


vporpo created this revision.
vporpo added reviewers: ABataev, RKSimon, fhahn.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
vporpo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Splat loads are inexpensive in X86. For a 2-lane vector we need just one
instruction: `movddup (%reg), xmm0`. Using the standard Splat score leads
to worse code. This patch adds a new score dedicated for splat loads.

Please note that a splat is usually three IR instructions:

- It is usually a load and 2 inserts: %ld = load double, double* %gep %ins1 = insertelement <2 x double> poison, double %ld, i32 0 %ins2 = insertelement <2 x double> %ins1, double %ld, i32 1

- But it can also be a load, an insert and a shuffle: %ld = load double, double* %gep %ins = insertelement <2 x double> poison, double %ld, i32 0 %shf = shufflevector <2 x double> %ins, <2 x double> poison, <2 x i32> zeroinitializer

Because of this some of the lit tests contain more IR instructions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121354

Files:
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll
  llvm/test/Transforms/SLPVectorizer/X86/operandorder.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121354.414275.patch
Type: text/x-patch
Size: 11057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220310/69872a18/attachment.bin>


More information about the llvm-commits mailing list