[PPC64LE] Enable missing lxvdsx optimization, and related swap optimization
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Wed, 1 Jul 2015 19:40:07 +0000 (19:40 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Wed, 1 Jul 2015 19:40:07 +0000 (19:40 +0000)
commit9215b9ab25969b73a18127d33ce742de3866b738
tree138548d0264bd06c4d64fd8128e19df8a70fc073
parent7472456fe973adfd371890fddf16d087569e90a5
[PPC64LE] Enable missing lxvdsx optimization, and related swap optimization

When adding little-endian vector support for PowerPC last year, I
inadvertently disabled an optimization that recognizes a load-splat
idiom and generates the lxvdsx instruction.  This patch moves the
offending logic so lxvdsx is once again generated.

This pattern is frequently generated by the vectorizer for scalar
loads of an effective constant.  Previously the lxvdsx instruction was
wrongly listed as lane-sensitive for the VSX swap optimization (since
both doublewords are identical, swaps are safe).  This patch fixes
this as well, so that vectorized code using lxvdsx can now have swaps
removed from the computation.

There is an existing test (@test50) in test/CodeGen/PowerPC/vsx.ll
that checks for the missing optimization.  However, vsx.ll was only
being tested for POWER7 with big-endian code generation.  I've added
a little-endian RUN statement and expected LE code generation for all
the tests in vsx.ll to give us a bit better VSX coverage, including
what's needed for this patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241183 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelDAGToDAG.cpp
lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
test/CodeGen/PowerPC/vsx.ll