[PATCH][PPC64LE] Correct little-endian usage of vmrgh* and vmrgl*.
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 25 Jul 2014 01:55:55 +0000 (01:55 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 25 Jul 2014 01:55:55 +0000 (01:55 +0000)
commitc9fa5dd61882c2b272d887abc3a33dae5bbbcedc
treeec7dd80fac172ea19ee8f1aa04a1d673b7e7d342
parentd9474064271271af78c2a1eecec6fe6ccc028918
[PATCH][PPC64LE] Correct little-endian usage of vmrgh* and vmrgl*.

Because the PowerPC vmrgh* and vmrgl* instructions have a built-in
big-endian bias, it is necessary to swap their inputs in little-endian
mode when using them to implement a vector shuffle.  This was
previously missed in the vector LE implementation.

There was already logic to distinguish between unary and "normal"
vmrg* vector shuffles, so this patch extends that logic to use a third
option:  "swapped" vmrg* vector shuffles that are used for little
endian in place of the "normal" ones.

I've updated the vec-shuffle-le.ll test to check for the expected
register ordering on the generated instructions.

This bug was discovered when testing the LE and ELFv2 patches for
safety if they were backported to 3.4.  A different vectorization
decision was made in 3.4 than on mainline trunk, and that exposed the
problem.  I've verified this fix takes care of that issue.

llvm-svn: 213915
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/lib/Target/PowerPC/PPCInstrAltivec.td
llvm/test/CodeGen/PowerPC/vec_shuffle_le.ll