diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-11-21 22:12:56 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-11-21 22:12:56 +0000 |
commit | da17a98b19cc15739ace1f6e02a7d446f3fd8625 (patch) | |
tree | e4908e7709925a001d35bd321d109cb3865f4962 /libffi | |
parent | 88e091c3372048f6c3b3d41cbfedf422b5496808 (diff) | |
download | gcc-da17a98b19cc15739ace1f6e02a7d446f3fd8625.zip gcc-da17a98b19cc15739ace1f6e02a7d446f3fd8625.tar.gz gcc-da17a98b19cc15739ace1f6e02a7d446f3fd8625.tar.bz2 |
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
Diffstat (limited to 'libffi')
-rw-r--r-- | libffi/ChangeLog | 7 | ||||
-rw-r--r-- | libffi/src/sparc/ffi.c | 22 | ||||
-rw-r--r-- | libffi/src/sparc/v8.S | 69 |
3 files changed, 78 insertions, 20 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 1509523..10dd1eb 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,10 @@ +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> Steve Ellcey <sje@cup.hp.com> diff --git a/libffi/src/sparc/ffi.c b/libffi/src/sparc/ffi.c index a10fe81..fea0330 100644 --- a/libffi/src/sparc/ffi.c +++ b/libffi/src/sparc/ffi.c @@ -307,14 +307,24 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) cif->flags = FFI_TYPE_STRUCT; 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_UINT64: - if (cif->abi != FFI_V9) - { - cif->flags = FFI_TYPE_SINT64; - break; - } - /* FALLTHROUGH */ + if (cif->abi == FFI_V9) + cif->flags = FFI_TYPE_INT; + else + cif->flags = FFI_TYPE_SINT64; + break; + default: cif->flags = FFI_TYPE_INT; break; diff --git a/libffi/src/sparc/v8.S b/libffi/src/sparc/v8.S index 1d7bfa5..3830759 100644 --- a/libffi/src/sparc/v8.S +++ b/libffi/src/sparc/v8.S @@ -72,21 +72,63 @@ _ffi_call_v8: be,a done 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 - be longlong + be,a longlong + st %o0, [%i4+0] ! (delay) +done: + ret + restore - cmp %i3, FFI_TYPE_DOUBLE - bne done - nop - st %f0, [%i4+0] +double: st %f1, [%i4+4] - -done: ret restore -longlong: +sint8: + sra %o0, 24, %o0 + st %o0, [%i4+0] + ret + restore + +uint8: + srl %o0, 24, %o0 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] ret restore @@ -147,7 +189,8 @@ ffi_closure_v8: be done1 cmp %o0, FFI_TYPE_INT - be integer + be done1 + ld [%fp-8], %i0 cmp %o0, FFI_TYPE_FLOAT be,a done1 @@ -165,13 +208,11 @@ ffi_closure_v8: cmp %o0, FFI_TYPE_STRUCT be done2 - ! FFI_TYPE_SINT64 - ! FFI_TYPE_UINT64 - ld [%fp-4], %i1 + cmp %o0, FFI_TYPE_SINT64 + be,a done1 + ldd [%fp-8], %i0 -integer: ld [%fp-8], %i0 - done1: jmp %i7+8 restore |