Date: Sun, 11 Jul 1999 14:58:46 -0700 (PDT) Message-Id: <199907112158.OAA17787@southpole> From: Colin Howell MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: pgcc AT delorie DOT com Subject: Re: libm.a In-Reply-To: References: X-Mailer: VM 6.31 under 20.2 XEmacs Lucid Reply-To: pgcc AT delorie DOT com X-Mailing-List: pgcc AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.