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: PATCH: PR target/34001: Incorrect x86 fastcall behavior


On Fri, Nov 16, 2007 at 12:35:47PM +0800, Ye, Joey wrote:
> HJ,
> 
> You patch has a minor problem that fastcall will pass non-scalar integer parameter in EAX/ECX/EDX, which is still imcompatible to MS fastcall. MSVC pass parameter on stack unless it is scalar integer less equal to 32 bits.
> 
> With this patch GCC fastcall passes first parameter in EAX when it is not a scalar integer less equal to 32 bits. Check following example and review the patch fixing it:
> 
> Here is a patch to fix it:
> Index: gcc/config/i386/i386.c
> ===================================================================
> --- gcc/config/i386/i386.c      (revision 129880)
> +++ gcc/config/i386/i386.c      (working copy)
> @@ -4229,9 +4229,12 @@
>           int regno = cum->regno;
> 
>           /* Fastcall allocates the first two DWORD (SImode) or
> -            smaller arguments to ECX and EDX.  */
> +            smaller arguments to ECX and EDX if it isn't an
> +            aggregate type .  */
>           if (cum->fastcall)
>             {
> +             if (type && AGGREGATE_TYPE_P (type))
> +               break;
>               if (mode == BLKmode || mode == DImode)
>                 break;
>   

Yes, this version is correct. Thanks.


H.J.


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