This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fast operations on floating point numbers?


Martin Reinecke <martin@MPA-Garching.MPG.DE> writes:

> if (flipsign)
>    a = -a;
> 
> in an inner loop which is executed billions of times.
> I suspect that the conditional slows the execution down,
> and the "a=-a" statement might not be optimal as well.

a = -a should produce optimal code. If it doesn't, please file a bug
report. We should not need intrinsics for this.

> Similarly, there is the math library function ldexp(), which
> multiplies a double with a given power of two. For some reason it is
> extremely slow, but in principle it should just add a number to the
> exponent of the double (and do a few sanity checks).

gcc provides __builtin_ldexp for this. I don't know whether it is well
optimized, though. If it doesn't produce optimal code for your
platform, please file a bug report with the assembly you would like to
see for it.

-- 
	Falk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]