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: GCC viciously beaten by ICC in trig test!


On Mon, Mar 15, 2004 at 12:15:31AM -0500, James Morrison wrote:
> > 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.
> > 
> > Consider the following:
> > 
> > 	#include <math.h>
> > 
> > 	double doit(double a)
> > 	{
> > 	  return sin(a) * sin(a);
> > 	}
> > 
> > 
> > Compiling with gcc -O2 -ffast-math on Linux generates x86 code that's
> > significantly slower than Intel's compiler output.  However, commenting
> > out the "#include <math.h>" corrects the situation and GCC can then
> > generate *exactly* the same sequence as icc.
> 
>  You probably want to bring this up on libc-alpha to see if Ulrich will
> remove the inline math functions then.

Well, the inlines shouldn't be removed, but guarded with
# if !__GNUC_PREREQ (MAJOR,MINOR)
...
# endif
where MAJOR, MINOR is the first __GNUC__ and __GNUC_MINOR__ of GCC which
can handle all cases the same or better than the glibc inline.
This is true for both math inlines and stringops (the latter is harded,
because for some functions, GCC generates better code for some testcases
and GLIBC for others).
So GCC and GLIBC need to cooperate in testing/benchmarking to create the
list of MAJOR,MINOR when sufficiently good builtin was introduced in GCC.

	Jakub


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