PPC: Initial support for permutation-based unaligned Altivec loads
authorHal Finkel <hfinkel@anl.gov>
Fri, 24 May 2013 23:00:14 +0000 (23:00 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 24 May 2013 23:00:14 +0000 (23:00 +0000)
commit80d10ded8cd4f34b87d82b03d6f63328ea337b26
tree238b9081baf073661f9ae2bfc3ed8e22f7935110
parent3b77151a61d2985ad5b29ee3d05b34d553322c2a
PPC: Initial support for permutation-based unaligned Altivec loads

Altivec only directly supports aligned loads, but the loads have a strange
property: If given an unaligned address, they truncate the address to the next
lower aligned address, and load from there.  This property, along with an extra
load and some special-purpose permutation-control instructions that generate
the appropriate permutations from the original unaligned address, allow
efficient lowering of aligned loads. This code uses the trick explained in the
Apple Velocity Engine optimization overview document to prevent the needed
extra load from possibly causing a page fault if the original address happens
to be aligned.

As noted in the FIXMEs, there are several additional optimizations that can be
performed to reduce the cost of these loads even more. These will be
implemented in future commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182691 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/unal-altivec.ll [new file with mode: 0644]