[PPC64LE] Adjust vector splats during VSX swap optimization
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Wed, 6 May 2015 15:40:46 +0000 (15:40 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Wed, 6 May 2015 15:40:46 +0000 (15:40 +0000)
commit5fe2e25f7c340666092da87cee27b5da614ecdfb
tree174029c25b7beb86608ee53bcaa32e8fce1df1ba
parentd167d428883ea2c0bf3134e425536c3049ffb748
[PPC64LE] Adjust vector splats during VSX swap optimization

The initial code drop for VSX swap optimization permitted the
optimization only when all operations in a web of related computation
are lane-insensitive.  For some lane-sensitive operations, we can
still permit the optimization provided that we make adjustments to
those operations.  This patch adds special handling for vector splats
so that their presence doesn't kill the optimization.

Vector splats are lane-sensitive since they identify by number a
vector element to be used as the source of a splat.  When swap
optimizations take place, the desired vector element will move to the
opposite doubleword of the quadword vector.  We thus replace the index
I by (I + N/2) % N, where N is the number of elements in the vector.

A new test case is added to test that swap optimization succeeds when
vector splats are present, and that the proper input element is used
as the source of the splat.

An ancillary change removes SH_BUILDVEC as one of the kinds of special
handling that may be required by VSX swap optimization.  From
experience with GCC, I had expected to need some modifications for
vector build operations, but I did not find that to be the case.

llvm-svn: 236606
llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
llvm/test/CodeGen/PowerPC/swaps-le-2.ll [new file with mode: 0644]