[cfe-commits] [patch] Allow complex long double to be homogeneous in ARM hardfloat
Tim Northover
t.p.northover at gmail.com
Fri Jul 20 13:00:12 PDT 2012
Hi,
Under ARM's AAPCS "long double" is just another name for "double"
which means that it can be part of a homogeneous aggregate and get
passed in VFP registers; but the function isHomogeneousAggregate which
is part of deciding where arguments should go isn't currently aware of
this (it checks for a declared type of "float" and "double" only).
The attached patch should fix this. OK to commit?
Cheers.
Tim.
-------------- next part --------------
>From a53f8455a78417010c81e4406185d441064fcf6f Mon Sep 17 00:00:00 2001
From: Tim Northover <Tim.Northover at arm.com>
Date: Fri, 20 Jul 2012 20:48:59 +0100
Subject: [PATCH] Complex long doubles are eligible to be treated as homogeneous aggregates
---
lib/CodeGen/TargetInfo.cpp | 3 ++-
test/CodeGen/arm-aapcs-vfp.c | 7 +++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index 9b91f63..386c7da 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -2623,7 +2623,8 @@ static bool isHomogeneousAggregate(QualType Ty, const Type *&Base,
// double, or 64-bit or 128-bit vectors.
if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) {
if (BT->getKind() != BuiltinType::Float &&
- BT->getKind() != BuiltinType::Double)
+ BT->getKind() != BuiltinType::Double &&
+ BT->getKind() != BuiltinType::LongDouble)
return false;
} else if (const VectorType *VT = Ty->getAs<VectorType>()) {
unsigned VecSize = Context.getTypeSize(VT);
diff --git a/test/CodeGen/arm-aapcs-vfp.c b/test/CodeGen/arm-aapcs-vfp.c
index 017c145..aee51e3 100644
--- a/test/CodeGen/arm-aapcs-vfp.c
+++ b/test/CodeGen/arm-aapcs-vfp.c
@@ -33,6 +33,13 @@ void test_complex(__complex__ double cd) {
complex_callee(cd);
}
+// Long double is the same as double on AAPCS, it should be homogeneous.
+extern void complex_long_callee(__complex__ long double);
+// CHECK: define arm_aapcs_vfpcc void @test_complex_long(double %{{.*}}, double %{{.*}})
+void test_complex_long(__complex__ long double cd) {
+ complex_callee(cd);
+}
+
// Structs with more than 4 elements of the base type are not treated
// as homogeneous aggregates. Test that.
--
1.7.0.4
More information about the cfe-commits
mailing list