This is the mail archive of the
mailing list for the GCC project.
Re: GCC viciously beaten by ICC in trig test!
On Mon, 2004-03-15 at 20:05, Toon Moene wrote:
> Roger Sayle wrote:
> > On Sun, 14 Mar 2004, Scott Robert Ladd wrote:
> >>Consider the following program, compiled and run on a Pentium 4
> >>(Northwood) system:
> >> #include <math.h>
> > For a number of benchmarks, just this first line of source code above
> > is enough to loose the race for GCC against Intel when compiling on Linux.
> Indeed - and that's the basic reason why you should write this kind of
> software in Fortran: No pesky header files destroying your carefully
> optimized code ....
> [ OK, I couldn't resist :-) :-) ]
Arghhh tempting... or Ada? With GCC 3.3.2 from Fedora Core 1, the do_it
call is removed from the loop at -O1 (the curious can check pragma Pure
in the Ada Reference Manual).
procedure P1 is
subtype Num is Long_Float;
function Do_It (A : in Num) return Num is
C : constant Num := Cos (A);
S : constant Num := Sin (A);
return S * S + C * C;
A : Num := 1.0;
R : Num := 0.0;
for I in 1 .. 100_000_000 loop
R := R + Do_It (A);
Put_Line (Num'Image (R));