This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Functions returning structure with float on sparc64


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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]