diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2012-11-05 19:13:42 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2012-11-05 19:13:42 +0000 |
commit | 77ed89dbad943d657dcc79fa29f92fe6abd74efc (patch) | |
tree | addb5d7a42d1d3bdd5a32afd0e839466fe4bfd2f /clang/test/CodeGen | |
parent | 2cce3f91f89e9ca353412db6c9e2b90b02d563fb (diff) | |
download | bcm5719-llvm-77ed89dbad943d657dcc79fa29f92fe6abd74efc.tar.gz bcm5719-llvm-77ed89dbad943d657dcc79fa29f92fe6abd74efc.zip |
On PowerPC64, integer arguments and return values need to be sign- or
zero-extended to 64 bits. This information is currently provided to
the back end by setting "signext" or "zeroext" attributes. However,
this is done only for integer types *smaller* than i32, not for i32
itself. This causes clang to generate code violating the ABI, which
results in a failure of the tramp3d-v4 test case (due to calling a
system library routine without ABI-required extension).
This patch implements custom versions of classifyArgumentType and
classifyReturnType for PPC64_SVR4_ABIInfo, which are the same as the
default versions except that they also classify "int" and "unsigned int"
as types needing extending. This fixed tramp3d-v4 on PowerPC64.
llvm-svn: 167393
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r-- | clang/test/CodeGen/ppc64-extend.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/CodeGen/ppc64-extend.c b/clang/test/CodeGen/ppc64-extend.c new file mode 100644 index 00000000000..f4d6bf9c68d --- /dev/null +++ b/clang/test/CodeGen/ppc64-extend.c @@ -0,0 +1,15 @@ +// REQUIRES: ppc64-registered-target +// RUN: %clang_cc1 -O0 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s + +void f1(int x) { return; } +// CHECK: define void @f1(i32 signext %x) nounwind + +void f2(unsigned int x) { return; } +// CHECK: define void @f2(i32 zeroext %x) nounwind + +int f3(void) { return 0; } +// CHECK: define signext i32 @f3() nounwind + +unsigned int f4(void) { return 0; } +// CHECK: define zeroext i32 @f4() nounwind + |