[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)
commit982f60be4432d66d819b6018ebbdb19379f29e72
tree9ffee291a419db61a8960bbe0042080de761fcbb
parent0358a25e786b67b783063be8c8c2c8dc285f2e8c
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236606 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
test/CodeGen/PowerPC/swaps-le-2.ll [new file with mode: 0644]