This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: optimisation problem with sqrt
- To: Christian Häggström <97nv46 at skola dot kiruna dot se>
- Subject: Re: optimisation problem with sqrt
- From: Sylvain Zimmermann <Sylvain dot Zimmermann at uhp dot u-nancy dot fr>
- Date: Fri, 12 May 2000 14:49:04 +0200
- CC: gcc at gcc dot gnu dot org
- References: <s91c04ca.023@ymer>
Christian Häggström wrote:
> > for (i = 0; i < 200000000; ++i) x = sqrt(2.0);
>
> > when asking for assembler output, the instruction 'fsqrt' always appears
> > (Even on my PIII 600). That's why I'm very puzzled.
>
> The 'sqrt' function is designed to take a non-constant argument.
> Prefer use M_SQRT_2 or similar for constants, defined in <math.h>.
Ok. But my goal was just to test my computer performances that I expected
better on my Pentium III (600 MHz) than on a Celeron (466 MHz). I only wanted
to see the time the processor would take for this loop.
I still don't understand why the 'fsqrt' is used in the assembler file and it
seems not beeing used really by the processor itself. (I'm a novice in
assembler.)
I searched in the mailing lists and found lots of emails related to this
problem. But they confuse me.
Maybe the clue is I installed everything on an Celeron and then, I put the
hard disk on a Pentium III? Should I compile gcc on my new machine?
Have you any idea from where the problem could come?
Thank you,
Sylvain Zimmermann