Fast operations on floating point numbers?

Scott Robert Ladd coyote@coyotegulch.com
Thu Dec 4 14:43:00 GMT 2003


Martin Reinecke wrote:
> Unfortunately this does not work in all places where I have this
> problem. But even where I can use it, there is still a
> full floating-point multiplication where the simple XORing of
> a single bit should do. But maybe the cost of both operations
> is not so different on today's CPUs; I don't know.

Your problem is architecture-specific. For example, modern Intel 
architecture  processors support the FCHS instruction to flip the sign 
of the floating-point value in ST(0), by performing a simple bit flip. I 
haven't run any tests, but I suspect GCC is smart enough to use that 
instruction.

-- 
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing




More information about the Gcc mailing list