From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11317 invoked by alias); 15 Mar 2004 02:41:19 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 11288 invoked from network); 15 Mar 2004 02:41:18 -0000 Received: from unknown (HELO ams006.ftl.affinity.com) (216.219.253.152) by sources.redhat.com with SMTP; 15 Mar 2004 02:41:18 -0000 Received: from coyotegulch.com ([4.4.125.218]) by ams.ftl.affinity.com with ESMTP id <318128-24145>; Sun, 14 Mar 2004 21:26:37 -0500 Message-ID: <40551459.8050909@coyotegulch.com> Date: Mon, 15 Mar 2004 02:41:00 -0000 From: Scott Robert Ladd User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040310 Debian/1.6-2 MIME-Version: 1.0 To: Roger Sayle CC: gcc@gcc.gnu.org Subject: Re: GCC viciously beaten by ICC in trig test! References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00651.txt.bz2 Roger Sayle wrote: > Consider the following: > > #include > > 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 " corrects the situation and GCC > can then generate *exactly* the same sequence as icc. Wonderful! This is *exactly* the insight I was looking for... > The issue is that glibc's headers provide inline implementations for > sin and cos, and thereby override all of GCC's internal builtin > processing. I should have thought of this; I've had some past problems with glibc headers causing problems in my code. > Once this is done, there's nothing tree-ssa, the middle-end or the > i386 can do to improve the code. If GCC is to have a hope of using > "sincos" or SSE2 specific instruction sequences, the "best > intentions" of glibc's headers (will) have to be neutralized first. > Perhaps fixincludes :> 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... ;) -- Scott Robert Ladd Coyote Gulch Productions (http://www.coyotegulch.com) Software Invention for High-Performance Computing