[PPC64LE] Generate correct code for unaligned little-endian vector loads
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 9 Jun 2014 22:00:52 +0000 (22:00 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 9 Jun 2014 22:00:52 +0000 (22:00 +0000)
commit8e38e862667e89ac928b8f5e7ce0a91c84fae4bc
tree70eeb1b7619d563cba32e7f94062f45365be0ed0
parentf4a702c079674120bbc95c3474602334274c6046
[PPC64LE] Generate correct code for unaligned little-endian vector loads

The code in PPCTargetLowering::PerformDAGCombine() that handles
unaligned Altivec vector loads generates a lvsl followed by a vperm.
As we've seen in numerous other places, the vperm instruction has a
big-endian bias, and this is fixed for little endian by complementing
the permute control vector and swapping the input operands.  In this
case the lvsl is providing the permute control vector.  Rather than
generating an lvsl and a complement operation, it is sufficient to
generate an lvsr instruction instead.  Thus for LE code generation we
will generate an lvsr rather than an lvsl, and swap the other input
arguments on the vperm.

The existing test/CodeGen/PowerPC/vec_misalign.ll is updated to test
the code generation for PPC64 and PPC64LE, in addition to the existing
PPC32/G5 testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210493 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/vec_misaligned.ll