This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Functions returning structure with float on sparc64
- To: Olivier Hainque <hainque at act-europe dot fr>
- Subject: Re: Functions returning structure with float on sparc64
- From: Richard Henderson <rth at redhat dot com>
- Date: Tue, 30 Jan 2001 16:01:42 -0800
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc-patches at gcc dot gnu dot org
- References: <14960.18580.205839.455628@berlin.int.act-europe.fr>
On Thu, Jan 25, 2001 at 04:39:00PM +0100, Olivier Hainque wrote:
> typedef struct {
> float f;
> int i;
> int j;
> } datablock_t;
...
> 12 mov 11, %o0
> 13 ld [%sp+192], %f0
> 14 retl
It looks like we weren't calculating the number of registers needed
properly. Jakub, could you eyeball this patch for ABI correctness
and perhaps run some regression tests against it? (We don't have a
sparc64-linux box in Sunnyvale; something we should fix at some point.)
r~
* config/sparc/sparc.c (function_arg_record_value_3): Fix
calculation of the number of integer registers required.
(function_arg_record_value): Likewise.
Index: sparc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sparc/sparc.c,v
retrieving revision 1.134
diff -c -p -d -r1.134 sparc.c
*** sparc.c 2001/01/02 02:45:03 1.134
--- sparc.c 2001/01/30 23:56:31
*************** function_arg_record_value_3 (bitpos, par
*** 4140,4145 ****
--- 4140,4146 ----
{
enum machine_mode mode;
unsigned int regno;
+ unsigned int startbit, endbit;
int this_slotno, intslots, intoffset;
rtx reg;
*************** function_arg_record_value_3 (bitpos, par
*** 4149,4155 ****
intoffset = parms->intoffset;
parms->intoffset = -1;
! intslots = (bitpos - intoffset + BITS_PER_WORD - 1) / BITS_PER_WORD;
this_slotno = parms->slotno + intoffset / BITS_PER_WORD;
intslots = MIN (intslots, SPARC_INT_ARG_MAX - this_slotno);
--- 4150,4158 ----
intoffset = parms->intoffset;
parms->intoffset = -1;
! startbit = intoffset & -BITS_PER_WORD;
! endbit = (bitpos + BITS_PER_WORD - 1) & -BITS_PER_WORD;
! intslots = (endbit - startbit) / BITS_PER_WORD;
this_slotno = parms->slotno + intoffset / BITS_PER_WORD;
intslots = MIN (intslots, SPARC_INT_ARG_MAX - this_slotno);
*************** function_arg_record_value (type, mode, s
*** 4265,4274 ****
if (parms.intoffset != -1)
{
int intslots, this_slotno;
! intslots = (typesize*BITS_PER_UNIT - parms.intoffset + BITS_PER_WORD - 1)
! / BITS_PER_WORD;
this_slotno = slotno + parms.intoffset / BITS_PER_WORD;
intslots = MIN (intslots, SPARC_INT_ARG_MAX - this_slotno);
--- 4268,4279 ----
if (parms.intoffset != -1)
{
+ unsigned int startbit, endbit;
int intslots, this_slotno;
! startbit = parms.intoffset & -BITS_PER_WORD;
! endbit = (typesize*BITS_PER_UNIT + BITS_PER_WORD - 1) & -BITS_PER_WORD;
! intslots = (endbit - startbit) / BITS_PER_WORD;
this_slotno = slotno + parms.intoffset / BITS_PER_WORD;
intslots = MIN (intslots, SPARC_INT_ARG_MAX - this_slotno);