public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/15492] New: floating-point arguments are loaded too early to x87 stack
@ 2004-05-17 22:20 uros at kss-loka dot si
  2004-05-17 22:21 ` [Bug rtl-optimization/15492] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: uros at kss-loka dot si @ 2004-05-17 22:20 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <bug-15492-1649@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-15492-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2013-01-13 11:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-17 22:20 [Bug rtl-optimization/15492] New: floating-point arguments are loaded too early to x87 stack uros at kss-loka dot si
2004-05-17 22:21 ` [Bug rtl-optimization/15492] " pinskia at gcc dot gnu dot org
2004-08-17  8:00 ` [Bug target/15492] " uros at kss-loka dot si
2004-08-17  8:58 ` uros at kss-loka dot si
2004-08-19  8:07 ` uros at kss-loka dot si
2004-08-19 13:12 ` bangerth at dealii dot org
2004-09-13 13:06 ` uros at kss-loka dot si
2004-09-13 13:14 ` giovannibajo at libero dot it
2004-09-13 14:49 ` uros at kss-loka dot si
2005-06-21 11:24 ` steven at gcc dot gnu dot org
2005-06-21 11:31 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15492-1649@http.gcc.gnu.org/bugzilla/>
2006-07-21 17:07 ` hubicka at gcc dot gnu dot org
     [not found] <bug-15492-4@http.gcc.gnu.org/bugzilla/>
2013-01-13 11:28 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).