[PowerPC] ABI support for non-Altivec vector types
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 10 Jul 2014 16:39:01 +0000 (16:39 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 10 Jul 2014 16:39:01 +0000 (16:39 +0000)
commitf4eba98853dbb8fa1adbd29a2e697f94818c5a7a
tree463af82fe09042f06572cacb03e97f312c18c710
parent57417d0d972f41c99173663a0131f1e85ee991f5
[PowerPC] ABI support for non-Altivec vector types

This patch adds support for passing arguments of non-Altivec vector type
(i.e. defined via attribute ((vector_size (...)))) on powerpc64-linux.

While such types are not mentioned in the formal ABI document, this
patch implements a calling convention compatible with GCC:

- Vectors of size < 16 bytes are passed in a GPR
- Vectors of size > 16 bytes are passed via reference

Note that vector types with a number of elements that is not a power
of 2 are not supported by GCC, so there is no pre-existing ABI to
follow.  We choose to pass those (of size < 16) as if widened to the
next power of two, so they might end up in a vector register or
in a GPR.  (Sizes > 16 are always passed via reference as well.)

Reviewed by Hal Finkel.

llvm-svn: 212734
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/ppc64-vector.c [new file with mode: 0644]