diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-21 22:12:56 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-21 22:12:56 +0000 |
commit | 95c3349b9ddc58809430e88d72d88e942bbc4603 (patch) | |
tree | e4908e7709925a001d35bd321d109cb3865f4962 /libffi | |
parent | e29848bc31f401279c66b3a522970f0ce4e49efe (diff) | |
download | gcc-95c3349b9ddc58809430e88d72d88e942bbc4603.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142102 138bc75d-0d04-0410-961f-82ee72b054a4
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 1509523ea65..10dd1ebeb3d 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 a10fe811dad..fea0330e4e6 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 1d7bfa51daa..38307599bf5 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 |