summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-05-12 15:22:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-05-12 15:22:40 +0000
commit203e2e8dd8c55496a6e47f5b1aacc22f4324711c (patch)
treea12f258c0fa4e1ad936695b2281a1a0407ca93a9
parent08a2ede018e57e1bff0a4b3ee8dee5d5144897d5 (diff)
downloadbcm5719-llvm-203e2e8dd8c55496a6e47f5b1aacc22f4324711c.tar.gz
bcm5719-llvm-203e2e8dd8c55496a6e47f5b1aacc22f4324711c.zip
x86-64 ABI: clang incorrectly passes union { long double, float } in
register. - Merge algorithm was returning MEMORY as it should. llvm-svn: 71556
-rw-r--r--clang/lib/CodeGen/CGCall.cpp3
-rw-r--r--clang/test/CodeGen/x86_64-arguments.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index c46e7901d9f..a1427293439 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -633,7 +633,8 @@ X86_64ABIInfo::Class X86_64ABIInfo::merge(Class Accum,
return Field;
else if (Accum == Integer || Field == Integer)
return Integer;
- else if (Field == X87 || Field == X87Up || Field == ComplexX87)
+ else if (Field == X87 || Field == X87Up || Field == ComplexX87 ||
+ Accum == X87 || Accum == X87Up)
return Memory;
else
return SSE;
diff --git a/clang/test/CodeGen/x86_64-arguments.c b/clang/test/CodeGen/x86_64-arguments.c
index fa73f7de674..2e5debe7cba 100644
--- a/clang/test/CodeGen/x86_64-arguments.c
+++ b/clang/test/CodeGen/x86_64-arguments.c
@@ -52,4 +52,7 @@ struct s9 { int a; int b; int : 0; } f9(void) {}
struct s10 { int a; int b; int : 0; };
void f10(struct s10 a0) {}
+// RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t &&
+union { long double a; float b; } f11() {}
+
// RUN: true
OpenPOWER on IntegriCloud