User-space context switch and floating-point

Daniel Eischen eischen at vigrid.com
Wed Mar 3 20:36:20 PST 2004


On Thu, 4 Mar 2004, Peter Grehan wrote:

> >>  Any opinions ? I noticed the alpha/sparc64 routines don't save FP.
> > 
> > You don't need to save floating point registers when saving the
> > context from userland.
> 
>   But why is that any different from having to save non-volatile
> integer registers ? For instance, on PPC, gp regs 14-31, and also
> fp regs 14-31, need to be saved by the callee if used since they're
> non-volatile across function calls.
> 
> > Look at the i386 thr_getcontext(); it only needs to save the FP
> > control word.
> 
>   Yes, but I thought the i386 FP calling convention was that all
> FP registers were volatile across calls, so all were preserved
> by the callee.

Yes, but how do you generate code that does:

  double x, y;

  ...
  x = y * 1.5 * sqrt(2.25) - 3.15 + pthread_mutex_lock(&m) + 1.25;
  ...

If on the other hand:

  x = y * 1.5 - sqrt(2.25);
  pthread_mutex_lock(&m);
  x = x + 2.0;

requires FP registers to be saved, then so be it.  I don't know
anything about PPC...

-- 
Dan Eischen



More information about the freebsd-threads mailing list