x86: Add support for Complex

This commit is contained in:
Richard Henderson
2014-11-05 16:34:41 +01:00
parent b21ec1ce78
commit 198f469e91
2 changed files with 29 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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 {