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] 4th try: Add sseregparm function attribute for x86


On Wed, Jun 15, 2005 at 10:30:49PM +0200, Richard Guenther wrote:
> 	* doc/extend.texi: Document sseregparm target attribute.
> 	Clarify fastcall and regparm documentation.
> 	* config/i386/i386.c: Add new target attribute sseregparm.
> 	(ix86_handle_cdecl_attribute, ix86_handle_regparm_attribute):
> 	Merge into ...
> 	(ix86_handle_cconv_attribute): ... here.  Also handle
> 	sseregparm attribute.
> 	(ix86_comp_type_attributes): Compare sseregparm attributes.
> 	(ix86_function_sseregparm): New function, split out from ...
> 	(init_cumulative_args): ... here.  Use to decide use
> 	of SSE registers and error in case of missing support.
> 	(ix86_value_regno): Likewise.
> 	(function_arg_advance): Do not bail out for DFmode if we need
> 	to pass doubles in registers.
> 	(function_arg): Likewise.
> 
> 	* gcc.target/i386/attributes-error.c: New testcase.
> 	* gcc.target/i386/fastcall-sseregparm.c: Likewise.
> 	* gcc.target/i386/regparm-stdcall.c: Likewise.
> 	* gcc.target/i386/sseregparm-1.c: Likewise.
> 	* gcc.target/i386/sseregparm-2.c: Likewise.

So it looks like the actual attribute processing bits are ok.  However...

> +   /* For local functions, pass SFmode (and DFmode for SSE2) arguments
> +      in SSE registers even for 32-bit mode and not just 3, but up to
> +      8 SSE arguments in registers.  */
> +   if (!TARGET_64BIT && decl
> +       && TARGET_SSE_MATH && flag_unit_at_a_time && !profile_flag)
> +     {
> +       struct cgraph_local_info *i = cgraph_local_info (decl);
> +       if (i && i->local)
> + 	return true;
> +     }

This comment is now in error and we'll be introducing a performance
regression with SSE1 -mfpmath=sse.  For functions that are promoted
internally from cdecl, we only want floats to be put into SSE registers.

This can be fixed by returning {0,1,2} from this function, indicating
what level of SSE parameter passing we'd like, and using that

> +   /* Set up the number of SSE registers used for passing SFmode
> +      and DFmode arguments.  Warn for mismatching ABI.  */
> +   if (ix86_function_sseregparm (fntype, fndecl))
> +     {
> +       cum->sse_nregs = 8;
> +       cum->float_in_sse = true;
>       }

here,

[ As an aside, sse_nregs has already been initialized here.  All you
  need is cum->float_in_sse = ix86_function_sseregparm (...). ]

>   	case DFmode:
> - 	  if (!TARGET_SSE2)
> - 	    break;
>   	case SFmode:
>   	  if (!cum->float_in_sse)
>   	    break;

here,

>     /* Floating point return values in %st(0), except for local functions when
> !      SSE math is enabled or for functions with sseregparm attribute.  */
> !   if (func && (mode == SFmode || mode == DFmode)
> !       && ix86_function_sseregparm (TREE_TYPE (func), func))
> !     return FIRST_SSE_REG;

and here.



r~


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