Sfoglia il codice sorgente

Add "long double" to permitted list of ARM complex homogeneous aggregates.

Under AAPCS, long double is the same as double, which means it should be
allowed as part of a homogeneous aggregate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160586 91177308-0d34-0410-b5e6-96231b3b80d8
Tim Northover 13 anni fa
parent
commit
adfa45ffd6
2 ha cambiato i file con 9 aggiunte e 1 eliminazioni
  1. 2 1
      lib/CodeGen/TargetInfo.cpp
  2. 7 0
      test/CodeGen/arm-aapcs-vfp.c

+ 2 - 1
lib/CodeGen/TargetInfo.cpp

@@ -2623,7 +2623,8 @@ static bool isHomogeneousAggregate(QualType Ty, const Type *&Base,
     // double, or 64-bit or 128-bit vectors.
     // double, or 64-bit or 128-bit vectors.
     if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) {
     if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) {
       if (BT->getKind() != BuiltinType::Float && 
       if (BT->getKind() != BuiltinType::Float && 
-          BT->getKind() != BuiltinType::Double)
+          BT->getKind() != BuiltinType::Double &&
+          BT->getKind() != BuiltinType::LongDouble)
         return false;
         return false;
     } else if (const VectorType *VT = Ty->getAs<VectorType>()) {
     } else if (const VectorType *VT = Ty->getAs<VectorType>()) {
       unsigned VecSize = Context.getTypeSize(VT);
       unsigned VecSize = Context.getTypeSize(VT);

+ 7 - 0
test/CodeGen/arm-aapcs-vfp.c

@@ -34,6 +34,13 @@ void test_complex(__complex__ double cd) {
   complex_callee(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
 // Structs with more than 4 elements of the base type are not treated
 // as homogeneous aggregates.  Test that.
 // as homogeneous aggregates.  Test that.