From af2bcba81b87ffacfefada5be0afde2d20c365b1 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Fri, 18 Apr 2014 13:46:08 +0000 Subject: [PATCH] ARM64: make sure the caller is expected to extend in AAPCS. This is one of those DarwinPCS differences. It'd been caught in arguments, but not return values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206594 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetInfo.cpp | 5 +++-- test/CodeGen/arm64-aapcs-arguments.c | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 47c5269ec5..246f238e65 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -3368,8 +3368,9 @@ ABIArgInfo ARM64ABIInfo::classifyReturnType(QualType RetTy) const { if (const EnumType *EnumTy = RetTy->getAs()) RetTy = EnumTy->getDecl()->getIntegerType(); - return (RetTy->isPromotableIntegerType() ? ABIArgInfo::getExtend() - : ABIArgInfo::getDirect()); + return (RetTy->isPromotableIntegerType() && isDarwinPCS() + ? ABIArgInfo::getExtend() + : ABIArgInfo::getDirect()); } // Structures with either a non-trivial destructor or a non-trivial diff --git a/test/CodeGen/arm64-aapcs-arguments.c b/test/CodeGen/arm64-aapcs-arguments.c index 72527b5acf..b430630b07 100644 --- a/test/CodeGen/arm64-aapcs-arguments.c +++ b/test/CodeGen/arm64-aapcs-arguments.c @@ -33,3 +33,10 @@ typedef __attribute__((neon_vector_type(16))) signed char int8x16_t; typedef struct { int8x16_t arr[3]; } BigHFA; void test4(BigHFA v0_v2, BigHFA v3_v5, BigHFA sp, double sp48, BigHFA sp64) { } + +// It's the job of the argument *consumer* to perform the required sign & zero +// extensions under AAPCS. There shouldn't be + +// CHECK: define i8 @test5(i8 %a, i16 %b) +unsigned char test5(unsigned char a, signed short b) { +} -- 2.40.0