From: Richard Henderson <rth@twiddle.net>
To: libffi-discuss@sourceware.org
Subject: [PATCH 09/13] x86: Add support for Complex
Date: Fri, 07 Nov 2014 15:31:00 -0000 [thread overview]
Message-ID: <1415374240-1792-10-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1415374240-1792-1-git-send-email-rth@twiddle.net>
---
src/x86/ffi.c | 27 +++++++++++++++++++++++++++
testsuite/libffi.call/call.exp | 3 ++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/src/x86/ffi.c b/src/x86/ffi.c
index 40e47d2..a0d0cf3 100644
--- a/src/x86/ffi.c
+++ b/src/x86/ffi.c
@@ -120,6 +120,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
else
#endif
{
+ do_struct:
switch (cabi)
{
case FFI_THISCALL:
@@ -136,6 +137,32 @@ ffi_prep_cif_machdep(ffi_cif *cif)
bytes += ALIGN (sizeof(void*), FFI_SIZEOF_ARG);
}
break;
+ case FFI_TYPE_COMPLEX:
+ switch (cif->rtype->elements[0]->type)
+ {
+ case FFI_TYPE_DOUBLE:
+ case FFI_TYPE_LONGDOUBLE:
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_UINT64:
+ goto do_struct;
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_UINT32:
+ flags = X86_RET_INT64;
+ break;
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT16:
+ flags = X86_RET_INT32;
+ break;
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT8:
+ flags = X86_RET_STRUCT_2B;
+ break;
+ default:
+ return FFI_BAD_TYPEDEF;
+ }
+ break;
default:
return FFI_BAD_TYPEDEF;
}
diff --git a/testsuite/libffi.call/call.exp b/testsuite/libffi.call/call.exp
index 55de25c..d42dae5 100644
--- a/testsuite/libffi.call/call.exp
+++ b/testsuite/libffi.call/call.exp
@@ -27,7 +27,8 @@ run-many-tests $tlist ""
# ??? We really should preprocess ffi.h and grep
# for FFI_TARGET_HAS_COMPLEX_TYPE.
if { [istarget s390*]
- || [istarget x86_64*] } {
+ || [istarget x86_64*]
+ || [istarget i?86*] } {
run-many-tests $ctlist ""
} else {
foreach test $ctlist {
--
1.9.3
next prev parent reply other threads:[~2014-11-07 15:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 15:30 [PATCH 00/13] Go closures for i686 Richard Henderson
2014-11-07 15:30 ` [PATCH 02/13] x86: Remove some conditional compilation Richard Henderson
2014-11-07 15:31 ` [PATCH 06/13] x86: Rewrite ffi_call Richard Henderson
2014-11-07 15:31 ` [PATCH 08/13] testsuite: Fix return_complex2 vs excessive precision Richard Henderson
2014-11-07 15:31 ` [PATCH 01/13] x86: Tidy ffi_abi Richard Henderson
2014-11-07 15:31 ` [PATCH 03/13] x86: Force FFI_TYPE_LONGDOUBLE different from FFI_TYPE_DOUBLE Richard Henderson
2014-11-07 15:31 ` [PATCH 13/13] x86: Work around two clang assembler bugs Richard Henderson
2014-11-07 15:31 ` [PATCH 04/13] x86: Convert to gas generated unwind info Richard Henderson
2014-11-07 15:31 ` [PATCH 11/13] x86: Use win32 name mangling for fastcall functions Richard Henderson
2014-11-07 15:31 ` Richard Henderson [this message]
2014-11-07 15:31 ` [PATCH 07/13] x86: Rewrite closures Richard Henderson
2014-11-07 15:31 ` [PATCH 12/13] testsuite: Add two dg-do run markers Richard Henderson
2014-11-07 15:31 ` [PATCH 10/13] x86: Add support for Go closures Richard Henderson
2014-11-07 15:31 ` [PATCH 05/13] ffi_cif: Add cfa_escape Richard Henderson
2014-11-07 16:09 ` [PATCH 00/13] Go closures for i686 Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415374240-1792-10-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=libffi-discuss@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).