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]

Re: optimisation problem with sqrt



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



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