public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/43639]  New: Missed optimization with complex long double
@ 2010-04-04  6:21 svfuerst at gmail dot com
  2010-04-04  6:28 ` Andrew Pinski
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: svfuerst at gmail dot com @ 2010-04-04  6:21 UTC (permalink / raw)
  To: gcc-bugs

gcc 4.4 compiles the following:

_Complex long double foo(long double p1, long double p2)
{
        return p1 + (__extension__ 1.0iF) * p2;
}

gcc-4.4 -O3 tgcc.c -c -o tgcc.o

into

   0x0000000000000000 <+0>:     fldt   0x8(%rsp)
   0x0000000000000004 <+4>:     fldt   0x18(%rsp)
   0x0000000000000008 <+8>:     fxch   %st(1)
   0x000000000000000a <+10>:    retq

This is ok, except for the useless fxch instruction.  However, gcc 4.5 compiles
the same code into:
gcc-4.5 -O3 tgcc.c -c -o tgcc.o

   0x0000000000000000 <+0>:     fldt   0x18(%rsp)
   0x0000000000000004 <+4>:     fld    %st(0)
   0x0000000000000006 <+6>:     fmuls  0x0(%rip)        # 0xc <foo+12>
   0x000000000000000c <+12>:    fldt   0x8(%rsp)
   0x0000000000000010 <+16>:    faddp  %st,%st(1)
   0x0000000000000012 <+18>:    retq

which is quite a bit worse.


-- 
           Summary: Missed optimization with complex long double
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: svfuerst at gmail dot com
 GCC build triplet: x86_64-linux
  GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-05-22 18:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-04  6:21 [Bug c/43639] New: Missed optimization with complex long double svfuerst at gmail dot com
2010-04-04  6:28 ` Andrew Pinski
2010-04-04  6:29 ` [Bug c/43639] " pinskia at gmail dot com
2010-04-04 16:51 ` svfuerst at gmail dot com
2010-04-04 19:12 ` joseph at codesourcery dot com
2010-05-22 18:43 ` jsm28 at gcc dot gnu dot org

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).