summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2014-06-05 19:07:40 +0000
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>2014-06-05 19:07:40 +0000
commitf7e289c0f25c920368b28d0d9d3be64d882f32cb (patch)
tree8697c45901c267a744c1d49701f6a7c8240ff4fb /llvm/lib/IR/Attributes.cpp
parentf56a29924f2f32a1d688e516302c44092c07f15d (diff)
downloadbcm5719-llvm-f7e289c0f25c920368b28d0d9d3be64d882f32cb.tar.gz
bcm5719-llvm-f7e289c0f25c920368b28d0d9d3be64d882f32cb.zip
[PPC64LE] Implement little-endian semantics for vec_perm
The PowerPC vperm (vector permute) instruction is defined architecturally with a big-endian bias, in that the two input vectors are assumed to be concatenated "left to right" and the elements of the combined input vector are assumed to be numbered from "left to right" (i.e., with element 0 referencing the high-order element). This definition is unnatural for little-endian code generation. To facilitate ease of porting, the vec_perm interface is 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 with the vperm instruction provided that the two input vector registers are reversed, and the permute control vector is complemented. The complementing is performed using an xor with a vector containing all one bits. Only the rightmost 5 bits of each element of the permute control vector are relevant, so it would be possible to complement the vector with respect to a <16xi8> vector containing all 31s. However, when the permute control vector is not a constant, using 255 instead has the advantage that the vec_xor can be recognized during code generation as a vnor instruction. (Power8 introduces a vnand instruction which could alternatively be generated.) The correctness of this code is tested by the new perm.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: 210279
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud