GCC viciously beaten by ICC in trig test!

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Mar 15 03:05:00 GMT 2004


Scott Robert Ladd <coyote@coyotegulch.com> writes:

| Roger Sayle wrote:
| > 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.
| 
| Wonderful! This is *exactly* the insight I was looking for...

Note that it has been reported in the past the the x86 native
instruction fsin yields incorrect results for values outside or a
certain interval (I can't remember which exactly). 

[...]

| Sometimes, I wonder if GCC should ship its own Standard C library, just
| as it ships a Standard C++ template library. However, I suspect the
| suggesting such a move might be a bit controversial... ;)

Yep, but it would make V3 happy ;-)

-- Gaby



More information about the Gcc mailing list