[PPC64LE] Implement little-endian semantics for vec_mul[eo]
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 6 Jun 2014 14:45:06 +0000 (14:45 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 6 Jun 2014 14:45:06 +0000 (14:45 +0000)
commit7c0114f6e373497855844a063e9c2d9c4966da58
tree90c90552593c65e7ad788480466c0cd34a348b78
parent4aedff8995d3e0788fd2e84079e5b19fcdf899c5
[PPC64LE] Implement little-endian semantics for vec_mul[eo]

The PowerPC vector-multiply-even and vector-multiply-odd instructions
are defined architecturally with a big-endian bias, in that the vector
element numbering is assumed to be "left to right" regardless of
whether the processor is in big-endian or little-endian mode.  This
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_mule and vec_mulo interfacs are
designed to use natural element ordering, so that elements are
numbered according to little-endian design principles when code is
generated for a little-endian target.  The desired semantics can be
achieved by using the opposite instruction for little-endian mode.
That is, when a call to vec_mule appears in the code, a
vector-multiply-odd is generated, and when a call to vec_mulo appears
in the code, a vector-multiply-even is generated.

The correctness of this code is tested by the new mult-even-odd.c test
added in a previous patch.  I plan to later make the existing ppc32
Altivec compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210337
clang/lib/Headers/altivec.h