Mail Archives: pgcc/1999/07/11/18:01:55
Niteshadow writes:
>
> On Fri, 9 Jul 1999, Henrik Berglund SdU wrote:
>
> > Have a 3dnow library that i would like to try, it has some optimised cos
> > sin sqrt funktions.
>
> I do not think that you can optimize these functions more than to execute
> a single instruction in the FPU.
Might be worth a try. On modern processors, using a single
instruction to do transcendental functions may not be as optimal as
you might think. Except for square root, such instructions are not
implemented using hard-wired circuitry. Instead they are performed
using microcoded sequences of simpler floating-point operations.
An implementation of the functions by the compiler using sequences of
simple floating-point instructions might do better. This would depend
on a bunch of factors, including the amount of instruction-level
parallelism available in the processor, the other floating-point
operations being performed in the same block of code, and the
effectiveness of the compiler's optimizations.
If you were using this technique, however, you'd want to make the
functions into in-line instruction sequences so that the compiler
could optimize them effectively. If the functions are implemented
with straight library calls, most of the compiler's chances for
optimization will be lost, and the single-instruction approach will
win out.
- Raw text -