User-space context switch and floating-point

Peter Grehan grehan at freebsd.org
Wed Mar 3 21:12:06 PST 2004


 > 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;

  Substitute integers for float and it's exactly the same problem
and handled in the same way: the caller saves registers it is using
for intermediate results prior to the mutex_lock and restores them
on return according to the calling convention.

> I don't know anything about PPC...

  It's generic RISC, similar to Alpha in terms of register usage.
That's what made me wonder about not saving FP state in the Alpha
code, but I now think that's a requirement if there are 2 or more
threads using FP. That will be a big performance hit as per my
routine comments so I'll do some experiments to see how severe
it is and whether it can be alleviated.

later,

Peter.





More information about the freebsd-threads mailing list