[PATCH] D77448: [PowerPC] Canonicalize shuffles to match more single-instruction masks on LE

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 18:26:24 PDT 2020


nemanjai created this revision.
nemanjai added reviewers: PowerPC, hfinkel.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: LLVM.

We currently miss a number of opportunities to emit single-instruction VMRG[LH][BHW] instructions for shuffles on little endian subtargets. Although this in itself is not a huge performance opportunity since loading the permute vector for a VPERM can always be pulled out of loops, producing such merge instructions is useful to downstream optimizations.
Since VPERM is essentially opaque to all subsequent optimizations, we want to avoid it as much as possible. Other permute instructions have semantics that can be reasoned about much more easily in later optimizations.

This patch does the following:

- Canonicalize shuffles so that the first element comes from the first vector (since that's what most of the mask matching functions want)
- Switch the elements that come from splat vectors so that they match the corresponding elements from the other vector (to allow for merges)
- Adds debugging messages for when a shuffle is matched to a VPERM so that anyone interested in improving this further can get the info for their code


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77448

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/test/CodeGen/PowerPC/canonical-merge-shuffles.ll
  llvm/test/CodeGen/PowerPC/pre-inc-disable.ll
  llvm/test/CodeGen/PowerPC/scalar_vector_test_4.ll
  llvm/test/CodeGen/PowerPC/vec_conv_i16_to_fp32_elts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77448.254972.patch
Type: text/x-patch
Size: 21114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200404/99eb4271/attachment.bin>


More information about the llvm-commits mailing list