From d53bac7fa4fc0198d94de0894a92af4548f5b4f0 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 14 Sep 2009 02:20:34 +0000 Subject: [PATCH] ARM/APCS: Don't treat structs w/ floating point types as "integer like". llvm-svn: 81748 --- clang/lib/CodeGen/TargetABIInfo.cpp | 4 ++++ clang/test/CodeGen/arm-arguments.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/clang/lib/CodeGen/TargetABIInfo.cpp b/clang/lib/CodeGen/TargetABIInfo.cpp index 1dd88bb48129..c403960580a3 100644 --- a/clang/lib/CodeGen/TargetABIInfo.cpp +++ b/clang/lib/CodeGen/TargetABIInfo.cpp @@ -1430,6 +1430,10 @@ static bool isIntegerLikeType(QualType Ty, if (Ty->isVectorType()) return false; + // Float types are never treated as "integer like". + if (Ty->isRealFloatingType()) + return false; + // If this is a builtin or pointer type then it is ok. if (Ty->getAsBuiltinType() || Ty->isPointerType()) return true; diff --git a/clang/test/CodeGen/arm-arguments.c b/clang/test/CodeGen/arm-arguments.c index 0448f92aa415..e58d2fddefcb 100644 --- a/clang/test/CodeGen/arm-arguments.c +++ b/clang/test/CodeGen/arm-arguments.c @@ -70,3 +70,17 @@ struct s11 f11(void) {} // AAPCS: define arm_aapcscc i32 @f12() union u12 { char f0; short f1; int f2; }; union u12 f12(void) {} + +// APCS-GNU: define arm_apcscc void @f13( +// APCS-GNU: struct.s13* noalias sret + +// FIXME: This should return a float. +// AAPCS-FIXME: define arm_aapcscc float @f13() +struct s13 { float f0; }; +struct s13 f13(void) {} + +// APCS-GNU: define arm_apcscc void @f14( +// APCS-GNU: struct.s13* noalias sret +// AAPCS: define arm_aapcscc i32 @f14() +union u14 { float f0; }; +union u14 f14(void) {}