Michael Plante wrote:> If it's already in an FP register, there's a *chance* it might be faster > to do the multiply (or subtract from 0) than if it has to be fetched from > RAM.Very right.. I'd like to add something: It's very architecture specific. There are FP implementations where a transfer from a floating-point register to integer register is not that costly. And then there are architectures where such a transfer hurts performance a lot. The new ARM neon fp-core is such a beast. If you move something from float to the integer unit you'll see in the best case a 20 cycle stall. The NEON unit lags behind in execution by these 20 cycles. It becomes even worse if you write to memory via the neon-pipeline and immediately read the data into a integer register. On PPC you get a load-hit-store stall which is slow as well. So if you want to do such tricks always benchmark the code and make sure you don't accidentally make the bottleneck even worse. Cheers, Nils
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →
floating point number and efficient sign operation
Started by ●December 16, 2009
Reply by ●December 17, 20092009-12-17







