summaryrefslogtreecommitdiff
path: root/libffi
diff options
context:
space:
mode:
authorandreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-16 23:24:53 +0000
committerandreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-16 23:24:53 +0000
commitc3f75f1126191e55d4e57f0b0ec56ab9a7db9b3e (patch)
treebc0fd671d12c5cacb37413d21af623ab8d556f19 /libffi
parente85c320d59fc12b4fd172f52a893780a4cc65ded (diff)
downloadgcc-c3f75f1126191e55d4e57f0b0ec56ab9a7db9b3e.tar.gz
2007-11-17 Andreas Tobler <a.tobler@schweiz.org>
* src/powerpc/sysv.S: Load correct cr to compare if we have long double. * src/powerpc/linux64.S: Likewise. * src/powerpc/ffi.c: Add a comment to show which part goes into cr6. * testsuite/libffi.call/return_ldl.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130247 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi')
-rw-r--r--libffi/ChangeLog7
-rw-r--r--libffi/src/powerpc/ffi.c3
-rw-r--r--libffi/src/powerpc/linux64.S1
-rw-r--r--libffi/src/powerpc/sysv.S1
-rw-r--r--libffi/testsuite/libffi.call/return_ldl.c34
5 files changed, 45 insertions, 1 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 0f434c86276..8aaef6e581b 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-17 Andreas Tobler <a.tobler@schweiz.org>
+
+ * src/powerpc/sysv.S: Load correct cr to compare if we have long double.
+ * src/powerpc/linux64.S: Likewise.
+ * src/powerpc/ffi.c: Add a comment to show which part goes into cr6.
+ * testsuite/libffi.call/return_ldl.c: New test.
+
2007-09-04 <aph@redhat.com>
* src/arm/sysv.S (UNWIND): New.
diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c
index fe5550d5889..eaa4c869be8 100644
--- a/libffi/src/powerpc/ffi.c
+++ b/libffi/src/powerpc/ffi.c
@@ -40,7 +40,8 @@ enum {
FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */
FLAG_RETURNS_FP = 1 << (31-29),
FLAG_RETURNS_64BITS = 1 << (31-28),
- FLAG_RETURNS_128BITS = 1 << (31-27),
+
+ FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */
FLAG_ARG_NEEDS_COPY = 1 << (31- 7),
FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */
diff --git a/libffi/src/powerpc/linux64.S b/libffi/src/powerpc/linux64.S
index dbfcc7b8f3d..2cfebbf1c57 100644
--- a/libffi/src/powerpc/linux64.S
+++ b/libffi/src/powerpc/linux64.S
@@ -125,6 +125,7 @@ ffi_call_LINUX64:
.Lfp_return_value:
bf 28, .Lfloat_return_value
stfd %f1, 0(%r30)
+ mtcrf 0x02, %r31 /* cr6 */
bf 27, .Ldone_return_value
stfd %f2, 8(%r30)
b .Ldone_return_value
diff --git a/libffi/src/powerpc/sysv.S b/libffi/src/powerpc/sysv.S
index 9a9a109d1ae..9682016d2fa 100644
--- a/libffi/src/powerpc/sysv.S
+++ b/libffi/src/powerpc/sysv.S
@@ -121,6 +121,7 @@ L(done_return_value):
L(fp_return_value):
bf 28,L(float_return_value)
stfd %f1,0(%r30)
+ mtcrf 0x02,%r31 /* cr6 */
bf 27,L(done_return_value)
stfd %f2,8(%r30)
b L(done_return_value)
diff --git a/libffi/testsuite/libffi.call/return_ldl.c b/libffi/testsuite/libffi.call/return_ldl.c
new file mode 100644
index 00000000000..413bf94a67d
--- /dev/null
+++ b/libffi/testsuite/libffi.call/return_ldl.c
@@ -0,0 +1,34 @@
+/* Area: ffi_call
+ Purpose: Check return value long double.
+ Limitations: none.
+ PR: none.
+ Originator: <andreast@gcc.gnu.org> 20071113 */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+static long double return_ldl(long double ldl)
+{
+ return 2*ldl;
+}
+int main (void)
+{
+ ffi_cif cif;
+ ffi_type *args[MAX_ARGS];
+ void *values[MAX_ARGS];
+ long double ldl, rldl;
+
+ args[0] = &ffi_type_longdouble;
+ values[0] = &ldl;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
+ &ffi_type_longdouble, args) == FFI_OK);
+
+ for (ldl = -127.0; ldl < 127.0; ldl++)
+ {
+ ffi_call(&cif, FFI_FN(return_ldl), &rldl, values);
+ CHECK(rldl == 2 * ldl);
+ }
+ exit(0);
+}