[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)
commit6b5a7dfc24f82f5702cf96acb6d056954897e8ff
treeddd266356feec68d16561a0087d650dcb2290755
parent8000e2734ec5f45c9c56a54b8a1b19375572ec4e
[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.

llvm-svn: 210493
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/test/CodeGen/PowerPC/vec_misaligned.ll