summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Dewhurst <chris.dewhurst@lero.ie>2016-06-08 14:46:05 +0000
committerChris Dewhurst <chris.dewhurst@lero.ie>2016-06-08 14:46:05 +0000
commitea61147fc7d6021c493cf637033ca47813ad5f7e (patch)
tree64fda816e9d37d8d10bac8d3bda48c042bfd0d7f
parent48295619b5f641c4ea8a877f401d22ab05c6f90b (diff)
downloadbcm5719-llvm-ea61147fc7d6021c493cf637033ca47813ad5f7e.tar.gz
bcm5719-llvm-ea61147fc7d6021c493cf637033ca47813ad5f7e.zip
[Sparc] Complex return value ABI compliance.
According to the Sparc V8 ABI, complex numbers should be passed and returned as pairs of registers: https://docs.oracle.com/cd/E26502_01/html/E28387/gentextid-2734.html This fix ensures this is the case. Without this, complex numbers are returned as a struct of two floats, which breaks the ABI rules. Differential Review: http://reviews.llvm.org/D20955 llvm-svn: 272148
-rw-r--r--clang/test/CodeGen/sparcv8-abi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/CodeGen/sparcv8-abi.c b/clang/test/CodeGen/sparcv8-abi.c
new file mode 100644
index 00000000000..cd8832f6534
--- /dev/null
+++ b/clang/test/CodeGen/sparcv8-abi.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK-LABEL: define { float, float } @p({ float, float }* byval align 4 %a, { float, float }* byval align 4 %b) #0 {
+float __complex__
+p (float __complex__ a, float __complex__ b)
+{
+}
+
+// CHECK-LABEL: define { double, double } @q({ double, double }* byval align 8 %a, { double, double }* byval align 8 %b) #0 {
+double __complex__
+q (double __complex__ a, double __complex__ b)
+{
+}
+
+// CHECK-LABEL: define { i64, i64 } @r({ i64, i64 }* byval align 8 %a, { i64, i64 }* byval align 8 %b) #0 {
+long long __complex__
+r (long long __complex__ a, long long __complex__ b)
+{
+}
OpenPOWER on IntegriCloud