Skip to content

Commit

Permalink
Check for homogeneous aggregate return values with ARM's AAPCS-VFP ABI.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143530 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bob-wilson committed Nov 2, 2011
1 parent 19bda3a commit 3b694fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions lib/CodeGen/TargetInfo.cpp
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/CodeGen/arm-aapcs-vfp.c
Expand Up @@ -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 {
Expand Down

0 comments on commit 3b694fa

Please sign in to comment.