[PATCH] [PPC64LE] Remove unnecessary swaps from lane-insensitive vector computations

Bill Schmidt wschmidt at linux.vnet.ibm.com
Mon Mar 23 14:08:10 PDT 2015


Hi hfinkel, kbarton, seurer, nemanjai,

This patch adds a new SSA MI pass that runs on little-endian PPC64 code with VSX enabled.  Loads and stores of 4x32 and 2x64 vectors without alignment constraints are accomplished for little-endian using lxvd2x/xxswapd and xxswapd/stxvd2x.  The existence of the additional xxswapd instructions hurts performance in comparison with big-endian code, but they are necessary in the general case to support correct semantics.

However, the general case does not apply to most vector code.  Many vector instructions are lane-insensitive; they do not "care" which lanes the parallel computations are performed within, provided that the resulting data is stored into the correct locations.  Thus this pass looks for computations that perform only lane-insensitive operations, and remove the unnecessary swaps from loads and stores in such computations.

Future improvements will allow computations using certain lane-sensitive operations to also be optimized in this manner, by modifying the lane-sensitive operations to account for the permuted order of the lanes.  However, this patch only adds the infrastructure to permit this; no lane-sensitive operations are optimized at this time.

I have a few questions about infrastructure; these are flagged as FIXMEs in the commentary.  Reviewers, I'd appreciate your opinions on these!

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8565

Files:
  lib/Target/PowerPC/CMakeLists.txt
  lib/Target/PowerPC/PPC.h
  lib/Target/PowerPC/PPCTargetMachine.cpp
  lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
  test/CodeGen/PowerPC/swaps-le-1.ll
  test/CodeGen/PowerPC/vsx-ldst-builtin-le.ll
  test/CodeGen/PowerPC/vsx-ldst.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8565.22514.patch
Type: text/x-patch
Size: 34432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150323/41bdc25c/attachment.bin>


More information about the llvm-commits mailing list