On Tuesday 19 June 2001 19:37, alexander w. fiedel wrote:
> ....another one of thoose beginners questions...
>
> hi.
> I want to check if my fpu is working - and if it is really
> useful to use it (also timing tests for the protocoll...)
> I wrote a short loop with calcs, activate the fpu, compute
> and measure the results (with d/a card and oscilloscope).
> the time results are always the same - with or without fpu
> enabled.
> about 14us...
>
> has anyone an idea?! or is this again a typical beginners
> fault in thinking...
>
> I use rtlinux3, kernel 2.2.18 and PIII 1GHz.
> thanks!
>
> ---
>
> the loop (with cos, mul and sqrt), used in "task_one()":
>
> for (i=0;i<=35;i++){
> output*=(cos(output)*3.23458);
> output*=(cos(2.578*output));
> output=sqrt(output);
> }
First of all; what are you doing to "enable/disable" the FPU?
AFAIK, Linux never uses FPU emulation if a real FPU is present, so you would
have to compile FPU emulation in and then disable the FPU in the BIOS to
actually use it. (If that works, that is. Not sure if it's actually possible
for the chipset to tell a P-III not to show it's FPU when the OS asks for
it...)
To do *real* integer/fixpoint maths, you'll need a special math library for
that. (The gcc compiler doesn't come with one, AFAIK.) If you're using the
standard trig operations and other FP functions, all you can change with
headers, compiler switches and linking is whether function calls + libm or
inline FPU code should be used - you can't have the compiler translate the
code into integer/fixpoint maths.
What's the data type of the output variable? Int/float conversions are pretty
expensive, especially if you allow the compiler to do it according to the
ANSI standard, which isn't compatible with the way Intel (and many other)
FPUs do it. Try keeping everything in the same domain (integer or floating
point), particularly inside the inner loops.
Finally, note that today's processors do FP operations just as fast as
integer operations, and real FP code is often faster than integer/fixpoint
math. (Integer and fixpoint usually require extra operations to keep the data
inside the limited range.)
//David Olofson --- Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
----- End of forwarded message from [EMAIL PROTECTED] -----
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/