From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15680 invoked by alias); 17 May 2004 13:07:42 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 15672 invoked by uid 48); 17 May 2004 13:07:41 -0000 Date: Mon, 17 May 2004 22:20:00 -0000 From: "uros at kss-loka dot si" To: gcc-bugs@gcc.gnu.org Message-ID: <20040517130734.15492.uros@kss-loka.si> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug rtl-optimization/15492] New: floating-point arguments are loaded too early to x87 stack X-Bugzilla-Reason: CC X-SW-Source: 2004-05/txt/msg01845.txt.bz2 List-Id: This testcase shows another problem with x87 stack: double test (double a, double b) { return a*a + b*b; } In this case, floating point arguments are loaded too early to x87 stack, with 'gcc -O2', resulting asm is: test: pushl %ebp movl %esp, %ebp fldl 8(%ebp) fldl 16(%ebp) fxch %st(1) fmul %st(0), %st fxch %st(1) popl %ebp fmul %st(0), %st faddp %st, %st(1) ret The situation is a little better with '-O2 -fomit-frame-pointer': test: fldl 4(%esp) fldl 12(%esp) fmul %st(0), %st fxch %st(1) fmul %st(0), %st faddp %st, %st(1) ret But optimal code would look something like this (second arg should be loaded to stack in some kind of 'just in time' fashion. test: fldl 4(%esp) fmul %st(0), %st fldl 12(%esp) fmul %st(0), %st faddp %st, %st(1) ret -- Summary: floating-point arguments are loaded too early to x87 stack Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: uros at kss-loka dot si CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15492