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: [RFC PATCH, i386]: Pass FP arguments in i387 registers


On 10/12/06, Richard Guenther <richard.guenther@gmail.com> wrote:

The patch mostly looks ok, though I wonder about the FIXME in regstack and

+  /* For local functions, pass up to X87_REGPARM_MAX floating point
+     arguments in x87 registers.  */
+  if (!TARGET_64BIT && decl
+      && flag_unit_at_a_time && !profile_flag)
+    {
+      struct cgraph_local_info *i = cgraph_local_info (decl);
+      if (i && i->local)
+       return 1;
+    }

shouldn't we disable this if !(ix86_fpmath & FPMATH_387)?  How will the code
decide where to pass SF/DFmode arguments if -mfpmath=387,sse is in effect?

It is not necessary to disable this. sse has precedence over 387 and in this case, sse registers will be used.

BTW: While testing, I found that actually we pass only 3 SSE registers
to local functions. Either the comment around line 2629 (i386.c) or
the code itself should be fixed:

 /* 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)

You can check this fact with -msse2 -mfpmath=sse:

static double __attribute__((noinline)) test(double a, double b,
double c, double d, double e, double f, double g, double h, double i,
double j)
{
 return a + b + c + d + e + f + g + h + i + j;
}

It should be noted that 3 args in registers is enough for 99% of
functions. Functions that require more arguments are usually long and
complicated, so the effects of memory traffic are suppressed for them.

FYI:For x87, setting max arguments to 3 prevents excessive fxch usage,
as arguments have to be arranged in stack before function call.

Uros.


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