Commit da17a98b by Eric Botcazou Committed by Eric Botcazou

ffi.c (ffi_prep_cif_machdep): Add support for signed/unsigned int8/16 return values.

	* src/sparc/ffi.c (ffi_prep_cif_machdep): Add support for
	signed/unsigned int8/16 return values.
	* src/sparc/v8.S (ffi_call_v8): Likewise.
	(ffi_closure_v8): Likewise.

From-SVN: r142102
parent 88e091c3
2008-11-21 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_prep_cif_machdep): Add support for
signed/unsigned int8/16 return values.
* src/sparc/v8.S (ffi_call_v8): Likewise.
(ffi_closure_v8): Likewise.
2008-09-26 Peter O'Gorman <pogma@thewrittenword.com> 2008-09-26 Peter O'Gorman <pogma@thewrittenword.com>
Steve Ellcey <sje@cup.hp.com> Steve Ellcey <sje@cup.hp.com>
......
...@@ -307,14 +307,24 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) ...@@ -307,14 +307,24 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
cif->flags = FFI_TYPE_STRUCT; cif->flags = FFI_TYPE_STRUCT;
break; break;
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
if (cif->abi == FFI_V9)
cif->flags = FFI_TYPE_INT;
else
cif->flags = cif->rtype->type;
break;
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
if (cif->abi != FFI_V9) if (cif->abi == FFI_V9)
{ cif->flags = FFI_TYPE_INT;
else
cif->flags = FFI_TYPE_SINT64; cif->flags = FFI_TYPE_SINT64;
break; break;
}
/* FALLTHROUGH */
default: default:
cif->flags = FFI_TYPE_INT; cif->flags = FFI_TYPE_INT;
break; break;
......
...@@ -72,21 +72,63 @@ _ffi_call_v8: ...@@ -72,21 +72,63 @@ _ffi_call_v8:
be,a done be,a done
st %f0, [%i4+0] ! (delay) st %f0, [%i4+0] ! (delay)
cmp %i3, FFI_TYPE_DOUBLE
be,a double
st %f0, [%i4+0] ! (delay)
cmp %i3, FFI_TYPE_SINT8
be,a sint8
sll %o0, 24, %o0 ! (delay)
cmp %i3, FFI_TYPE_UINT8
be,a uint8
sll %o0, 24, %o0 ! (delay)
cmp %i3, FFI_TYPE_SINT16
be,a sint16
sll %o0, 16, %o0 ! (delay)
cmp %i3, FFI_TYPE_UINT16
be,a uint16
sll %o0, 16, %o0 ! (delay)
cmp %i3, FFI_TYPE_SINT64 cmp %i3, FFI_TYPE_SINT64
be longlong be,a longlong
st %o0, [%i4+0] ! (delay)
done:
ret
restore
cmp %i3, FFI_TYPE_DOUBLE double:
bne done
nop
st %f0, [%i4+0]
st %f1, [%i4+4] st %f1, [%i4+4]
ret
restore
done: sint8:
sra %o0, 24, %o0
st %o0, [%i4+0]
ret ret
restore restore
longlong: uint8:
srl %o0, 24, %o0
st %o0, [%i4+0] st %o0, [%i4+0]
ret
restore
sint16:
sra %o0, 16, %o0
st %o0, [%i4+0]
ret
restore
uint16:
srl %o0, 16, %o0
st %o0, [%i4+0]
ret
restore
longlong:
st %o1, [%i4+4] st %o1, [%i4+4]
ret ret
restore restore
...@@ -147,7 +189,8 @@ ffi_closure_v8: ...@@ -147,7 +189,8 @@ ffi_closure_v8:
be done1 be done1
cmp %o0, FFI_TYPE_INT cmp %o0, FFI_TYPE_INT
be integer be done1
ld [%fp-8], %i0
cmp %o0, FFI_TYPE_FLOAT cmp %o0, FFI_TYPE_FLOAT
be,a done1 be,a done1
...@@ -165,13 +208,11 @@ ffi_closure_v8: ...@@ -165,13 +208,11 @@ ffi_closure_v8:
cmp %o0, FFI_TYPE_STRUCT cmp %o0, FFI_TYPE_STRUCT
be done2 be done2
! FFI_TYPE_SINT64 cmp %o0, FFI_TYPE_SINT64
! FFI_TYPE_UINT64 be,a done1
ld [%fp-4], %i1 ldd [%fp-8], %i0
integer:
ld [%fp-8], %i0 ld [%fp-8], %i0
done1: done1:
jmp %i7+8 jmp %i7+8
restore restore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment