This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Fast operations on floating point numbers?
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: Martin Reinecke <martin at MPA-Garching dot MPG dot DE>
- Cc: gcc at gcc dot gnu dot org
- Date: 04 Dec 2003 15:30:45 +0100
- Subject: Re: Fast operations on floating point numbers?
- References: <3FCF05D6.8070301@mpa-garching.mpg.de>
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