From: Daniel Dunbar Date: Mon, 1 Feb 2010 23:31:26 +0000 (+0000) Subject: ARM/APCS: Fix classification of small complex integer types as "integer like". X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4581581881d3f7349bf5a4b39d761bce688f9164;p=clang ARM/APCS: Fix classification of small complex integer types as "integer like". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95030 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index c0b5f655fa..07f116a0e0 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -1585,9 +1585,9 @@ static bool isIntegerLikeType(QualType Ty, if (Ty->getAs() || Ty->isPointerType()) return true; - // Complex types "should" be ok by the definition above, but they are not. - if (Ty->isAnyComplexType()) - return false; + // Small complex integer types are "integer like". + if (const ComplexType *CT = Ty->getAs()) + return isIntegerLikeType(CT->getElementType(), Context, VMContext); // Single element and zero sized arrays should be allowed, by the definition // above, but they are not. diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c index e5b41da38b..d313a9b331 100644 --- a/test/CodeGen/arm-arguments.c +++ b/test/CodeGen/arm-arguments.c @@ -138,3 +138,18 @@ _Complex int f24(void) {} _Complex long long f25(void) {} _Complex float f26(void) {} _Complex double f27(void) {} + +// APCS-GNU: define arm_apcscc i16 @f28() +// AAPCS: define arm_aapcscc i16 @f28() +struct s28 { _Complex char f0; }; +struct s28 f28() {} + +// APCS-GNU: define arm_apcscc i32 @f29() +// AAPCS: define arm_aapcscc i32 @f29() +struct s29 { _Complex short f0; }; +struct s29 f29() {} + +// APCS-GNU: define arm_apcscc void @f30({{.*}} noalias sret +// AAPCS: define arm_aapcscc void @f30({{.*}} noalias sret +struct s30 { _Complex int f0; }; +struct s30 f30() {}