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]
Other format: [Raw text]

Re: [MIPS64] Problems when Passing TImode Parameters in EABI


Richard Sandiford <richard@codesourcery.com> writes:
> "Fu, Chao-Ying" <fu@mips.com> writes:
>>   I think there is a bug in mips_pass_by_reference when the mips abi
>> is EABI to pass TImode parameters.
>
> Good catch.
>
>>   Does someone know how to pass TImode parameters in EABI?  Thanks!
>
> I imagine this case wasn't specifically considered.  The EABI calls
> for double-word integers to be passed by value on 32-bit targets,
> so if 128-bit integers had been considered, I imagine the EABI
> would call for them to be handled in the same way on 64-bit targets.
>
> As it is, the EABI uses stack passing as the fallback case for
> "parameters not otherwise handled above".  So I think the type
> != NULL case is doing the right thing.  Sticking with it also
> has the advantage that it wouldn't break backward compatiblity
> for cases that currently work.  I don't think this particular
> case has ever worked for libcalls.
>
> I'll whip up a patch tonight.  I imagine this is also the reason for the
> gcc.dg/torture/fp-int-convert-timode.c failures on mipsisa64-elf, which
> I haven't had the spare time to look at yet.

It was.  I've committed the patch below after testing on mipsisa64-elf.
It fixes the gcc.dg/torture/fp-int-convert-timode.c and gcc.dg/ftrapv-2.c
failures for 64-bit multilibs.

Richard


gcc/
	* config/mips/mips.c (mips_pass_by_reference): Do not return false
	for EABI if type is NULL.  Use a size check based on GET_MODE_SIZE
	instead.

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(revision 117451)
+++ gcc/config/mips/mips.c	(working copy)
@@ -7556,10 +7556,10 @@ mips_pass_by_reference (CUMULATIVE_ARGS 
       int size;
 
       /* ??? How should SCmode be handled?  */
-      if (type == NULL_TREE || mode == DImode || mode == DFmode)
+      if (mode == DImode || mode == DFmode)
 	return 0;
 
-      size = int_size_in_bytes (type);
+      size = type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
       return size == -1 || size > UNITS_PER_WORD;
     }
   else


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