From 3b694fab31d3a7a8379996cbe7ef8d53f7d677bc Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Wed, 2 Nov 2011 04:51:36 +0000 Subject: [PATCH] Check for homogeneous aggregate return values with ARM's AAPCS-VFP ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143530 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetInfo.cpp | 8 ++++++++ test/CodeGen/arm-aapcs-vfp.c | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 3744a29b3e..88505e695d 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -2671,6 +2671,14 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy) const { if (isEmptyRecord(getContext(), RetTy, true)) return ABIArgInfo::getIgnore(); + // Check for homogeneous aggregates with AAPCS-VFP. + if (getABIKind() == AAPCS_VFP) { + const Type *Base = 0; + if (isHomogeneousAggregate(RetTy, Base, getContext())) + // Homogeneous Aggregates are returned directly. + return ABIArgInfo::getDirect(); + } + // Aggregates <= 4 bytes are returned in r0; other aggregates // are returned indirectly. uint64_t Size = getContext().getTypeSize(RetTy); diff --git a/test/CodeGen/arm-aapcs-vfp.c b/test/CodeGen/arm-aapcs-vfp.c index 20b8a742dd..017c14524e 100644 --- a/test/CodeGen/arm-aapcs-vfp.c +++ b/test/CodeGen/arm-aapcs-vfp.c @@ -12,10 +12,10 @@ struct homogeneous_struct { float f3; float f4; }; -// CHECK: define arm_aapcs_vfpcc void @test_struct(float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}) -extern void struct_callee(struct homogeneous_struct); -void test_struct(struct homogeneous_struct arg) { - struct_callee(arg); +// CHECK: define arm_aapcs_vfpcc %struct.homogeneous_struct @test_struct(float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}) +extern struct homogeneous_struct struct_callee(struct homogeneous_struct); +struct homogeneous_struct test_struct(struct homogeneous_struct arg) { + return struct_callee(arg); } struct nested_array { -- 2.40.0