]> granicus.if.org Git - clang/commitdiff
ARM/APCS: Pass Complex types following llvm-gcc.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 1 Feb 2010 23:31:19 +0000 (23:31 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 1 Feb 2010 23:31:19 +0000 (23:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95029 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetInfo.cpp
test/CodeGen/arm-arguments.c

index 92ff312425980abc3dc85c7039ab80e13db32018..c0b5f655fa6f2348f3b73cdf2c8265f683cb257f 100644 (file)
@@ -1661,6 +1661,14 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy,
     if (isEmptyRecord(Context, RetTy, false))
       return ABIArgInfo::getIgnore();
 
+    // Complex types are all returned as packed integers.
+    //
+    // FIXME: Consider using 2 x vector types if the back end handles them
+    // correctly.
+    if (RetTy->isAnyComplexType())
+      return ABIArgInfo::getCoerce(llvm::IntegerType::get(
+                                     VMContext, Context.getTypeSize(RetTy)));
+
     // Integer like structures are returned in r0.
     if (isIntegerLikeType(RetTy, Context, VMContext)) {
       // Return in the smallest viable integer type.
index c97c97bc581ee115f7c0e19e55cd7cf553ffdf65..e5b41da38b8c9b946d2233d63d4cf393c42af00c 100644 (file)
@@ -119,3 +119,22 @@ struct s20 f20(void) {}
 // AAPCS: define arm_aapcscc i32 @f21()
 struct s21 { struct {} f1; int f0 : 4; };
 struct s21 f21(void) {}
+
+// APCS-GNU: define arm_apcscc i16 @f22()
+// APCS-GNU: define arm_apcscc i32 @f23()
+// APCS-GNU: define arm_apcscc i64 @f24()
+// APCS-GNU: define arm_apcscc i128 @f25()
+// APCS-GNU: define arm_apcscc i64 @f26()
+// APCS-GNU: define arm_apcscc i128 @f27()
+// AAPCS: define arm_aapcscc i16 @f22()
+// AAPCS: define arm_aapcscc i32 @f23()
+// AAPCS: define arm_aapcscc void @f24({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f25({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f26({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f27({{.*}} noalias sret
+_Complex char       f22(void) {}
+_Complex short      f23(void) {}
+_Complex int        f24(void) {}
+_Complex long long  f25(void) {}
+_Complex float      f26(void) {}
+_Complex double     f27(void) {}